class NBasicBlock extends Object
Modifier and Type | Field and Description |
---|---|
boolean |
active
Is this block active?
|
int |
bwdBranches
Number of backward branches to this block.
|
NControlFlowGraph |
cfg
The control flow graph (cfg) that this block belongs to.
|
NBasicBlock |
dom
The dominator of this block.
|
int |
fwdBranches
Number of forward branches to this block.
|
ArrayList<Integer> |
hir
List of high-level (HIR) instructions in this block.
|
int |
id
Unique identifier of ths block.
|
boolean |
isLoopHead
Is this block a loop head?
|
boolean |
isLoopTail
Is this block a loop tail?
|
ArrayList<NLIRInstruction> |
lir
List of low-level (LIR) instructions in this block.
|
BitSet |
liveDef
All virtual registers locally defined within this block.
|
BitSet |
liveIn
All virtual registers live in the block.
|
BitSet |
liveOut
All virtual registers live outside the block.
|
BitSet |
liveUse
All virtual registers used before definition within this block.
|
int[] |
locals
The state array for this block that maps local variable index to the HIR
instruction that last affected it.
|
int |
loopDepth
Depth of a loop.
|
int |
loopIndex
Index of a loop.
|
ArrayList<NBasicBlock> |
predecessors
List of predecessor blocks.
|
int |
ref
Ref count of this block.
|
ArrayList<NBasicBlock> |
successors
List of successor blocks.
|
ArrayList<NTuple> |
tuples
List of tuples in this block.
|
boolean |
visited
Has this block been visited?
|
Constructor and Description |
---|
NBasicBlock(NControlFlowGraph cfg,
int id)
Construct a block given its unique identifier.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(NBasicBlock other)
Is this block the same as the other block? Two blocks are the same if
their ids are the same.
|
int |
getFirstLIRInstId()
The instruction identifier for the first LIR instruction.
|
NLIRInstruction |
getInstruction(int id)
Iterates through the lir array of this block, returning an
NLIRInstruction with the specified id.
|
int |
getLastLIRInstId()
The instruction identifier for the last LIR instruction.
|
String |
id()
Return a string identifier of this block.
|
boolean |
idIsFree(int id)
Checks to see if there is an LIRInstruction with this id in the block's
lir.
|
void |
insertLIRInst(NLIRInstruction inst)
Inserts an NLIRInstruction to the appropriate place in this block's lir
array based on its id -- preserving order by id.
|
String |
toString()
Return a string representation of this block.
|
void |
writeHirToStdOut(PrettyPrinter p)
Write the HIR instructions in this block to STDOUT.
|
void |
writeLirToStdOut(PrettyPrinter p)
Write the LIR instructions in this block to STDOUT.
|
void |
writeTuplesToStdOut(PrettyPrinter p)
Write the tuples in this block to STDOUT.
|
public NControlFlowGraph cfg
public int id
public ArrayList<NBasicBlock> predecessors
public ArrayList<NBasicBlock> successors
public ArrayList<NLIRInstruction> lir
public int[] locals
public boolean visited
public boolean active
public boolean isLoopHead
public boolean isLoopTail
public int loopIndex
public int loopDepth
public int fwdBranches
public int bwdBranches
public int ref
public NBasicBlock dom
public BitSet liveDef
public BitSet liveUse
public BitSet liveIn
public BitSet liveOut
public NBasicBlock(NControlFlowGraph cfg, int id)
cfg
- the cfg containing this block.id
- id of the block.public String id()
public boolean equals(NBasicBlock other)
other
- the other block.public String toString()
public void writeTuplesToStdOut(PrettyPrinter p)
p
- for pretty printing with indentation.public void writeHirToStdOut(PrettyPrinter p)
p
- for pretty printing with indentation.public void writeLirToStdOut(PrettyPrinter p)
p
- for pretty printing with indentation.public int getFirstLIRInstId()
public int getLastLIRInstId()
public NLIRInstruction getInstruction(int id)
id
- the id to look for.public boolean idIsFree(int id)
public void insertLIRInst(NLIRInstruction inst)
inst
- the NLIRInstruction to be inserted.