static void *MarkInstance( block *blk ) /**************************************/ { block_edge *edge; block_num i; data_flow_def *flow; global_bit_set *bitp; if( _IsBlkVisited( blk ) ) return( NULL ); _MarkBlkVisited( blk ); blk->id = Instance; flow = blk->dataflow; if( _GBitOverlap( flow->in, Id ) ) { for( edge = blk->input_edges; edge != NULL; edge = edge->next_source ) { bitp = &edge->source->dataflow->out; if( _GBitOverlap( *bitp, Id ) ) { SafeRecurseCG( (func_sr)MarkInstance, edge->source ); } } } if( _GBitOverlap( flow->out, Id ) ) { edge = &blk->edge[0]; for( i = blk->targets; i > 0; --i ) { bitp = &edge->destination.u.blk->dataflow->in; if( _GBitOverlap( *bitp, Id ) ) { SafeRecurseCG( (func_sr)MarkInstance, edge->destination.u.blk ); } ++edge; } } return( NULL ); }
static void *doFloodBackward( flood_parms *fp ) { block *next; block_edge *edge; flood_parms new_parms; new_parms = *fp; for( edge = fp->blk->input_edges; edge != NULL; edge = edge->next_source ) { next = edge->source; if( _Visited( next ) ) continue; if( fp->func( next, fp->parm ) == false ) break; _MarkVisited( next ); new_parms.blk = next; SafeRecurseCG( (func_sr)doFloodBackward, &new_parms ); } return NULL; }
static void *doFloodForward( flood_parms *fp ) { block *next; block_num i; block_num n; flood_parms new_parms; new_parms = *fp; n = fp->blk->targets; for( i = 0; i < n; i++ ) { next = fp->blk->edge[ i ].destination.u.blk; if( _Visited( next ) ) continue; if( fp->func( next, fp->parm ) == false ) break; _MarkVisited( next ); new_parms.blk = next; SafeRecurseCG( (func_sr)doFloodForward, &new_parms ); } return NULL; }