Class IRInstr

java.lang.Object
org.ek9lang.compiler.ir.IRInstr
All Implemented Interfaces:
INode
Direct Known Subclasses:
BranchInstr, CallInstr, LiteralInstr, MemoryInstr, ScopeInstr

public class IRInstr extends Object implements INode
Base class for all IR instructions in the EK9 intermediate representation.

Each instruction represents a single operation in the target-agnostic IR, which can be translated to JVM bytecode, LLVM IR, or other target formats.

  • Constructor Details

    • IRInstr

      public IRInstr(IROpcode opcode)
      Create instruction with no result (e.g., STORE, BRANCH).
    • IRInstr

      public IRInstr(IROpcode opcode, String result)
      Create instruction with result destination (e.g., LOAD, CALL).
    • IRInstr

      public IRInstr(IROpcode opcode, String result, DebugInfo debugInfo)
      Create instruction with result and debug information.
  • Method Details

    • addOperand

      public IRInstr addOperand(String operand)
      Add operand to this instruction.
    • addOperands

      public IRInstr addOperands(String... operands)
      Add multiple operands to this instruction.
    • getOpcode

      public IROpcode getOpcode()
    • getResult

      public String getResult()
    • getOperands

      public List<String> getOperands()
    • getDebugInfo

      public Optional<DebugInfo> getDebugInfo()
      Get debug information for this instruction.
    • hasResult

      public boolean hasResult()
      Check if this instruction produces a result value.
    • isMethodCall

      public boolean isMethodCall()
      Check if this instruction is a method call type.
    • isControlFlow

      public boolean isControlFlow()
      Check if this instruction is a control flow type.
    • isMemoryManagement

      public boolean isMemoryManagement()
      Check if this instruction is a memory management type.
    • accept

      public void accept(INodeVisitor visitor)
      Specified by:
      accept in interface INode
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object