Class PcodeOp

  • Direct Known Subclasses:
    PcodeOpAST, PcodeOpRaw

    public class PcodeOp
    extends java.lang.Object
    Pcode Op describes a generic machine operation. You can think of it as the microcode for a specific processor's instruction set. There are a finite number of PcodeOp's that theoretically can define the operations for any given processor. Pcode have An operation code Some number of input parameter varnodes possible output varnode

Constructor Detail

  • Method Detail

    • getOpcode

      public final int getOpcode()
      Returns:
      pcode operation code
    • getNumInputs

      public final int getNumInputs()
      Returns:
      number of input varnodes
    • getInputs

      public final Varnode[] getInputs()
      Returns:
      get input varnodes
    • getInput

      public final Varnode getInput​(int i)
      Parameters:
      i - the i'th input varnode
      Returns:
      the i'th input varnode
    • getOutput

      public final Varnode getOutput()
      Returns:
      get output varnodes
    • getSlot

      public final int getSlot​(Varnode vn)
      Assuming vn is an input to this op, return its input slot number
      Parameters:
      vn - is the input varnode
      Returns:
      the slot number
    • getMnemonic

      public final java.lang.String getMnemonic()
      Returns:
      get the string representation for the pcode operation
    • isDead

      public boolean isDead()
      Check if the pcode has been determined to be a dead operation.
      Returns:
      true if the pcode has been determined to have no effect in the context it is used
    • isAssignment

      public final boolean isAssignment()
      Returns:
      true if the pcode assigns a value to an output varnode
    • getSeqnum

      public final SequenceNumber getSeqnum()
      Returns:
      the sequence number this pcode is within some number of pcode
    • getBasicIter

      public java.util.Iterator<PcodeOp> getBasicIter()
    • getInsertIter

      public java.util.Iterator<java.lang.Object> getInsertIter()
    • getParent

      public PcodeBlockBasic getParent()
      Returns:
      the pcode basic block this pcode belongs to
    • setOpcode

      public final void setOpcode​(int o)
      Set the pcode operation code
      Parameters:
      o - pcode operation code
    • setInput

      public final void setInput​(Varnode vn,
                                 int slot)
      Set/Replace an input varnode at the given slot.
      Parameters:
      vn - varnode to replace
      slot - index of input varnode to be replaced
    • removeInput

      public final void removeInput​(int slot)
      Remove a varnode at the given slot from the list of input varnodes
      Parameters:
      slot - index of input varnode to remove
    • insertInput

      public final void insertInput​(Varnode vn,
                                    int slot)
      Insert an input varnode at the given index of input varnodes
      Parameters:
      vn - varnode to insert
      slot - insert index in input varnode list
    • setTime

      public final void setTime​(int t)
      Set a unique number for pcode ops that are attached to the same address
      Parameters:
      t - unique id
    • setOrder

      public final void setOrder​(int ord)
      Set relative position information of PcodeOps within a basic block, may change as basic block is edited.
      Parameters:
      ord - relative position of pcode op in basic block
    • setOutput

      public final void setOutput​(Varnode vn)
      Set the output varnode for the pcode operation.
      Parameters:
      vn - new output varnode
    • buildXML

      public void buildXML​(java.lang.StringBuilder resBuf,
                           AddressFactory addrFactory)
    • toString

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

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

      public static final java.lang.String getMnemonic​(int op)
      Get string representation for p-code operation
      Parameters:
      op - operation code
      Returns:
      String representation of p-code operation
    • getOpcode

      public static int getOpcode​(java.lang.String s)
                           throws UnknownInstructionException
      Get the p-code op code for the given mnemonic string.
      Parameters:
      s - is the mnemonic string
      Returns:
      the op code
      Throws:
      UnknownInstructionException - if there is no matching mnemonic