Class ConstructTpl

java.lang.Object
ghidra.app.plugin.processors.sleigh.template.ConstructTpl

public class ConstructTpl extends Object
A constructor template, representing the semantic action of a SLEIGH constructor, without its final context. The constructor template is made up of a list of p-code op templates, which are in turn made up of varnode templates. This is one step removed from the final array of PcodeOp objects, but: - Constants may still need to incorporate context dependent address resolution and relative offsets. - Certain p-code operations may still need expansion to include a dynamic LOAD or STORE operation. - The list may hold "build" directives for sub-constructor templates. - The list may still hold "label" information for the final resolution of relative jump offsets. The final PcodeOps are produced by handing this to the build() method of PcodeEmit which has the InstructionContext necessary for final resolution.
  • Constructor Details

    • ConstructTpl

      public ConstructTpl()
      Constructor for use with decode
    • ConstructTpl

      public ConstructTpl(OpTpl[] opvec)
      Manually build a constructor template. This is useful for building constructor templates outside of the normal SLEIGH pipeline, as for an internally created InjectPayload.
      Parameters:
      opvec - is the list of p-code op templates making up the constructor
    • ConstructTpl

      public ConstructTpl(OpTpl[] opvec, HandleTpl res, int nmLabels)
      Manually build a constructor template from pieces. This is used to translate from the internal SLEIGH compiler pcodeCPort.semantics.ConstructTpl
      Parameters:
      opvec - is the list of p-code op templates making up the constructor
      res - is the result handle template for the constructor
      nmLabels - is the number of labels int the template
  • Method Details

    • getNumLabels

      public int getNumLabels()
      Returns:
      the number of labels needing resolution in this template
    • getOpVec

      public OpTpl[] getOpVec()
      Returns:
      the list of p-code op templates making up this constructor template
    • getResult

      public HandleTpl getResult()
      Returns:
      the (possibly dynamic) location of the final semantic value produced by this constructor
    • decode

      public int decode(Decoder decoder) throws DecoderException
      Decode this template from a \ tag in the stream.
      Parameters:
      decoder - is the stream
      Returns:
      the constructor section id described by the tag
      Throws:
      DecoderException - for errors in the encoding