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.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. -
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.
-