Package EDU.purdue.cs.bloat.ssa
Class SSAConstructionInfo
- java.lang.Object
-
- EDU.purdue.cs.bloat.ssa.SSAConstructionInfo
-
public class SSAConstructionInfo extends java.lang.ObjectSSAConstructionInfo 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
-
-
Constructor Summary
Constructors Constructor Description SSAConstructionInfo(FlowGraph cfg, VarExpr expr)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCatchPhi(Block block)Inserts a PhiCatchStmt (whose target is the variable represented by this SSAConstructionInfo) into a given Block.voidaddDefBlock(Block block)Makes note of a Block in which the variable is defined by a PhiStmt.voidaddPhi(Block block)Adds a PhiJoinStmt for the variable represented by this SSAConstructionInfo to a given Block.voidaddReal(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.voidaddRetPhis(Subroutine sub)Adds a PhiReturnStmt to all of the Blocks that are executed upon returning from a given Subroutine.java.util.CollectiondefBlocks()Returns the Blocks containing a definition of the variable represented by this SSAConstruction info.PhiStmtphiAtBlock(Block block)Returns the phi statement for the variable represented by this SSAConstructionInfo at a given block in the CFG.VarExprprototype()Returns the program variable associated with this SSAConstructionInfo.java.util.Collectionreals()Returns all of the real occurrences of this variable.java.util.CollectionrealsAtBlock(Block block)Returns all of the real occurrences of this variable in a given block.voidremovePhiAtBlock(Block block)Removes the phi statement for this variable at a given block.
-
-
-
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.
-
-