Package jminusminus
Class NBasicBlock
java.lang.Object
jminusminus.NBasicBlock
Representation of a block within a control flow graph.
-
Field Summary
Modifier and TypeFieldDescriptionboolean
Is this block active?int
Number of backward branches to this block.The control flow graph (cfg) that this block belongs to.The dominator of this block.int
Number of forward branches to this block.List of high-level (HIR) instructions in this block.int
Unique identifier of ths block.boolean
Is this block a loop head?boolean
Is this block a loop tail?List of low-level (LIR) instructions in this block.All virtual registers locally defined within this block.All virtual registers live in the block.All virtual registers live outside the block.All virtual registers used before definition within this block.int[]
The state array for this block that maps local variable index to the HIR instruction that last affected it.int
Depth of a loop.int
Index of a loop.List of predecessor blocks.int
Ref count of this block.List of successor blocks.List of tuples in this block.boolean
Has this block been visited? -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
equals
(NBasicBlock other) Returns true if this block and other have the same id, and false otherwise.int
Returns the instruction identifier for the first LIR instruction, or -1.getInstruction
(int id) Returns the LIR instruction with the given id, or null.int
Returns the instruction identifier for the last LIR instruction, or -1.id()
Returns a string identifier of this block.boolean
idIsFree
(int id) Returns true if there is no LIR instruction with the given id, and false otherwise.void
insertLIRInst
(NLIRInstruction inst) Inserts the given LIR instruction at the appropriate place in this block's lir array based on its id -- preserving order by id.toString()
Returns a string representation of this block.void
Writes the HIR instructions in this block to standard output.void
Writes the LIR instructions in this block to standard output.void
Writes the tuples in this block to standard output.
-
Field Details
-
cfg
The control flow graph (cfg) that this block belongs to. -
id
public int idUnique identifier of ths block. -
tuples
List of tuples in this block. -
predecessors
List of predecessor blocks. -
successors
List of successor blocks. -
hir
List of high-level (HIR) instructions in this block. -
lir
List of low-level (LIR) instructions in this block. -
locals
public int[] localsThe state array for this block that maps local variable index to the HIR instruction that last affected it. -
visited
public boolean visitedHas this block been visited? -
active
public boolean activeIs this block active? -
isLoopHead
public boolean isLoopHeadIs this block a loop head? -
isLoopTail
public boolean isLoopTailIs this block a loop tail? -
loopIndex
public int loopIndexIndex of a loop. -
loopDepth
public int loopDepthDepth of a loop. -
fwdBranches
public int fwdBranchesNumber of forward branches to this block. -
bwdBranches
public int bwdBranchesNumber of backward branches to this block. -
ref
public int refRef count of this block. -
dom
The dominator of this block. -
liveDef
All virtual registers locally defined within this block. -
liveUse
All virtual registers used before definition within this block. -
liveIn
All virtual registers live in the block. -
liveOut
All virtual registers live outside the block.
-
-
Constructor Details
-
NBasicBlock
Constructs a basic block.- Parameters:
cfg
- the cfg containing this block.id
- id of the block.
-
-
Method Details
-
id
Returns a string identifier of this block.- Returns:
- a string identifier of this block.
-
equals
Returns true if this block and other have the same id, and false otherwise.- Parameters:
other
- the other block.- Returns:
- true if this block and other have the same id, and false otherwise.
-
toString
Returns a string representation of this block. -
writeTuplesToStdOut
Writes the tuples in this block to standard output.- Parameters:
p
- for pretty printing with indentation.
-
writeHirToStdOut
Writes the HIR instructions in this block to standard output.- Parameters:
p
- for pretty printing with indentation.
-
writeLirToStdOut
Writes the LIR instructions in this block to standard output.- Parameters:
p
- for pretty printing with indentation.
-
getFirstLIRInstId
public int getFirstLIRInstId()Returns the instruction identifier for the first LIR instruction, or -1.- Returns:
- the instruction identifier for the first LIR instruction, or -1.
-
getLastLIRInstId
public int getLastLIRInstId()Returns the instruction identifier for the last LIR instruction, or -1.- Returns:
- the instruction identifier for the last LIR instruction, or -1.
-
getInstruction
Returns the LIR instruction with the given id, or null.- Parameters:
id
- the id to look for.- Returns:
- the LIR instruction with the given id, or null.
-
idIsFree
public boolean idIsFree(int id) Returns true if there is no LIR instruction with the given id, and false otherwise.- Parameters:
id
- the id to check for.- Returns:
- true if there is no LIR instruction with the given id, and false otherwise.
-
insertLIRInst
Inserts the given LIR instruction at the appropriate place in this block's lir array based on its id -- preserving order by id.- Parameters:
inst
- the LIR instruction to be inserted.
-