public class PhiNodeManager
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected ShimpleBody |
body |
protected BlockGraph |
cfg |
protected DominanceFrontier<Block> |
df |
protected DominatorTree<Block> |
dt |
protected GuaranteedDefs |
gd |
protected ShimpleFactory |
sf |
protected java.util.Map<Unit,Block> |
unitToBlock |
protected MultiMap<Local,Block> |
varToBlocks |
Constructor and Description |
---|
PhiNodeManager(ShimpleBody body,
ShimpleFactory sf) |
Modifier and Type | Method and Description |
---|---|
boolean |
doEliminatePhiNodes()
Eliminate Phi nodes in block by naively replacing them with
shimple assignment statements in the control flow predecessors.
|
boolean |
dominates(Unit champ,
Unit challenger)
Returns true if champ dominates challenger.
|
java.util.Map<Unit,Block> |
getUnitToBlockMap(BlockGraph blocks)
Convenience function that maps units to blocks.
|
boolean |
insertTrivialPhiNodes()
Phi node Insertion Algorithm from Cytron et al 91, P24-5,
|
void |
prependTrivialPhiNode(Local local,
Block frontierBlock)
Inserts a trivial Phi node with the appropriate number of
arguments.
|
void |
trimExceptionalPhiNodes()
Exceptional Phi nodes have a huge number of arguments and control
flow predecessors by default.
|
void |
trimPhiNode(PhiExpr phiExpr) |
void |
update() |
protected ShimpleBody body
protected ShimpleFactory sf
protected DominatorTree<Block> dt
protected DominanceFrontier<Block> df
protected BlockGraph cfg
protected GuaranteedDefs gd
public PhiNodeManager(ShimpleBody body, ShimpleFactory sf)
public void update()
public boolean insertTrivialPhiNodes()
Special Java case: If a variable is not defined along all paths of entry to a node, a Phi node is not needed.
public void prependTrivialPhiNode(Local local, Block frontierBlock)
public void trimExceptionalPhiNodes()
public void trimPhiNode(PhiExpr phiExpr)
trimExceptionalPhiNodes()
public boolean dominates(Unit champ, Unit challenger)
public boolean doEliminatePhiNodes()
public java.util.Map<Unit,Block> getUnitToBlockMap(BlockGraph blocks)