|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.android.dx.ssa.SsaBasicBlock
public final class SsaBasicBlock
An SSA representation of a basic block.
| Nested Class Summary | |
|---|---|
static class |
SsaBasicBlock.LabelComparator
Label comparator. |
static interface |
SsaBasicBlock.Visitor
Visitor interface for basic blocks. |
| Field Summary | |
|---|---|
static Comparator<SsaBasicBlock> |
LABEL_COMPARATOR
non-null; comparator for instances of this class that
just compares block labels |
| Constructor Summary | |
|---|---|
SsaBasicBlock(int basicBlockIndex,
int ropLabel,
SsaMethod parent)
Creates a new empty basic block. |
|
| Method Summary | |
|---|---|
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. |
ArrayList<SsaBasicBlock> |
getDomChildren()
Gets the dom children for this node. |
int |
getIndex()
|
ArrayList<SsaInsn> |
getInsns()
|
IntSet |
getLiveInRegs()
Returns the set of live-in registers. |
IntSet |
getLiveOutRegs()
Returns the set of live-out registers. |
SsaMethod |
getParent()
|
List<SsaInsn> |
getPhiInsns()
|
BitSet |
getPredecessors()
|
SsaBasicBlock |
getPrimarySuccessor()
|
int |
getPrimarySuccessorIndex()
|
int |
getPrimarySuccessorRopLabel()
|
int |
getRopLabel()
|
String |
getRopLabelString()
|
IntList |
getRopLabelSuccessorList()
|
IntList |
getSuccessorList()
|
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()
|
boolean |
isReachable()
Returns true if this block was last calculated to be reachable. |
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. |
void |
setReachable(int reach)
Sets reachability of block to specified value |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final Comparator<SsaBasicBlock> LABEL_COMPARATOR
non-null; comparator for instances of this class that
just compares block labels
| Constructor Detail |
|---|
public SsaBasicBlock(int basicBlockIndex,
int ropLabel,
SsaMethod parent)
basicBlockIndex - index this block will haveropLabel - original rop-form labelparent - method of this block| Method Detail |
|---|
public 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
updated
public void addDomChild(SsaBasicBlock child)
child - non-null; new dom childpublic 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 ArrayList<SsaInsn> getInsns()
non-null; the (mutable) instruction list for this block,
with phi insns at the beginningpublic List<SsaInsn> getPhiInsns()
non-null; the (mutable) list of phi insns for this blockpublic int getIndex()
public int getRopLabel()
public String getRopLabelString()
public BitSet getPredecessors()
non-null; predecessors set, indexed by block indexpublic 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 instance
public 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 block
public void addMoveToEnd(RegisterSpec result,
RegisterSpec source)
result - move destinationsource - move source
public 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 boolean isReachable()
true if reachablepublic void setReachable(int reach)
reach - new value of reachability for blockpublic 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 String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||