com.ibm.wala.ipa.callgraph.propagation
Class SSAPropagationCallGraphBuilder.ConstraintVisitor

java.lang.Object
  extended by com.ibm.wala.ssa.SSAInstruction.Visitor
      extended by com.ibm.wala.ipa.callgraph.propagation.SSAPropagationCallGraphBuilder.ConstraintVisitor
All Implemented Interfaces:
SSAInstruction.IVisitor
Direct Known Subclasses:
AstSSAPropagationCallGraphBuilder.AstConstraintVisitor
Enclosing class:
SSAPropagationCallGraphBuilder

protected static class SSAPropagationCallGraphBuilder.ConstraintVisitor
extends SSAInstruction.Visitor

A visitor that generates constraints based on statements in SSA form.


Field Summary
protected  SSAPropagationCallGraphBuilder builder
          The governing call graph builder.
protected  DefUse du
          Def-use information
protected  IR ir
          The governing IR
protected  ExplicitCallGraph.ExplicitNode node
          The node whose statements we are currently traversing
protected  SymbolTable symbolTable
          Governing symbol table
protected  PropagationSystem system
          The governing propagation system, into which constraints are added
 
Constructor Summary
SSAPropagationCallGraphBuilder.ConstraintVisitor(SSAPropagationCallGraphBuilder builder, ExplicitCallGraph.ExplicitNode node)
           
 
Method Summary
protected  InstanceKey[][] computeInvariantParameters(SSAAbstractInvokeInstruction call)
          Side effect: records invariant parameters as implicit points-to-sets.
protected  boolean contentsAreInvariant(SymbolTable symbolTable, DefUse du, int valueNumber)
           
 IBasicBlock getBasicBlock()
           
protected  SSAPropagationCallGraphBuilder getBuilder()
           
protected  IClassHierarchy getClassHierarchy()
           
 FilteredPointerKey getFilteredPointerKeyForLocal(int valueNumber, FilteredPointerKey.TypeFilter filter)
           
 InstanceKey getInstanceKeyForAllocation(NewSiteReference allocation)
           
 InstanceKey getInstanceKeyForClassObject(TypeReference type)
           
 InstanceKey getInstanceKeyForConstant(java.lang.Object S)
           
 InstanceKey getInstanceKeyForMultiNewArray(NewSiteReference allocation, int dim)
           
 InstanceKey getInstanceKeyForPEI(ProgramCounter instr, TypeReference type)
           
protected  InstanceKey[] getInvariantContents(int valueNumber)
           
protected  InstanceKey[] getInvariantContents(SymbolTable symbolTable, DefUse du, CGNode node, int valueNumber)
           
protected  AnalysisOptions getOptions()
           
 PointerKey getPointerKeyForArrayContents(InstanceKey I)
           
 PointerKey getPointerKeyForExceptionalReturnValue()
           
 PointerKey getPointerKeyForInstanceField(InstanceKey I, IField f)
           
 PointerKey getPointerKeyForLocal(int valueNumber)
           
 PointerKey getPointerKeyForReturnValue()
           
 PointerKey getPointerKeyForStaticField(IField f)
           
 java.lang.String getStringConstantForInstanceKey(InstanceKey I)
           
 CGNode getTargetForCall(CGNode caller, CallSiteReference site, InstanceKey iKey)
           
protected  WarningSet getWarnings()
           
protected  boolean hasNoInterestingUses(int vn)
           
protected  boolean isRootType(IClass klass)
           
 void setBasicBlock(IBasicBlock block)
          The calling loop must call this in each iteration!
 void visitArrayLoad(SSAArrayLoadInstruction instruction)
           
 void visitArrayStore(SSAArrayStoreInstruction instruction)
           
 void visitCheckCast(SSACheckCastInstruction instruction)
           
 void visitGet(SSAGetInstruction instruction)
           
 void visitGetCaughtException(SSAGetCaughtExceptionInstruction instruction)
           
