Record Class IntConstOpnd

java.lang.Object
java.lang.Record
ghidra.pcode.emu.jit.gen.opnd.IntConstOpnd
Record Components:
value - the value
type - the p-code type
All Implemented Interfaces:
Opnd<JitType.IntJitType>, SimpleOpnd<Types.TInt,JitType.IntJitType>

public record IntConstOpnd(int value, JitType.IntJitType type) extends Record
A constant int
  • Field Details

  • Constructor Details

    • IntConstOpnd

      public IntConstOpnd(int value, JitType.IntJitType type)
      Creates an instance of a IntConstOpnd record class.
      Parameters:
      value - the value for the value record component
      type - the value for the type record component
  • Method Details

    • zero

      public static IntConstOpnd zero(JitType.IntJitType type)
      Get a constant 0 of the given p-code int type.
      Parameters:
      type - the type
      Returns:
      the constant 0
    • name

      public String name()
      Description copied from interface: Opnd
      Returns the name.
      Specified by:
      name in interface Opnd<JitType.IntJitType>
      Returns:
      the name
    • read

      public <N extends Emitter.Next> Emitter<Emitter.Ent<N,Types.TInt>> read(Emitter<N> em)
      Description copied from interface: SimpleOpnd
      Emit code to read the operand onto the stack
      Specified by:
      read in interface SimpleOpnd<Types.TInt,JitType.IntJitType>
      Type Parameters:
      N - the tail of the stack (...)
      Parameters:
      em - the emitter
      Returns:
      the emitter with ..., value
    • write

      public <N1 extends Emitter.Next, N0 extends Emitter.Ent<N1, Types.TInt>> SimpleOpnd.SimpleOpndEm<Types.TInt,JitType.IntJitType,N1> write(Emitter<N0> em, Scope scope)
      Description copied from interface: SimpleOpnd
      Emit code to write the operand from the stack

      This will generate a new operand if this operand is read-only. Callers must therefore be prepared to take the result in place of this operand.

      Specified by:
      write in interface SimpleOpnd<Types.TInt,JitType.IntJitType>
      Type Parameters:
      N1 - the tail of the stack (...)
      N0 - ..., value
      Parameters:
      em - the emitter
      scope - a scope for generated temporary variables
      Returns:
      the resulting operand and emitter with ...
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • value

      public int value()
      Returns the value of the value record component.
      Returns:
      the value of the value record component
    • type

      public JitType.IntJitType type()
      Returns the value of the type record component.
      Specified by:
      type in interface Opnd<JitType.IntJitType>
      Returns:
      the value of the type record component
    • tempName

      default String tempName()
      Generate a name should this need conversion into a temporary variable
      Returns:
      the name
    • writeDirect

      default <N1 extends Emitter.Next, N0 extends Emitter.Ent<N1, T>> Emitter<N1> writeDirect(Emitter<N0> em)
      Description copied from interface: SimpleOpnd
      Emit code to write the operand, without generating a new operand

      This will throw an exception during generation if this operand is read-only. This should only be used when the caller is certain the operand can be written and when a scope is not available.

      Specified by:
      writeDirect in interface SimpleOpnd<T extends Types.BPrim<?>,JT extends JitType.SimpleJitType<T,JT>>
      Type Parameters:
      N1 - the tail of the stack (...)
      N0 - ..., value
      Parameters:
      em - the emitter
      Returns:
      the emitter with ...