Return the n-th instruction.
Close the block
do nothing if block is already closed
Is this block closed?
Emitting does not set touched to true.
Emitting does not set touched to true. During code generation this is a hotspot and setting the flag for each emit is a waste. Caching should happen only after a block is closed, which sets the DIRTYSUCCS flag.
Add a new instruction at the end of the block, using the same source position as the last emitted instruction
The semantics of this are a little odd but it's designed to work seamlessly with the existing code.
The semantics of this are a little odd but it's designed to work seamlessly with the existing code. It emits each supplied instruction, then closes the block. The odd part is that if the instruction has pos == NoPosition, it calls the 1-arg emit, but otherwise it calls the 2-arg emit. This way I could retain existing behavior exactly by calling setPos on any instruction using the two arg version which I wanted to include in a call to emitOnly.
Enter ignore mode: new 'emit'ted instructions will not be added to this basic block.
Enter ignore mode: new 'emit'ted instructions will not be added to this basic block. It makes the generation of THROW and RETURNs easier.
Is this block the start block of an exception handler?
Is this block the start block of an exception handler?
Apply a function to all the instructions of the block.
return the underlying array of instructions
Does this block have the given flag?
When set, the emit
methods will be ignored.
Return the index of inst.
Return the index of inst. Uses reference equality. Returns -1 if not found.
Return an iterator over the instructions in this basic block.
Return the last instruction of this basic block.
The number of instructions in this basic block so far.
Is this block the head of a while?
Returns the predecessors of this block.
Returns the predecessors of this block.
Cached predecessors.
Removes instructions found at the given positions.
Remove the last instruction of this basic block.
Remove the last instruction of this basic block. It is fast for an open block, but slower when the block is closed.
Replaces oldInstr
with is
.
Replaces oldInstr
with is
. It does not update
the position field in the newly inserted instructions, so it behaves
differently than the one-instruction versions of this function.
..
..
Replace the given instruction with the new one.
Replace the given instruction with the new one.
Returns true
if it actually changed something.
The replacing instruction is given the nsc.util.Position of the instruction it replaces.
Replace the instruction at the given position.
Replace the instruction at the given position. Used by labels when they are anchored. The replacing instruction is given the nsc.util.Position of the instruction it replaces.
Replaces all instructions found in the map.
Has this basic block been modified since the last call to 'successors'?
Local variables that are in scope at entry of this basic block.
Local variables that are in scope at entry of this basic block. Used for debugging information.
(basicBlock: StringAdd).self
(basicBlock: StringFormat).self
(basicBlock: ArrowAssoc[ICodes.BasicBlock]).x
(Since version 2.10.0) Use leftOfArrow
instead
(basicBlock: Ensuring[ICodes.BasicBlock]).x
(Since version 2.10.0) Use resultOfEnsuring
instead
This class represents a basic block. Each basic block contains a list of instructions that are either executed all, or none. No jumps to/from the "middle" of the basic block are allowed (modulo exceptions).