Class Liveness


  • public class Liveness
    extends java.lang.Object
    Liveness represents the interference graph of the local variables contained in a control flow graph. When the liveness of two variables overlap each other, the two variables are said to interfere with each other. The interference graph represents this relationship between variables. There is an (un-directed) edge between variables a and b in the interference graph if variable a interferes with variable b.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static boolean AFTER  
      static boolean BEFORE  
      static boolean DEBUG  
      static boolean UNIQUE  
    • Constructor Summary

      Constructors 
      Constructor Description
      Liveness​(FlowGraph cfg)
      Constructor.
    • Constructor Detail

      • Liveness

        public Liveness​(FlowGraph cfg)
        Constructor.
        Parameters:
        cfg - Control flow graph on which to perform liveness analysis.
    • Method Detail

      • removeVar

        public void removeVar​(LocalExpr expr)
        Removes a local expression from the interference graph.
      • liveAtUse

        public boolean liveAtUse​(VarExpr isLive,
                                 VarExpr at,
                                 boolean after)
        Should not be called.
      • liveAtStartOfBlock

        public boolean liveAtStartOfBlock​(VarExpr isLive,
                                          Block block)
        Should not be called.
      • liveAtEndOfBlock

        public boolean liveAtEndOfBlock​(VarExpr isLive,
                                        Block block)
        Should not be called.
      • defs

        public java.util.Collection defs()
        Returns the LocalExprs (variables) that occur in the CFG. They correspond to nodes in the interference graph.
      • intersections

        public java.util.Iterator intersections​(VarExpr a)
        Returns an Iterator of LocalExprs that interfere with a given VarExpr.
      • liveRangesIntersect

        public boolean liveRangesIntersect​(VarExpr a,
                                           VarExpr b)
        Determines whether or not two variables interfere with one another.