Class BranchInstruction
java.lang.Object
org.ek9lang.compiler.ir.IRInstruction
org.ek9lang.compiler.ir.BranchInstruction
- All Implemented Interfaces:
INode
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 Summary
Modifier and TypeMethodDescriptionaddOperand
(String operand) Add operand to this instruction.addOperands
(String... operands) Add multiple operands to this instruction.static BranchInstruction
Create unconditional branch: BRANCH target_labelstatic BranchInstruction
Create unconditional branch with debug info: BRANCH target_labelstatic BranchInstruction
branchFalse
(String condition, String targetLabel) Create conditional branch (false): BRANCH_FALSE condition, target_labelstatic BranchInstruction
branchFalse
(String condition, String targetLabel, DebugInfo debugInfo) Create conditional branch (false) with debug info: BRANCH_FALSE condition, target_labelstatic BranchInstruction
branchTrue
(String condition, String targetLabel) Create conditional branch (true): BRANCH_TRUE condition, target_labelstatic BranchInstruction
branchTrue
(String condition, String targetLabel, DebugInfo debugInfo) Create conditional branch (true) with debug info: BRANCH_TRUE condition, target_labelGet condition for conditional branch instructions.Get return value for RETURN instructions.Get target label for branch instructions.static BranchInstruction
returnValue
(String value) Create return with value: RETURN valuestatic BranchInstruction
returnValue
(String value, DebugInfo debugInfo) Create return with value and debug info: RETURN valuestatic BranchInstruction
Create return with no value: RETURNstatic BranchInstruction
returnVoid
(DebugInfo debugInfo) Create return with no value and debug info: RETURNMethods inherited from class org.ek9lang.compiler.ir.IRInstruction
accept, equals, getDebugInfo, getOpcode, getOperands, getResult, hashCode, hasResult, isControlFlow, isMemoryManagement, isMethodCall, toString
-
Method Details
-
branch
Create unconditional branch: BRANCH target_label -
branch
Create unconditional branch with debug info: BRANCH target_label -
branchTrue
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
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
Create return with no value: RETURN -
returnVoid
Create return with no value and debug info: RETURN -
returnValue
Create return with value: RETURN value -
returnValue
Create return with value and debug info: RETURN value -
addOperand
Description copied from class:IRInstruction
Add operand to this instruction.- Overrides:
addOperand
in classIRInstruction
-
addOperands
Description copied from class:IRInstruction
Add multiple operands to this instruction.- Overrides:
addOperands
in classIRInstruction
-
getTargetLabel
Get target label for branch instructions. -
getCondition
Get condition for conditional branch instructions. -
getReturnValue
Get return value for RETURN instructions.
-