public class ShimpleBodyBuilder
extends java.lang.Object
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.
Modifier and Type | Field and Description |
---|---|
protected int[] |
assignmentCounters |
protected ShimpleBody |
body |
protected BlockGraph |
cfg |
protected DominatorTree<Block> |
dt |
protected java.util.Stack<java.lang.Integer>[] |
namingStacks |
protected java.util.Map<java.lang.String,Local> |
newLocals
Maps new name Strings to Locals.
|
protected java.util.Map<Local,Local> |
newLocalsToOldLocal
Maps renamed Locals to original Locals.
|
protected java.util.List<Local> |
origLocals
A fixed list of all original Locals.
|
PhiNodeManager |
phi |
PiNodeManager |
pi |
protected ShimpleFactory |
sf |
Constructor and Description |
---|
ShimpleBodyBuilder(ShimpleBody body)
Transforms the provided body to pure SSA form.
|
Modifier and Type | Method and Description |
---|---|
void |
eliminatePhiNodes()
Remove Phi nodes from current body, high probablity this
destroys SSA form.
|
void |
eliminatePiNodes() |
protected Local |
fetchNewLocal(Local local,
java.lang.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.
|
java.lang.String |
makeUniqueLocalName(java.lang.String dupName,
java.util.Set<java.lang.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() |
protected ShimpleBody body
protected ShimpleFactory sf
protected DominatorTree<Block> dt
protected BlockGraph cfg
protected java.util.List<Local> origLocals
public PhiNodeManager phi
public PiNodeManager pi
protected java.util.Map<java.lang.String,Local> newLocals
protected java.util.Map<Local,Local> newLocalsToOldLocal
protected int[] assignmentCounters
protected java.util.Stack<java.lang.Integer>[] namingStacks
public ShimpleBodyBuilder(ShimpleBody body)
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.
soot.options.ShimpleOptions
public void eliminatePiNodes()
public void renameLocals()
public void renameLocalsSearch(Block block)
protected Local fetchNewLocal(Local local, java.lang.Integer subscript)
protected int indexOfLocal(Value local)
public void makeUniqueLocalNames()
public java.lang.String makeUniqueLocalName(java.lang.String dupName, java.util.Set<java.lang.String> localNames)