soot.shimple.toolkits.scalar
Class ShimpleLocalDefs

java.lang.Object
  |
  +--soot.shimple.toolkits.scalar.ShimpleLocalDefs

public class ShimpleLocalDefs
extends java.lang.Object
implements LocalDefs

This class implements the LocalDefs interface for Shimple. ShimpleLocalDefs can be used in conjunction with SimpleLocalUses to provide Definition/Use and Use/Definition chains in SSA.

This implementation can be considered a small demo for how SSA can be put to good use since it is much simpler than soot.toolkits.scalar.SimpleLocalDefs. Shimple can often be treated as Jimple with the added benefits of SSA assumptions.

In addition to the interface required by LocalDefs, ShimpleLocalDefs also provides a method for obtaining the definition Unit given only the Local.

See Also:
SimpleLocalDefs, SimpleLocalUses

Field Summary
protected  java.util.Map localToDefs
           
 
Constructor Summary
ShimpleLocalDefs(ShimpleBody sb)
          Build a LocalDefs interface from a ShimpleBody.
 
Method Summary
 java.util.List getDefsOf(Local l)
          Unconditionally returns the definition site of a local.
 java.util.List getDefsOfAt(Local l, Unit s)
          Returns the definition sites for a Local at a certain point (Unit) in a method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

localToDefs

protected java.util.Map localToDefs
Constructor Detail

ShimpleLocalDefs

public ShimpleLocalDefs(ShimpleBody sb)
Build a LocalDefs interface from a ShimpleBody. Proper SSA form is required, otherwise correct behaviour is not guaranteed.
Method Detail

getDefsOf

public java.util.List getDefsOf(Local l)
Unconditionally returns the definition site of a local.

This method is currently not required by the LocalDefs interface, but we will return a singleton List instead of a Unit in case LocalDefs requires such a method in the future.


getDefsOfAt

public java.util.List getDefsOfAt(Local l,
                                  Unit s)
Description copied from interface: LocalDefs
Returns the definition sites for a Local at a certain point (Unit) in a method.
Specified by:
getDefsOfAt in interface LocalDefs
Tags copied from interface: LocalDefs
Parameters:
l - the Local in question.
s - a unit that specifies the method context (location) to query for the definitions of the Local.
Returns:
a list of Units where the local is defined in the current method context.