protected  void visitGetInternal(int lval, int ref, boolean isStatic, FieldReference field)
           
 void visitInvoke(SSAInvokeInstruction instruction)
           
protected  void visitInvokeInternal(SSAAbstractInvokeInstruction instruction)
           
 void visitLoadClass(SSALoadClassInstruction instruction)
           
 void visitNew(SSANewInstruction instruction)
           
 void visitPi(SSAPiInstruction instruction)
           
 void visitPut(SSAPutInstruction instruction)
           
 void visitPutInternal(int rval, int ref, boolean isStatic, FieldReference field)
           
 void visitReturn(SSAReturnInstruction instruction)
           
 void visitThrow(SSAThrowInstruction instruction)
           
 
Methods inherited from class com.ibm.wala.ssa.SSAInstruction.Visitor
visitArrayLength, visitBinaryOp, visitComparison, visitConditionalBranch, visitConversion, visitGoto, visitInstanceof, visitMonitor, visitPhi, visitSwitch, visitUnaryOp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

builder

protected final SSAPropagationCallGraphBuilder builder
The governing call graph builder. This field is used instead of an inner class in order to allow more flexible reuse of this visitor in subclasses


node

protected final ExplicitCallGraph.ExplicitNode node
The node whose statements we are currently traversing


ir

protected final IR ir
The governing IR


system

protected final PropagationSystem system
The governing propagation system, into which constraints are added


symbolTable

protected final SymbolTable symbolTable
Governing symbol table


du

protected final DefUse du
Def-use information

Constructor Detail

SSAPropagationCallGraphBuilder.ConstraintVisitor

public SSAPropagationCallGraphBuilder.ConstraintVisitor(SSAPropagationCallGraphBuilder builder,
                                                        ExplicitCallGraph.ExplicitNode node)
Method Detail

getBuilder

protected SSAPropagationCallGraphBuilder getBuilder()

getWarnings

protected WarningSet getWarnings()

getOptions

protected AnalysisOptions getOptions()

getPointerKeyForLocal

public PointerKey getPointerKeyForLocal(int valueNumber)

getFilteredPointerKeyForLocal

public FilteredPointerKey getFilteredPointerKeyForLocal(int valueNumber,
                                                        FilteredPointerKey.TypeFilter filter)

getPointerKeyForReturnValue

public PointerKey getPointerKeyForReturnValue()

getPointerKeyForExceptionalReturnValue

public PointerKey getPointerKeyForExceptionalReturnValue()

getPointerKeyForStaticField

public PointerKey getPointerKeyForStaticField(IField f)

getPointerKeyForInstanceField

public PointerKey getPointerKeyForInstanceField(InstanceKey I,
                                                IField f)

getPointerKeyForArrayContents

public PointerKey getPointerKeyForArrayContents(InstanceKey I)

getInstanceKeyForAllocation

public InstanceKey getInstanceKeyForAllocation(NewSiteReference allocation)

getInstanceKeyForMultiNewArray

public InstanceKey getInstanceKeyForMultiNewArray(NewSiteReference allocation,
                                                  int dim)

getInstanceKeyForConstant

public InstanceKey getInstanceKeyForConstant(java.lang.Object S)

getStringConstantForInstanceKey

public java.lang.String getStringConstantForInstanceKey(InstanceKey I)

getInstanceKeyForPEI

public InstanceKey getInstanceKeyForPEI(ProgramCounter instr,
                                        TypeReference type)

getInstanceKeyForClassObject

public InstanceKey getInstanceKeyForClassObject(TypeReference type)

getTargetForCall

public CGNode getTargetForCall(CGNode caller,
                               CallSiteReference site,
                               InstanceKey iKey)

contentsAreInvariant

protected boolean contentsAreInvariant(SymbolTable symbolTable,
                                       DefUse du,
                                       int valueNumber)

getInvariantContents

