Class SSAConstructionInfo


  • public class SSAConstructionInfo
    extends java.lang.Object
    SSAConstructionInfo contains information needed to convert a CFG into SSA form. Each variable (VarExpr) has an SSAConstructionInfo associated with it. Each SSAConstructionInfo keeps track of information such as the PhiStmts that define copies of the variable, the Blocks in which the variable is defined, and the occurrences (uses) of the variable in both phi and non-phi statements. Note that no PhiStmt is really inserted into a basic block. We just keep track of the mapping. It should also be noted that once a phi statement for a given variable is "inserted" into a block, no other phi statement for that variable is inserted. Thus, the order of insertion determines the precedence of the phi statements: PhiReturnStmt > PhiCatchStmt > PhiJoinStmt.

    Additionally, SSAConstruction has methods to insert various flavors of PhiStmts whose targets are the variable associated with the SSAConstruction into Blocks.

    See Also:
    SSA, PhiStmt, PhiCatchStmt, PhiJoinStmt, PhiReturnStmt
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addCatchPhi​(Block block)
      Inserts a PhiCatchStmt (whose target is the variable represented by this SSAConstructionInfo) into a given Block.
      void addDefBlock​(Block block)
      Makes note of a Block in which the variable is defined by a PhiStmt.
      void addPhi​(Block block)
      Adds a PhiJoinStmt for the variable represented by this SSAConstructionInfo to a given Block.
      void addReal​(VarExpr real)
      Notes a real occurrence (that is, a use that is not an operand to a phi statement) of the variable represented by this SSAConstructionInfo.
      void addRetPhis​(Subroutine sub)
      Adds a PhiReturnStmt to all of the Blocks that are executed upon returning from a given Subroutine.
      java.util.Collection defBlocks()
      Returns the Blocks containing a definition of the variable represented by this SSAConstruction info.
      PhiStmt phiAtBlock​(Block block)
      Returns the phi statement for the variable represented by this SSAConstructionInfo at a given block in the CFG.
      VarExpr prototype()
      Returns the program variable associated with this SSAConstructionInfo.
      java.util.Collection reals()
      Returns all of the real occurrences of this variable.
      java.util.Collection realsAtBlock​(Block block)
      Returns all of the real occurrences of this variable in a given block.
      void removePhiAtBlock​(Block block)
      Removes the phi statement for this variable at a given block.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SSAConstructionInfo

        public SSAConstructionInfo​(FlowGraph cfg,
                                   VarExpr expr)
        Constructor.
        Parameters:
        cfg - The control flow graph that is being converted to SSA form.
        expr - A variable in the CFG on which SSA analysis is being done.
    • Method Detail

      • prototype

        public VarExpr prototype()
        Returns the program variable associated with this SSAConstructionInfo.
      • addDefBlock

        public void addDefBlock​(Block block)
        Makes note of a Block in which the variable is defined by a PhiStmt.
      • phiAtBlock

        public PhiStmt phiAtBlock​(Block block)
        Returns the phi statement for the variable represented by this SSAConstructionInfo at a given block in the CFG.
      • removePhiAtBlock

        public void removePhiAtBlock​(Block block)
        Removes the phi statement for this variable at a given block.
      • addPhi

        public void addPhi​(Block block)
        Adds a PhiJoinStmt for the variable represented by this SSAConstructionInfo to a given Block.
      • addRetPhis

        public void addRetPhis​(Subroutine sub)
        Adds a PhiReturnStmt to all of the Blocks that are executed upon returning from a given Subroutine.
        See Also:
        PhiReturnStmt, Subroutine.paths
      • addCatchPhi

        public void addCatchPhi​(Block block)
        Inserts a PhiCatchStmt (whose target is the variable represented by this SSAConstructionInfo) into a given Block.
        See Also:
        PhiCatchStmt
      • addReal

        public void addReal​(VarExpr real)
        Notes a real occurrence (that is, a use that is not an operand to a phi statement) of the variable represented by this SSAConstructionInfo.
        See Also:
        PhiStmt
      • reals

        public java.util.Collection reals()
        Returns all of the real occurrences of this variable.
      • realsAtBlock

        public java.util.Collection realsAtBlock​(Block block)
        Returns all of the real occurrences of this variable in a given block.
      • defBlocks

        public java.util.Collection defBlocks()
        Returns the Blocks containing a definition of the variable represented by this SSAConstruction info.