Package iota

Class NHirInstruction

java.lang.Object
iota.NHirInstruction
Direct Known Subclasses:
NHirArithmetic, NHirCall, NHirIConst, NHirJump, NHirLoadParam, NHirPhiFunction, NHirReturn

abstract class NHirInstruction extends Object
An abstract high-level intermediate representation (HIR) of a JVM instruction.
  • Field Details

    • jvm2Hir

      protected static HashMap<Integer,String> jvm2Hir
      Maps JVM opcode to the corresponding HIR mnemonic. For example, maps IMUL to "*".
    • hir2lir

      protected static HashMap<String,String> hir2lir
      Maps HIR mnemonic to the corresponding LIR mnemonic. For example, maps "*" to "mul".
    • block

      public NBasicBlock block
      Enclosing basic block.
    • id

      public int id
      Instruction id.
    • mnemonic

      public String mnemonic
      Instruction mnemonic.
    • type

      public String type
      Instruction type ("I" for int and boolean, "V" for void, and "" for no type).
    • lir

      public NLirInstruction lir
      The last of the corresponding LIR instructions.
  • Constructor Details

    • NHirInstruction

      protected NHirInstruction(NBasicBlock block, int id, String mnemonic)
      Constructs an NHirInstruction object.
      Parameters:
      block - enclosing basic block.
      id - instruction id.
      mnemonic - instruction mnemonic.
    • NHirInstruction

      protected NHirInstruction(NBasicBlock block, int id, String mnemonic, String type)
      Constructs an NHirInstruction object.
      Parameters:
      block - enclosing basic block.
      id - instruction id.
      mnemonic - instruction mnemonic.
      type - instruction type.
  • Method Details

    • id

      public String id()
      Returns the id of this instruction as a string.
      Returns:
      the id of this instruction as a string.
    • toLir

      public abstract NLirInstruction toLir()
      Converts and returns a low-level representation (LIR) of this instruction.
      Returns:
      the LIR instruction corresponding to this instruction.
    • toString

      public String toString()
      Returns a string representation of this instruction.
      Overrides:
      toString in class Object
      Returns:
      a string representation of this instruction.