next up previous contents
Next: BusyVariables: MUST dataflow analysis Up: CoSy-fSDL-mode examples Previous: CoSy-fSDL-mode examples

Live Variables: MAY dataflow analysis

It is also possible to specify MAY data flow analysis. For that we need a bipartite graph functor (e.g. in CoSy-fSDL BIPUNI). It serves to represent the information which variables live at which basic block, here at which entry and exit of which block (LIVEIN, LIVEOUT). We also need the information per each basic block, which local variables have been used in a basic block (USED).

  
EARS LiveVariables()
{
   RANGE b <= LIVEOUT; 
   RULES

   LIVEOUT(b,o) :- BlockGraph.succ(b,b1), LIVEIN(b1,o);
   LIVEIN(b,o)  :- USED(b,o); 
   LIVEIN(b,o)  :- LIVEOUT(b,o); 
}

A variable is live at the entry of a block, if it is used in the block, or if it is live at the exit of the block. A variable is live a the exit of the block, if it lives at the entry of a successor block.



Uwe Assmann
1998-12-22