Class SSAInstruction

java.lang.Object
com.ibm.wala.ssa.SSAInstruction
  • Field Details

  • Constructor Details

    • SSAInstruction

      protected SSAInstruction(int iindex)
      prevent instantiation by the outside
  • Method Details

    • copyForSSA

      public abstract SSAInstruction copyForSSA(SSAInstructionFactory insts, 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.

      TODO: move this into the SSAInstructionFactory

    • toString

      public abstract String toString(SymbolTable symbolTable)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getValueString

      protected String getValueString(SymbolTable symbolTable, 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)
      Return the ith def
      Parameters:
      i - number of the def, starting at 0.
    • getNumberOfDefs

      public int getNumberOfDefs()
    • getNumberOfUses

      public int getNumberOfUses()
    • getUse

      public int getUse(int j) throws UnsupportedOperationException
      Returns:
      value number representing the jth use in this instruction. -1 means TOP (i.e., the value doesn't matter)
      Throws:
      UnsupportedOperationException
    • hashCode

      public abstract int hashCode()
      Overrides:
      hashCode in class Object
    • isPEI

      public boolean isPEI()
      Returns:
      true iff this instruction may throw an exception.
    • getExceptionTypes

      public Collection<TypeReference> getExceptionTypes()
      This method should never return null.
      Returns:
      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(Object obj)
      We assume these instructions are canonical and managed by a governing IR object. Be careful.

      Depending on the caching policy (see SSACache), the governing IR may be deleted to reclaim memory and recomputed as needed. When an IR is recomputed, it also creates fresh SSAInstruction objects that will not equal old ones. Thus, do not compare for identity SSAInstructions obtained from distinct calls that retrieve cached values (e.g. distinct CGNode.getIR() calls). See the github issue for details.

      Overrides:
      equals in class Object
    • iIndex

      public int iIndex()
    • setInstructionIndex

      public void setInstructionIndex(int instructionIndex)