Class BranchInstr

java.lang.Object
org.ek9lang.compiler.ir.IRInstr
org.ek9lang.compiler.ir.BranchInstr
All Implemented Interfaces:
INode

public final class BranchInstr extends IRInstr
Specialized IR instruction for control flow operations (BRANCH, BRANCH_TRUE, BRANCH_FALSE, ASSERT, RETURN).

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

  • Method Details

    • branch

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

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

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

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

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

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

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

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

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

      public static BranchInstr returnValue(String value, DebugInfo debugInfo)
      Create return with value and debug info: RETURN value.
    • assertValue

      public static BranchInstr assertValue(String condition)
      Create assert instruction: ASSERT condition.
    • assertValue

      public static BranchInstr assertValue(String condition, DebugInfo debugInfo)
      Create assert instruction with debug info: ASSERT condition.
    • addOperand

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

      public BranchInstr addOperands(String... operands)
      Description copied from class: IRInstr
      Add multiple operands to this instruction.
      Overrides:
      addOperands in class IRInstr
    • 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.