Class QuestionOperatorInstr
java.lang.Object
org.ek9lang.compiler.ir.IRInstr
org.ek9lang.compiler.ir.QuestionOperatorInstr
- All Implemented Interfaces:
INode
IR instruction for question operator (expression?) with null-safe capability.
This high-level instruction provides a declarative approach to null-safe _isSet() calls, 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 both null and non-null cases. Backends can use this information to make optimal code generation decisions.
Format: QUESTION_BLOCK result = operand_evaluation, null_case_evaluation, set_case_evaluation
-
Method Summary
Modifier and TypeMethodDescriptionGet the null case evaluation record.Get instructions for the null case (when operand is null).Get the null check condition variable name (result of IS_NULL check).Get the result variable for the null case.Get the operand variable name.Get the operand evaluation record.Get instructions for evaluating the operand (the expression that ? is applied to).Get the scope ID for memory management.Get the set case evaluation record.Get instructions for the set case (when operand is not null).Get the result variable for the set case.static QuestionOperatorInstr
questionBlock
(QuestionDetails questionDetails) Create question operator 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
-
questionBlock
Create question operator block. -
getOperandEvaluationInstructions
-
getOperand
Get the operand variable name. -
getNullCheckCondition
Get the null check condition variable name (result of IS_NULL check). -
getNullCaseEvaluationInstructions
-
getNullResult
Get the result variable for the null case. -
getSetCaseEvaluationInstructions
-
getSetResult
Get the result variable for the set case. -
getScopeId
Get the scope ID for memory management. -
getOperandEvaluation
Get the operand evaluation record. -
getNullCaseEvaluation
Get the null case evaluation record. -
getSetCaseEvaluation
Get the set case evaluation record. -
toString
-