Package jminusminus
Class NHIRInstruction
java.lang.Object
jminusminus.NHIRInstruction
- Direct Known Subclasses:
NHIRALoad
,NHIRArithmetic
,NHIRAStore
,NHIRConditionalJump
,NHIRGetField
,NHIRGoto
,NHIRIntConstant
,NHIRInvoke
,NHIRLoadLocal
,NHIRLocal
,NHIRNewArray
,NHIRPhiFunction
,NHIRPutField
,NHIRReturn
,NHIRStringConstant
This abstract base class provides a high-level intermediate representation (HIR) of a JVM
instruction.
-
Field Summary
Modifier and TypeFieldDescriptionThe block containing this instruction.protected static String[]
Maps JVM opcode to a string mnemonic for HIR instructions.int
Unique identifier of this instruction.The LIR instruction corresponding to this HIR instruction.Long type name for this instruction.Short type name for this instruction. -
Constructor Summary
ModifierConstructorDescriptionprotected
NHIRInstruction
(NBasicBlock block, int id) Constructs a NHIRInstruction object.protected
NHIRInstruction
(NBasicBlock block, int id, String sType, String lType) Constructs a NHIRInstruction object. -
Method Summary
Modifier and TypeMethodDescriptionboolean
equals
(NHIRInstruction other) Returns true if this instruction is the same as the other, and false otherwise.id()
Returns the identifier of this instruction with the short type name prefix.toLir()
Converts and returns a low-level representation (LIR) of this HIR instruction.toString()
Returns a string representation of this instruction.
-
Field Details
-
hirMnemonic
Maps JVM opcode to a string mnemonic for HIR instructions. For example, the opcode imul is mapped to the string "*". -
block
The block containing this instruction. -
id
public int idUnique identifier of this instruction. -
sType
Short type name for this instruction. -
lType
Long type name for this instruction. -
lir
The LIR instruction corresponding to this HIR instruction.
-
-
Constructor Details
-
NHIRInstruction
Constructs a NHIRInstruction object.- Parameters:
block
- enclosing block.id
- identifier of the instruction.
-
NHIRInstruction
Constructs a NHIRInstruction object.- Parameters:
block
- enclosing block.id
- identifier of the instruction.sType
- short type name of the instruction.lType
- long type name of the instruction.
-
-
Method Details
-
equals
Returns true if this instruction is the same as the other, and false otherwise.- Parameters:
other
- the instruction to compare to.- Returns:
- true if this instruction is the same as the other, and false otherwise.
-
toLir
Converts and returns a low-level representation (LIR) of this HIR instruction. Also adds the returned LIR instruction to the list of LIR instructions for the block containing this instruction, along with any other intermediate LIR instructions needed.- Returns:
- the LIR instruction corresponding to this HIR instruction.
-
id
Returns the identifier of this instruction with the short type name prefix.- Returns:
- the identifier of this instruction with the short type name prefix.
-
toString
Returns a string representation of this instruction.
-