protected InstanceKey[] getInvariantContents(int valueNumber)

getInvariantContents

protected InstanceKey[] getInvariantContents(SymbolTable symbolTable,
                                             DefUse du,
                                             CGNode node,
                                             int valueNumber)

getClassHierarchy

protected IClassHierarchy getClassHierarchy()

hasNoInterestingUses

protected boolean hasNoInterestingUses(int vn)

isRootType

protected boolean isRootType(IClass klass)

visitArrayLoad

public void visitArrayLoad(SSAArrayLoadInstruction instruction)
Specified by:
visitArrayLoad in interface SSAInstruction.IVisitor
Overrides:
visitArrayLoad in class SSAInstruction.Visitor

visitArrayStore

public void visitArrayStore(SSAArrayStoreInstruction instruction)
Specified by:
visitArrayStore in interface SSAInstruction.IVisitor
Overrides:
visitArrayStore in class SSAInstruction.Visitor

visitCheckCast

public void visitCheckCast(SSACheckCastInstruction instruction)
Specified by:
visitCheckCast in interface SSAInstruction.IVisitor
Overrides:
visitCheckCast in class SSAInstruction.Visitor

visitReturn

public void visitReturn(SSAReturnInstruction instruction)
Specified by:
visitReturn in interface SSAInstruction.IVisitor
Overrides:
visitReturn in class SSAInstruction.Visitor

visitGet

public void visitGet(SSAGetInstruction instruction)
Specified by:
visitGet in interface SSAInstruction.IVisitor
Overrides:
visitGet in class SSAInstruction.Visitor

visitGetInternal

protected void visitGetInternal(int lval,
                                int ref,
                                boolean isStatic,
                                FieldReference field)

visitPut

public void visitPut(SSAPutInstruction instruction)
Specified by:
visitPut in interface SSAInstruction.IVisitor
Overrides:
visitPut in class SSAInstruction.Visitor

visitPutInternal

public void visitPutInternal(int rval,
                             int ref,
                             boolean isStatic,
                             FieldReference field)

visitInvoke

public void visitInvoke(SSAInvokeInstruction instruction)
Specified by:
visitInvoke in interface SSAInstruction.IVisitor
Overrides:
visitInvoke in class SSAInstruction.Visitor

visitInvokeInternal

protected void visitInvokeInternal(SSAAbstractInvokeInstruction instruction)

visitNew

public void visitNew(SSANewInstruction instruction)
Specified by:
visitNew in interface SSAInstruction.IVisitor
Overrides:
visitNew in class SSAInstruction.Visitor

visitThrow

public void visitThrow(SSAThrowInstruction instruction)
Specified by:
visitThrow in interface SSAInstruction.IVisitor
Overrides:
visitThrow in class SSAInstruction.Visitor

visitGetCaughtException

public void visitGetCaughtException(SSAGetCaughtExceptionInstruction instruction)
Specified by:
visitGetCaughtException in interface SSAInstruction.IVisitor
Overrides:
visitGetCaughtException in class SSAInstruction.Visitor

visitPi

public void visitPi(SSAPiInstruction instruction)
Specified by:
visitPi in interface SSAInstruction.IVisitor
Overrides:
visitPi in class SSAInstruction.Visitor

getBasicBlock

public IBasicBlock getBasicBlock()

setBasicBlock

public void setBasicBlock(IBasicBlock block)
The calling loop must call this in each iteration!


computeInvariantParameters

protected InstanceKey[][] computeInvariantParameters(SSAAbstractInvokeInstruction call)
Side effect: records invariant parameters as implicit points-to-sets.

Returns:
if non-null, then result[i] holds the set of instance keys which may be passed as the ith parameter. (which must be invariant)

visitLoadClass

public void visitLoadClass(SSALoadClassInstruction instruction)
Specified by:
visitLoadClass in interface SSAInstruction.IVisitor
Overrides:
visitLoadClass in class SSAInstruction.Visitor