Class BranchInstruction

java.lang.Object
org.ek9lang.compiler.ir.IRInstruction
org.ek9lang.compiler.ir.BranchInstruction
All Implemented Interfaces:
INode

public final class BranchInstruction extends IRInstruction
Specialized IR instruction for control flow operations (BRANCH, BRANCH_TRUE, BRANCH_FALSE, RETURN).

Branch instructions handle all control flow in the EK9 IR, including loops, conditionals, and method returns.

  • Method Details

    • branch

      public static BranchInstruction branch(String targetLabel)
      Create unconditional branch: BRANCH target_label
    • branch

      public static BranchInstruction branch(String targetLabel, DebugInfo debugInfo)
      Create unconditional branch with debug info: BRANCH target_label
    • branchTrue

      public static BranchInstruction branchTrue(String condition, String targetLabel)
      Create conditional branch (true): BRANCH_TRUE condition, target_label
    • branchTrue

      public static BranchInstruction branchTrue(String condition, String targetLabel, DebugInfo debugInfo)
      Create conditional branch (true) with debug info: BRANCH_TRUE condition, target_label
    • branchFalse

      public static BranchInstruction branchFalse(String condition, String targetLabel)
      Create conditional branch (false): BRANCH_FALSE condition, target_label
    • branchFalse

      public static BranchInstruction branchFalse(String condition, String targetLabel, DebugInfo debugInfo)
      Create conditional branch (false) with debug info: BRANCH_FALSE condition, target_label
    • returnVoid

      public static BranchInstruction returnVoid()
      Create return with no value: RETURN
    • returnVoid

      public static BranchInstruction returnVoid(DebugInfo debugInfo)
      Create return with no value and debug info: RETURN
    • returnValue

      public static BranchInstruction returnValue(String value)
      Create return with value: RETURN value
    • returnValue

      public static BranchInstruction returnValue(String value, DebugInfo debugInfo)
      Create return with value and debug info: RETURN value
    • addOperand

      public BranchInstruction addOperand(String operand)
      Description copied from class: IRInstruction
      Add operand to this instruction.
      Overrides:
      addOperand in class IRInstruction
    • addOperands

      public BranchInstruction addOperands(String... operands)
      Description copied from class: IRInstruction
      Add multiple operands to this instruction.
      Overrides:
      addOperands in class IRInstruction
    • getTargetLabel

      public String getTargetLabel()
      Get target label for branch instructions.
    • getCondition

      public String getCondition()
      Get condition for conditional branch instructions.
    • getReturnValue

      public String getReturnValue()
      Get return value for RETURN instructions.