com.ibm.wala.ssa
Class DefUse

java.lang.Object
  extended by com.ibm.wala.ssa.DefUse

public class DefUse
extends java.lang.Object

An object which represent Def-Use information for an SSA IR


Constructor Summary
DefUse(IR ir)
          keep this package private: all calls should be through SSACache
 
Method Summary
 SSAInstruction getDef(int v)
           
 IR getIR()
          Return the actual, honest-to-goodness IR object used to compute the DefUse information.
 int getNumberOfUses(int v)
           
 java.util.Iterator<SSAInstruction> getUses(int v)
          Return all uses of the variable with the given value number
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefUse

public DefUse(IR ir)
keep this package private: all calls should be through SSACache

Parameters:
ir - an IR in SSA form.
Throws:
java.lang.IllegalArgumentException - if ir is null
Method Detail

getDef

public SSAInstruction getDef(int v)
Returns:
the Instruction that defines the variable with value number v.

getUses

public java.util.Iterator<SSAInstruction> getUses(int v)
Return all uses of the variable with the given value number

Parameters:
v - value number

getNumberOfUses

public int getNumberOfUses(int v)
Parameters:
v - a value number
Returns:
the number of uses of the variable with the given value number

getIR

public IR getIR()
Return the actual, honest-to-goodness IR object used to compute the DefUse information. By doing this, you ensure that for any SSAInstruction returned by getUses() or getDefs(), the instruction actually == (equals()) an SSAInstruction in the IR. This is pretty horrible. TODO: Should think about redesigning instruction identity to avoid this.