Class SSAConstructionInfo

java.lang.Object
EDU.purdue.cs.bloat.ssa.SSAConstructionInfo

public class SSAConstructionInfo extends 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:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Inserts a PhiCatchStmt (whose target is the variable represented by this SSAConstructionInfo) into a given Block.
    void
    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
    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
    Adds a PhiReturnStmt to all of the Blocks that are executed upon returning from a given Subroutine.
    Returns the Blocks containing a definition of the variable represented by this SSAConstruction info.
    Returns the phi statement for the variable represented by this SSAConstructionInfo at a given block in the CFG.
    Returns the program variable associated with this SSAConstructionInfo.
    Returns all of the real occurrences of this variable.
    Returns all of the real occurrences of this variable in a given block.
    void
    Removes the phi statement for this variable at a given block.

    Methods inherited from class Object

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

    • 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 Details

    • 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:
    • 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:
    • reals

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

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

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