Class BasicBlock
java.lang.Object
org.ek9lang.compiler.ir.BasicBlock
- All Implemented Interfaces:
INode
Represents a basic block in the EK9 IR - a sequence of instructions with single entry and exit.
Basic blocks are fundamental units of control flow analysis and optimization. Each block contains a linear sequence of instructions ending with a control flow instruction.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
accept
(INodeVisitor visitor) addInstruction
(IRInstruction instruction) Add instruction to this basic block.addInstructions
(List<IRInstruction> instructions) Add multiple instructions from a list.addInstructions
(IRInstruction... instructions) Add multiple instructions to this basic block.addSuccessor
(BasicBlock successor) Add successor basic block (control flow edge).boolean
Check if this block ends with a control flow instruction.boolean
getLabel()
Get the last instruction in this block (usually control flow).Get all memory management instructions in this block.Get all method call instructions in this block.int
hashCode()
boolean
isEmpty()
Check if this block is empty (no instructions).boolean
Check if this block is a terminator (ends with RETURN).toString()
-
Constructor Details
-
BasicBlock
Create basic block with given label.
-
-
Method Details
-
addInstruction
Add instruction to this basic block. -
addInstructions
Add multiple instructions to this basic block. -
addInstructions
Add multiple instructions from a list. -
addSuccessor
Add successor basic block (control flow edge). -
getLabel
-
getInstructions
-
getPredecessors
-
getSuccessors
-
isEmpty
public boolean isEmpty()Check if this block is empty (no instructions). -
getLastInstruction
Get the last instruction in this block (usually control flow). -
endsWithControlFlow
public boolean endsWithControlFlow()Check if this block ends with a control flow instruction. -
isTerminator
public boolean isTerminator()Check if this block is a terminator (ends with RETURN). -
getMethodCalls
Get all method call instructions in this block. -
getMemoryManagementInstructions
Get all memory management instructions in this block. -
accept
-
toString
-
equals
-
hashCode
-