Class BranchInstr
java.lang.Object
org.ek9lang.compiler.ir.instructions.IRInstr
org.ek9lang.compiler.ir.instructions.BranchInstr
- All Implemented Interfaces:
INode
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 Summary
Modifier and TypeMethodDescriptionaddOperand(String operand) Add operand to this instruction.addOperands(String... operands) Add multiple operands to this instruction.static BranchInstrassertValue(String condition, String message, DebugInfo debugInfo) Create assert instruction with message and debug info: ASSERT condition, message.static BranchInstrassertValue(String condition, DebugInfo debugInfo) Create assert instruction with debug info: ASSERT condition.static BranchInstrCreate unconditional branch: BRANCH target_label.static BranchInstrbranchIfFalse(String condition, String targetLabel, DebugInfo debugInfo) Create conditional branch if false: BRANCH_FALSE condition, target_label.static BranchInstrbranchIfTrue(String condition, String targetLabel, DebugInfo debugInfo) Create conditional branch if true: BRANCH_TRUE condition, target_label.Get condition for ASSERT instructions.Get assertion message (second operand).Get condition for conditional branch instructions.Get return value for RETURN instructions.Get target label for branch instructions.static BranchInstrreturnValue(String value, DebugInfo debugInfo) Create return with value and debug info: RETURN value.static BranchInstrCreate return with no value: RETURN.static BranchInstrreturnVoid(DebugInfo debugInfo) Create return with no value and debug info: RETURN.Methods inherited from class IRInstr
accept, equals, getDebugInfo, getEscapeMetaData, getOpcode, getOperands, getResult, hasEscapeMetaData, hashCode, hasResult, isControlFlow, isLabel, isMemoryManagement, isMethodCall, setEscapeMetaData, toString
-
Method Details
-
returnVoid
Create return with no value: RETURN. -
returnVoid
Create return with no value and debug info: RETURN. -
returnValue
Create return with value and debug info: RETURN value. -
assertValue
Create assert instruction with message and debug info: ASSERT condition, message. Message is stored as second operand and available at runtime regardless of debug mode. -
assertValue
Create assert instruction with debug info: ASSERT condition. Backward compatible - no message. -
branch
Create unconditional branch: BRANCH target_label. -
branchIfTrue
Create conditional branch if true: BRANCH_TRUE condition, target_label. Branches to target if condition is true (non-zero). -
branchIfFalse
Create conditional branch if false: BRANCH_FALSE condition, target_label. Branches to target if condition is false (zero). -
addOperand
Description copied from class:IRInstrAdd operand to this instruction.- Overrides:
addOperandin classIRInstr
-
addOperands
Description copied from class:IRInstrAdd multiple operands to this instruction.- Overrides:
addOperandsin classIRInstr
-
getTargetLabel
Get target label for branch instructions. -
getCondition
Get condition for conditional branch instructions. -
getReturnValue
Get return value for RETURN instructions. -
getAssertCondition
Get condition for ASSERT instructions. -
getAssertMessage
Get assertion message (second operand). Returns null if no message was provided.
-