Static Analysis of Run-time Modes in Kahn Process Networks