Package ghidra.pcode.exec

# Class SleighPcodeUseropDefinition<T>

java.lang.Object
ghidra.pcode.exec.SleighPcodeUseropDefinition<T>

Type Parameters:
  `T` - no type in particular, except to match any executor

All Implemented Interfaces:
  `PcodeUseropLibrary.PcodeUseropDefinition<T>`

public class SleighPcodeUseropDefinition<T> extends Object implements PcodeUseropLibrary.PcodeUseropDefinition<T>
A p-code userop defined using Sleigh source

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `SleighPcodeUseropDefinition.Builder`
  A builder for a particular userop
  `static class`
  `SleighPcodeUseropDefinition.Factory`
  A factory for building `SleighPcodeUseropDefinition`s.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `OUT_SYMBOL_NAME`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `SleighPcodeUseropDefinition(SleighLanguage language, String name, List<String> params, String body)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `execute(PcodeExecutor<T> executor, PcodeUseropLibrary<T> library, Varnode outArg, List<Varnode> inArgs)`
  Invoke/execute the userop.
  `String`
  `getBody()`
  Get the Sleigh source that defines this userop
  `int`
  `getInputCount()`
  Get the number of input operands acccepted by the userop.
  `List<String>`
  `getInputs()`
  Get the names of the inputs in order
  `String`
  `getName()`
  Get the name of the userop.
  `PcodeProgram`
  `programFor(Varnode outArg, List<Varnode> inArgs, PcodeUseropLibrary<?> library)`
  Get the p-code program implementing this userop for the given arguments and library.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### OUT_SYMBOL_NAME

    public static final String OUT_SYMBOL_NAME
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### SleighPcodeUseropDefinition

    protected SleighPcodeUseropDefinition(SleighLanguage language, String name, List<String> params, String body)

- ## Method Details

  - ### programFor

    public PcodeProgram programFor(Varnode outArg, List<Varnode> inArgs, PcodeUseropLibrary<?> library)
    Get the p-code program implementing this userop for the given arguments and library.

    This will compile and cache a program for each new combination of arguments seen.

    Parameters:
      `outArg` - the output operand, if applicable
      `inArgs` - the input operands
      `library` - the complete userop library
    Returns:
      the p-code program to be fed to the same executor as invoked this userop, but in a new frame

  - ### getName

    public String getName()
    Description copied from interface: `PcodeUseropLibrary.PcodeUseropDefinition`
    Get the name of the userop.

    This is the symbol assigned to the userop when compiling new Sleigh code. It cannot conflict with existing userops (except those declared, but not defined, by the executor's language) or other symbols of the executor's language. If this userop is to be used generically across many languages, choose an unlikely name. Conventionally, these start with two underscores `__`.

    Specified by:
      `getName` in interface `PcodeUseropLibrary.PcodeUseropDefinition<T>`
    Returns:
      the name of the userop

  - ### getInputCount

    public int getInputCount()
    Description copied from interface: `PcodeUseropLibrary.PcodeUseropDefinition`
    Get the number of input operands acccepted by the userop.
    Specified by:
      `getInputCount` in interface `PcodeUseropLibrary.PcodeUseropDefinition<T>`
    Returns:
      the count or -1 if the userop is variadic

  - ### execute

    public void execute(PcodeExecutor<T> executor, PcodeUseropLibrary<T> library, Varnode outArg, List<Varnode> inArgs)
    Description copied from interface: `PcodeUseropLibrary.PcodeUseropDefinition`
    Invoke/execute the userop.
    Specified by:
      `execute` in interface `PcodeUseropLibrary.PcodeUseropDefinition<T>`
    Parameters:
      `executor` - the executor invoking this userop.
      `library` - the complete library for this execution. Note the library may have been composed from more than the one defining this userop.
      `outArg` - if invoked as an rval, the destination varnode for the userop's output. Otherwise, `null`.
      `inArgs` - the input varnodes as ordered in the source.
    See Also:
      - `AnnotatedPcodeUseropLibrary.AnnotatedPcodeUseropDefinition`

  - ### getInputs

    public List<String> getInputs()
    Get the names of the inputs in order
    Returns:
      the input names

  - ### getBody

    public String getBody()
    Get the Sleigh source that defines this userop
    Returns:
      the lines