com.ibm.wala.ssa
Class SSAInstruction

java.lang.Object
  extended by com.ibm.wala.ssa.SSAInstruction
All Implemented Interfaces:
IInstruction
Direct Known Subclasses:
AstAssertInstruction, AstIsDefinedInstruction, AstLexicalAccess, EnclosingObjectReference, ReflectiveMemberAccess, SSAAbstractInvokeInstruction, SSAAbstractThrowInstruction, SSAAbstractUnaryInstruction, SSAArrayLengthInstruction, SSAArrayReferenceInstruction, SSABinaryOpInstruction, SSACheckCastInstruction, SSAComparisonInstruction, SSAConditionalBranchInstruction, SSAConversionInstruction, SSAFieldAccessInstruction, SSAGetCaughtExceptionInstruction, SSAGotoInstruction, SSAInstanceofInstruction, SSALoadClassInstruction, SSAMonitorInstruction, SSANewInstruction, SSAPhiInstruction, SSAReturnInstruction, SSASwitchInstruction

public abstract class SSAInstruction
extends java.lang.Object
implements IInstruction

An instruction in SSA form.


Nested Class Summary
static interface SSAInstruction.IVisitor
          This interface is used by Instruction.visit to dispatch based on the instruction type.
static class SSAInstruction.Visitor
          A base visitor implementation that does nothing.
 
Constructor Summary
protected SSAInstruction()
          prevent instantiation by the outside
 
Method Summary
abstract  SSAInstruction copyForSSA(int[] defs, int[] uses)
          This method is meant to be used during SSA conversion for an IR that is not in SSA form.
 boolean equals(java.lang.Object obj)
          We assume these instructions are canonical and managed by a governing IR object.
 int getDef()
           
 int getDef(int i)
           
abstract  java.util.Collection<TypeReference> getExceptionTypes()
           
 int getNumberOfDefs()
           
 int getNumberOfUses()
          Method getNumberOfUses.
 int getUse(int j)
          Method getUse.
protected  java.lang.String getValueString(SymbolTable symbolTable, ValueDecorator d, int valueNumber)
           
 boolean hasDef()
          Does this instruction define a normal value, as distinct from a set of exceptions possibly thrown by it (e.g.
abstract  int hashCode()
           
abstract  boolean isFallThrough()
           
 boolean isPEI()
          PEI == "Potentially excepting instruction"
 java.lang.String toString()
           
abstract  java.lang.String toString(SymbolTable symbolTable, ValueDecorator d)
          Method toString.
abstract  void visit(SSAInstruction.IVisitor v)
          Apply an IVisitor to this instruction.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SSAInstruction

protected SSAInstruction()
prevent instantiation by the outside

Method Detail

copyForSSA

public abstract SSAInstruction copyForSSA(int[] defs,
                                          int[] uses)
This method is meant to be used during SSA conversion for an IR that is not in SSA form. It creates a new SSAInstruction of the same type as the receiver, with a combination of the receiver's uses and defs and those from the method parameters. In particular, if the 'defs' parameter is null, then the new instruction has the same defs as the receiver. If 'defs' is not null, it must be an array with a size equal to the number of defs that the receiver instruction has. In this case, the new instruction has defs taken from the array. The uses of the new instruction work in the same way with the 'uses' parameter. Note that this only applies to CAst-based IR translation, since Java bytecode-based IR generation uses a different SSA construction mechanism.


toString

public abstract java.lang.String toString(SymbolTable symbolTable,
                                          ValueDecorator d)
Method toString.

Parameters:
symbolTable -
Returns:
Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getValueString

protected java.lang.String getValueString(SymbolTable symbolTable,
                                          ValueDecorator d,
                                          int valueNumber)

visit

public abstract void visit(SSAInstruction.IVisitor v)
Apply an IVisitor to this instruction. We invoke the appropriate IVisitor method according to the type of this instruction.


hasDef

public boolean hasDef()
Does this instruction define a normal value, as distinct from a set of exceptions possibly thrown by it (e.g. for invoke instructions).

Returns:
true if the instruction does define a proper value.

getDef

public int getDef()

getDef

public int getDef(int i)

getNumberOfDefs

public int getNumberOfDefs()

getNumberOfUses

public int getNumberOfUses()
Method getNumberOfUses.

Returns:
int

getUse

public int getUse(int j)
           throws java.lang.UnsupportedOperationException
Method getUse.

Parameters:
j -
Returns:
value number representing the jth use in this instruction. -1 means TOP (i.e., the value doesn't matter)
Throws:
java.lang.UnsupportedOperationException

hashCode

public abstract int hashCode()
Overrides:
hashCode in class java.lang.Object

isPEI

public boolean isPEI()
Description copied from interface: IInstruction
PEI == "Potentially excepting instruction"

Specified by:
isPEI in interface IInstruction
Returns:
true iff this instruction may throw an exception.

getExceptionTypes

public abstract java.util.Collection<TypeReference> getExceptionTypes()
Returns:
Colection the set of exception types that an instruction might throw ... disregarding athrows and invokes.

isFallThrough

public abstract boolean isFallThrough()
Returns:
true iff this instruction may fall through to the next

equals

public final boolean equals(java.lang.Object obj)
We assume these instructions are canonical and managed by a governing IR object. Be careful.

Overrides:
equals in class java.lang.Object
See Also:
Object.equals(java.lang.Object)