|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object soot.shimple.internal.ShimpleBodyBuilder
public class ShimpleBodyBuilder
This class does the real high-level work. It takes a Jimple body or Jimple/Shimple hybrid body and produces pure Shimple.
The work is done in two main steps:
This class can also translate out of Shimple by producing an equivalent Jimple body with all Phi nodes removed.
Note that this is an internal class, understanding it should not be necessary from a user point-of-view and relying on it directly is not recommended.
ShimpleBody
,
Efficiently
Computing Static Single Assignment Form and the Control Dependence
GraphField Summary | |
---|---|
protected int[] |
assignmentCounters
|
protected ShimpleBody |
body
|
protected BlockGraph |
cfg
|
protected DominatorTree |
dt
|
protected Stack[] |
namingStacks
|
protected Map<String,Local> |
newLocals
Maps new name Strings to Locals. |
protected Map<Local,Local> |
newLocalsToOldLocal
Maps renamed Locals to original Locals. |
protected List<Local> |
origLocals
A fixed list of all original Locals. |
PhiNodeManager |
phi
|
PiNodeManager |
pi
|
protected ShimpleFactory |
sf
|
Constructor Summary | |
---|---|
ShimpleBodyBuilder(ShimpleBody body)
Transforms the provided body to pure SSA form. |
Method Summary | |
---|---|
void |
eliminatePhiNodes()
Remove Phi nodes from current body, high probablity this destroys SSA form. |
void |
eliminatePiNodes()
|
protected Local |
fetchNewLocal(Local local,
Integer subscript)
Clever convenience function to fetch or create new Local's given a Local and the desired subscript. |
protected int |
indexOfLocal(Value local)
Convenient function that maps new Locals to the originating Local, and finds the appropriate array index into the naming structures. |
String |
makeUniqueLocalName(String dupName,
Set<String> localNames)
Given a set of Strings, return a new name for dupName that is not currently in the set. |
void |
makeUniqueLocalNames()
Make sure the locals in the given body all have unique String names. |
void |
postElimOpt()
|
void |
preElimOpt()
|
void |
renameLocals()
Variable Renaming Algorithm from Cytron et al 91, P26-8, implemented in various bits and pieces by the next functions. |
void |
renameLocalsSearch(Block block)
Driven by renameLocals(). |
void |
transform()
|
void |
update()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected ShimpleBody body
protected ShimpleFactory sf
protected DominatorTree dt
protected BlockGraph cfg
protected List<Local> origLocals
public PhiNodeManager phi
public PiNodeManager pi
protected Map<String,Local> newLocals
protected Map<Local,Local> newLocalsToOldLocal
protected int[] assignmentCounters
protected Stack[] namingStacks
Constructor Detail |
---|
public ShimpleBodyBuilder(ShimpleBody body)
Method Detail |
---|
public void update()
public void transform()
public void preElimOpt()
public void postElimOpt()
public void eliminatePhiNodes()
Dead code elimination + register aggregation are performed as recommended by Cytron. The Aggregator looks like it could use some improvements.
ShimpleOptions
public void eliminatePiNodes()
public void renameLocals()
public void renameLocalsSearch(Block block)
protected Local fetchNewLocal(Local local, Integer subscript)
protected int indexOfLocal(Value local)
public void makeUniqueLocalNames()
public String makeUniqueLocalName(String dupName, Set<String> localNames)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |