Class GuardedAssignmentBlockInstr
- All Implemented Interfaces:
INode
This high-level instruction provides a declarative approach to conditional assignment, allowing backends to choose between branching and conditional selection strategies: - LLVM: Lower to conditional select or branches based on optimization context - JVM: Lower to bytecode jumps or conditional expressions - Other backends: Optimize based on target-specific capabilities
Contains complete evaluation paths for condition checking and assignment execution. Backends can use this information to make optimal code generation decisions.
Assignment Logic: Assign only if LHS is null OR LHS._isSet() == false Uses QUESTION_BLOCK semantics internally for consistent null-safety behavior.
Format: GUARDED_ASSIGNMENT_BLOCK result = condition_evaluation, assignment_evaluation
-
Method Summary
Modifier and TypeMethodDescriptionGet the assignment evaluation record.Get instructions for performing the assignment (when condition is true).Get the assignment result variable name.Get the conditional evaluation record.Get instructions for evaluating the assignment condition (should assignment occur?).Get the condition result variable name (Boolean indicating if assignment should occur).Get the scope ID for memory management.static GuardedAssignmentBlockInstr
guardedAssignmentBlock
(ConditionalEvaluation conditionalEvaluation, OperandEvaluation assignmentEvaluation, BasicDetails basicDetails) Create guarded assignment block.toString()
Methods inherited from class org.ek9lang.compiler.ir.IRInstr
accept, addOperand, addOperands, equals, getDebugInfo, getOpcode, getOperands, getResult, hashCode, hasResult, isControlFlow, isLabel, isMemoryManagement, isMethodCall
-
Method Details
-
guardedAssignmentBlock
public static GuardedAssignmentBlockInstr guardedAssignmentBlock(ConditionalEvaluation conditionalEvaluation, OperandEvaluation assignmentEvaluation, BasicDetails basicDetails) Create guarded assignment block. -
getConditionEvaluationInstructions
-
getConditionResult
Get the condition result variable name (Boolean indicating if assignment should occur). -
getAssignmentEvaluationInstructions
-
getAssignmentResult
Get the assignment result variable name. -
getScopeId
Get the scope ID for memory management. -
getConditionalEvaluation
Get the conditional evaluation record. -
getAssignmentEvaluation
Get the assignment evaluation record. -
toString
-