soot.shimple
Class Shimple

java.lang.Object
  extended by soot.shimple.Shimple

public class Shimple
extends Object

Contains the constructors for the components of the SSA Shimple grammar. Methods are available to construct Shimple from Jimple/Shimple, create Phi nodes, and converting back from Shimple to Jimple.

This should normally be used in conjunction with the constructor methods from soot.jimple.Jimple.

Miscellaneous utility functions are also available in this class.

Author:
Navindra Umanee
See Also:
Jimple, Efficiently Computing Static Single Assignment Form and the Control Dependence Graph

Field Summary
static String IFALIAS
           
static String MAYMODIFY
           
static String PHASE
           
static String PHI
           
static String PI
           
 
Constructor Summary
Shimple(Singletons.Global g)
           
 
Method Summary
static Local getLhsLocal(Unit unit)
          Returns the corresponding left Local if the unit is a Shimple node, null otherwise.
static PhiExpr getPhiExpr(Unit unit)
          Returns the corresponding PhiExpr if the unit is a Phi node, null otherwise.
static PiExpr getPiExpr(Unit unit)
           
static boolean isPhiExpr(Value value)
          Returns true if the value is a Phi expression, false otherwise.
static boolean isPhiNode(Unit unit)
          Returns true if the unit is a Phi node, false otherwise.
static boolean isPiExpr(Value value)
           
static boolean isPiNode(Unit unit)
           
 ShimpleBody newBody(Body b)
          Returns a ShimpleBody constructed from b, using default phase options.
 ShimpleBody newBody(Body b, Map options)
          Returns a ShimpleBody constructed from b, using provided option Map.
 ShimpleBody newBody(SootMethod m)
          Returns an empty ShimpleBody associated with method m, using default phase options.
 ShimpleBody newBody(SootMethod m, Map options)
          Returns an empty ShimpleBody associated with method m, using provided option map.
 JimpleBody newJimpleBody(ShimpleBody body)
          Constructs a JimpleBody from a ShimpleBody.
 PhiExpr newPhiExpr(List<Value> args, List<Unit> preds)
          Create a PhiExpr with the provided list of Values (Locals or Constants) and the corresponding control flow predecessor Blocks.
 PhiExpr newPhiExpr(Local leftLocal, List preds)
          Create a trivial PhiExpr, where preds are an ordered list of the control predecessor Blocks of the Phi expression.
 PiExpr newPiExpr(Local local, Unit predicate, Object targetKey)
           
static void redirectPointers(Unit oldLocation, Unit newLocation)
          Redirects PhiExpr pointers to the given Unit to the new Unit.
static void redirectToPreds(Body body, Unit remove)
          If you are removing a Unit from a Unit chain which contains PhiExpr's, you might want to call this utility function in order to update any PhiExpr pointers to the Unit to point to the Unit's predecessor(s).
static Shimple v()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IFALIAS

public static final String IFALIAS
See Also:
Constant Field Values

MAYMODIFY

public static final String MAYMODIFY
See Also:
Constant Field Values

PHI

public static final String PHI
See Also:
Constant Field Values

PI

public static final String PI
See Also:
Constant Field Values

PHASE

public static final String PHASE
See Also:
Constant Field Values
Constructor Detail

Shimple

public Shimple(Singletons.Global g)
Method Detail

v

public static Shimple v()

newBody

public ShimpleBody newBody(SootMethod m)
Returns an empty ShimpleBody associated with method m, using default phase options.


newBody

public ShimpleBody newBody(SootMethod m,
                           Map options)
Returns an empty ShimpleBody associated with method m, using provided option map.


newBody

public ShimpleBody newBody(Body b)
Returns a ShimpleBody constructed from b, using default phase options.


newBody

public ShimpleBody newBody(Body b,
                           Map options)
Returns a ShimpleBody constructed from b, using provided option Map.


newPhiExpr

public PhiExpr newPhiExpr(Local leftLocal,
                          List preds)
Create a trivial PhiExpr, where preds are an ordered list of the control predecessor Blocks of the Phi expression. Instead of a list of blocks, you may provide a list of the tail Units from the corresponding blocks.


newPiExpr

public PiExpr newPiExpr(Local local,
                        Unit predicate,
                        Object targetKey)

newPhiExpr

public PhiExpr newPhiExpr(List<Value> args,
                          List<Unit> preds)
Create a PhiExpr with the provided list of Values (Locals or Constants) and the corresponding control flow predecessor Blocks. Instead of a list of predecessor blocks, you may provide a list of the tail Units from the corresponding blocks.


newJimpleBody

public JimpleBody newJimpleBody(ShimpleBody body)
Constructs a JimpleBody from a ShimpleBody.

See Also:
ShimpleOptions

isPhiExpr

public static boolean isPhiExpr(Value value)
Returns true if the value is a Phi expression, false otherwise.


isPhiNode

public static boolean isPhiNode(Unit unit)
Returns true if the unit is a Phi node, false otherwise.


getPhiExpr

public static PhiExpr getPhiExpr(Unit unit)
Returns the corresponding PhiExpr if the unit is a Phi node, null otherwise.


isPiExpr

public static boolean isPiExpr(Value value)

isPiNode

public static boolean isPiNode(Unit unit)

getPiExpr

public static PiExpr getPiExpr(Unit unit)

getLhsLocal

public static Local getLhsLocal(Unit unit)
Returns the corresponding left Local if the unit is a Shimple node, null otherwise.


redirectToPreds

public static void redirectToPreds(Body body,
                                   Unit remove)
If you are removing a Unit from a Unit chain which contains PhiExpr's, you might want to call this utility function in order to update any PhiExpr pointers to the Unit to point to the Unit's predecessor(s). This function will not modify "branch target" UnitBoxes.

Normally you should not have to call this function directly, since patching is taken care of Shimple's internal implementation of PatchingChain.


redirectPointers

public static void redirectPointers(Unit oldLocation,
                                    Unit newLocation)
Redirects PhiExpr pointers to the given Unit to the new Unit.

Normally you should not have to call this function directly, since patching is taken care of Shimple's internal implementation of PatchingChain.