public final class LabelRef extends Object
StandardOp.JumpOp
and StandardOp.BranchOp
need to reference their target
AbstractBlockBase
. However, direct references are not possible since the control flow
graph (and therefore successors lists) can be changed by optimizations - and fixing the
instructions is error prone. Therefore, we represent an edge to block B from block A via the
tuple (A,
successor-index-of-B)
. That is, indirectly by storing the index into the successor list of A.
Note therefore that the successor list cannot be re-ordered.Modifier and Type | Field and Description |
---|---|
private AbstractBlockBase<?> |
block |
private LIR |
lir |
private int |
suxIndex |
Modifier | Constructor and Description |
---|---|
private |
LabelRef(LIR lir,
AbstractBlockBase<?> block,
int suxIndex)
Returns a new reference to a successor of the given block.
|
Modifier and Type | Method and Description |
---|---|
static LabelRef |
forSuccessor(LIR lir,
AbstractBlockBase<?> block,
int suxIndex)
Returns a new reference to a successor of the given block.
|
AbstractBlockBase<?> |
getSourceBlock() |
AbstractBlockBase<?> |
getTargetBlock() |
Label |
label() |
String |
toString() |
private final AbstractBlockBase<?> block
private final int suxIndex
private LabelRef(LIR lir, AbstractBlockBase<?> block, int suxIndex)
block
- The base block that contains the successor list.suxIndex
- The index of the successor.public static LabelRef forSuccessor(LIR lir, AbstractBlockBase<?> block, int suxIndex)
block
- The base block that contains the successor list.suxIndex
- The index of the successor.public AbstractBlockBase<?> getSourceBlock()
public AbstractBlockBase<?> getTargetBlock()