public final class SsaBasicBlock
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
SsaBasicBlock.LabelComparator
Label comparator.
|
static interface |
SsaBasicBlock.Visitor
Visitor interface for basic blocks.
|
| Modifier and Type | Field and Description |
|---|---|
static java.util.Comparator<SsaBasicBlock> |
LABEL_COMPARATOR
non-null; comparator for instances of this class that
just compares block labels |
| Constructor and Description |
|---|
SsaBasicBlock(int basicBlockIndex,
int ropLabel,
SsaMethod parent)
Creates a new empty basic block.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addDomChild(SsaBasicBlock child)
Adds a basic block as a dom child for this block.
|
void |
addInsnToHead(Insn insn)
Adds an insn to the head of this basic block, just after any phi
insns.
|
void |
addLiveIn(int regV)
Adds
regV to the live-in list for this block. |
void |
addLiveOut(int regV)
Adds
regV to the live-out list for this block. |
void |
addMoveToBeginning(RegisterSpec result,
RegisterSpec source)
Adds a move instruction after the phi insn block.
|
void |
addMoveToEnd(RegisterSpec result,
RegisterSpec source)
Adds a move instruction to the end of this basic block, just
before the last instruction.
|
void |
addPhiInsnForReg(int reg)
Adds a phi insn to the beginning of this block.
|
void |
addPhiInsnForReg(RegisterSpec resultSpec)
Adds a phi insn to the beginning of this block.
|
void |
exitBlockFixup(SsaBasicBlock exitBlock)
Attaches block to an exit block if necessary.
|
void |
forEachInsn(SsaInsn.Visitor visitor)
Visits all insns in this block.
|
void |
forEachPhiInsn(PhiInsn.Visitor v)
Visits each phi insn.
|
java.util.ArrayList<SsaBasicBlock> |
getDomChildren()
Gets the dom children for this node.
|
int |
getIndex() |
java.util.ArrayList<SsaInsn> |
getInsns() |
IntSet |
getLiveInRegs()
Returns the set of live-in registers.
|
IntSet |
getLiveOutRegs()
Returns the set of live-out registers.
|
SsaMethod |
getParent() |
java.util.List<SsaInsn> |
getPhiInsns() |
java.util.BitSet |
getPredecessors() |
SsaBasicBlock |
getPrimarySuccessor() |
int |
getPrimarySuccessorIndex() |
int |
getPrimarySuccessorRopLabel() |
int |
getRopLabel() |
java.lang.String |
getRopLabelString() |
IntList |
getRopLabelSuccessorList() |
IntList |
getSuccessorList() |
java.util.BitSet |
getSuccessors() |
SsaBasicBlock |
insertNewPredecessor()
Inserts a new empty GOTO block as a predecessor to this block.
|
SsaBasicBlock |
insertNewSuccessor(SsaBasicBlock other)
Constructs and inserts a new empty GOTO block
Z between
this block (A) and a current successor block
(B). |
boolean |
isExitBlock() |
static SsaBasicBlock |
newFromRop(RopMethod rmeth,
int basicBlockIndex,
SsaMethod parent)
Creates a new SSA basic block from a ROP form basic block.
|
void |
removeAllPhiInsns()
Deletes all phi insns.
|
void |
removeSuccessor(int oldIndex)
Removes a successor from this block's successor list.
|
void |
replaceLastInsn(Insn insn)
Replaces the last insn in this block.
|
void |
replaceSuccessor(int oldIndex,
int newIndex)
Replaces an old successor with a new successor.
|
void |
scheduleMovesFromPhis()
Sorts move instructions added via
addMoveToEnd during
phi removal so that results don't overwrite sources that are used. |
java.lang.String |
toString() |
public static final java.util.Comparator<SsaBasicBlock> LABEL_COMPARATOR
non-null; comparator for instances of this class that
just compares block labelspublic SsaBasicBlock(int basicBlockIndex,
int ropLabel,
SsaMethod parent)
basicBlockIndex - index this block will haveropLabel - original rop-form labelparent - method of this blockpublic static SsaBasicBlock newFromRop(RopMethod rmeth, int basicBlockIndex, SsaMethod parent)
rmeth - original methodbasicBlockIndex - index this block will haveparent - method of this block predecessor set will be
updatedpublic void addDomChild(SsaBasicBlock child)
child - non-null; new dom childpublic java.util.ArrayList<SsaBasicBlock> getDomChildren()
non-null; list of dom childrenpublic void addPhiInsnForReg(int reg)
reg - >=0; result regpublic void addPhiInsnForReg(RegisterSpec resultSpec)
resultSpec - non-null; regpublic void addInsnToHead(Insn insn)
insn - non-null; rop-form insn to addpublic void replaceLastInsn(Insn insn)
insn - non-null; rop-form insn to add, which must branch.public void forEachPhiInsn(PhiInsn.Visitor v)
v - non-null; the callbackpublic void removeAllPhiInsns()
public java.util.ArrayList<SsaInsn> getInsns()
non-null; the (mutable) instruction list for this block,
with phi insns at the beginningpublic java.util.List<SsaInsn> getPhiInsns()
non-null; the (mutable) list of phi insns for this blockpublic int getIndex()
public int getRopLabel()
public java.lang.String getRopLabelString()
public java.util.BitSet getPredecessors()
non-null; predecessors set, indexed by block indexpublic java.util.BitSet getSuccessors()
non-null; successors set, indexed by block indexpublic IntList getSuccessorList()
non-null; ordered successor list, containing block
indiciespublic int getPrimarySuccessorIndex()
>= -1; block index of primary successor or
-1 if no primary successorpublic int getPrimarySuccessorRopLabel()
public SsaBasicBlock getPrimarySuccessor()
null-ok; the primary successor block or null
if there is nonepublic IntList getRopLabelSuccessorList()
public SsaMethod getParent()
non-null; method that contains this blockpublic SsaBasicBlock insertNewPredecessor()
non-null; an appropriately-constructed instancepublic SsaBasicBlock insertNewSuccessor(SsaBasicBlock other)
Z between
this block (A) and a current successor block
(B). The new block will replace B as A's successor and
A as B's predecessor. A and B will no longer be directly connected.
If B is listed as a successor multiple times, all references
are replaced.other - current successor (B)non-null; an appropriately-constructed instancepublic void replaceSuccessor(int oldIndex,
int newIndex)
oldIndex was not a successor.oldIndex - index of old successor blocknewIndex - index of new successor blockpublic void removeSuccessor(int oldIndex)
oldIndex - index of successor block to removepublic void exitBlockFixup(SsaBasicBlock exitBlock)
SsaMethod.makeExitBlock()exitBlock - non-null; exit blockpublic void addMoveToEnd(RegisterSpec result, RegisterSpec source)
result - move destinationsource - move sourcepublic void addMoveToBeginning(RegisterSpec result, RegisterSpec source)
result - move destinationsource - move sourcepublic void addLiveOut(int regV)
regV to the live-out list for this block. This is called
by the liveness analyzer.regV - register that is live-out for this block.public void addLiveIn(int regV)
regV to the live-in list for this block. This is
called by the liveness analyzer.regV - register that is live-in for this block.public IntSet getLiveInRegs()
non-null; live-in register set.public IntSet getLiveOutRegs()
non-null; live-out register setpublic boolean isExitBlock()
public void scheduleMovesFromPhis()
addMoveToEnd during
phi removal so that results don't overwrite sources that are used.
For use after all phis have been removed and all calls to
addMoveToEnd() have been made.This is necessary because copy-propogation may have left us in a state where the same basic block has the same register as a phi operand and a result. In this case, the register in the phi operand always refers value before any other phis have executed.
public void forEachInsn(SsaInsn.Visitor visitor)
visitor - non-null; callback interfacepublic java.lang.String toString()
toString in class java.lang.ObjectCopyright © 2020. All Rights Reserved.