soot.jimple.toolkits.scalar.pre
Class SootFilter

java.lang.Object
  extended by soot.jimple.toolkits.scalar.pre.SootFilter

public class SootFilter
extends Object

Allows easy filtering/wrapping of Soot objects. Operations that are done very often are grouped here.


Constructor Summary
SootFilter()
           
 
Method Summary
static Value binop(Value val)
          only lets binary expression through.
static Value binopRhs(Unit unit)
          only lets binary RHS through.
static Value concreteRef(Value val)
          only lets concrete references through.
static EquivalentValue equiVal(Value val)
          wraps a value into a EquivalentValue.
static Value getEquivalentValueRoot(Value val)
          returns the Value of an EquivalentValue.
static boolean isInvoke(Value val)
          returns true, if val is an invoke.
static boolean isLocal(Value val)
          returns true, if val is a Local.
static Value local(Value val)
          filters out Locals.
returns null if val is null.
static Value noExceptionThrowing(Value val)
          filters out Exception-throwing Values.
static Value noExceptionThrowingRhs(Unit unit)
          filters out RHS that don't throw any exception.
static Value noInvoke(Value val)
          filters out Invokes.
returns null if val is null.
static Value noInvokeRhs(Unit unit)
          filters out RHS that aren't invokes.
static Value noLocal(Value val)
          only lets non-Locals through.
returns null if val is null.
static Value rhs(Unit unit)
          filters out the RHS of an assignmentStmt.
static boolean throwsException(Value val)
          a (probably) conservative way of telling, if a Value throws an exception or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SootFilter

public SootFilter()
Method Detail

equiVal

public static EquivalentValue equiVal(Value val)
wraps a value into a EquivalentValue. returns null if val is null.

Parameters:
val - the Value to wrap.
Returns:
the EquivalentValue containing val.

rhs

public static Value rhs(Unit unit)
filters out the RHS of an assignmentStmt.

Parameters:
unit - a Unit from which to extract the RHS.
Returns:
the RHS-Value of unit or null if unit wasn't an assignment-stmt.

binop

public static Value binop(Value val)
only lets binary expression through.

Parameters:
val - the Value to test for.
Returns:
val if it is a binary expression. otherwise null.

binopRhs

public static Value binopRhs(Unit unit)
only lets binary RHS through.

Parameters:
unit - the Unit to test for.
Returns:
the rhs of the current unit, if unit is an AssigStmt and its RHS is a binary expression. otherwise null.

concreteRef

public static Value concreteRef(Value val)
only lets concrete references through. A concrete reference is either an array-ref or a field-ref.
returns null if val already was null.

Parameters:
val - the Value to test for.
Returns:
the val if it was a concrete reference. otherwise null.

noExceptionThrowing

public static Value noExceptionThrowing(Value val)
filters out Exception-throwing Values. This method is perhaps conservative.
returns null if val is null.

Parameters:
val - the Value to test for.
Returns:
val if val doesn't throw any exception, or null otherwise.

noExceptionThrowingRhs

public static Value noExceptionThrowingRhs(Unit unit)
filters out RHS that don't throw any exception.

Parameters:
unit - the Unit to test.
Returns:
the rhs, if unit is an assignment-stmt and can't throw any exception.

noInvokeRhs

public static Value noInvokeRhs(Unit unit)
filters out RHS that aren't invokes.

Parameters:
unit - the Unit to look at.
Returns:
the RHS of unit if it is an assignment-stmt, and its RHS is not an invoke.

noInvoke

public static Value noInvoke(Value val)
filters out Invokes.
returns null if val is null.

Parameters:
val - the Value to inspect
Returns:
val, if val is not an invoke, null otherwise.

isInvoke

public static boolean isInvoke(Value val)
returns true, if val is an invoke.

Parameters:
val - the Value to inspect.
Returns:
true if val is an invoke.

local

public static Value local(Value val)
filters out Locals.
returns null if val is null.

Parameters:
val - the Value to look at.
Returns:
val, if it is a Local, null otherwise.

noLocal

public static Value noLocal(Value val)
only lets non-Locals through.
returns null if val is null.

Parameters:
val - the Value to look at.
Returns:
val, if it is not a Local, null otherwise.

isLocal

public static boolean isLocal(Value val)
returns true, if val is a Local.


getEquivalentValueRoot

public static Value getEquivalentValueRoot(Value val)
returns the Value of an EquivalentValue. If there are several EquivalentValues stacked one into another, gets the deepest Value.
returns null if val is null.

Parameters:
val - the Value to inspect.
Returns:
val, if val is not an EquivalentValue, or the deepest Value otherwise.

throwsException

public static boolean throwsException(Value val)
a (probably) conservative way of telling, if a Value throws an exception or not.