Class SsaMethod
java.lang.Object
com.android.dx.ssa.SsaMethod
A method in SSA form.
-
Method Summary
Modifier and TypeMethodDescriptionintblockIndexToRopLabel(int bi) intborrowSpareRegister(int category) Borrows a register to use as a temp.Computes reachability for all blocks in the method.voiddeleteInsns(Set<SsaInsn> deletedInsns) Deletes all insns in the set from this method.voidforEachBlockDepthFirst(boolean reverse, SsaBasicBlock.Visitor v) Walks the basic block tree in depth-first order, calling the visitor method once for every block.voidVisits blocks in dom-tree order, starting at the current node.voidforEachInsn(SsaInsn.Visitor visitor) Visits all insns in this method.voidVisits each phi insn in this methodgetDefinitionForRegister(int reg) Returns the insn that defines the given registerintintintintReturns a modifiable copy of the register use list.getUseListForRegister(int reg) Returns the list of all source uses (not results) for a register.static IntListindexListFromLabelList(BasicBlockList ropBlocks, IntList labelList) Builds an IntList of block indices from a basic block list and a list of labels taken from Rop form.booleanisRegALocal(RegisterSpec spec) Checks to see if the given SSA reg is ever associated with a local local variable.booleanisStatic()Returnstrueif this is a static method.Makes a new basic block for this method, which is empty besides a singleGOTO.intMakes a new SSA register.voidmapRegisters(RegisterMapper mapper) Remaps unversioned registers.static SsaMethodnewFromRopMethod(RopMethod ropMethod, int paramWidth, boolean isStatic) voidIndicates that the instruction list has changed or the SSA register count has increased, so that internal datastructures that rely on it should be rebuild.voidReturns all borrowed registers.voidSets "back-convert mode".
-
Method Details
-
newFromRopMethod
-
indexListFromLabelList
Builds an IntList of block indices from a basic block list and a list of labels taken from Rop form.- Parameters:
ropBlocks- Rop blockslabelList- list of rop block labels- Returns:
- IntList of block indices
-
makeNewGotoBlock
Makes a new basic block for this method, which is empty besides a singleGOTO. Successors and predecessors are not yet set.- Returns:
- new block
-
getEntryBlockIndex
public int getEntryBlockIndex()- Returns:
- block index of first execution block
-
getEntryBlock
- Returns:
- first execution block
-
getExitBlockIndex
public int getExitBlockIndex()- Returns:
- block index of exit block or
-1if there is none
-
getExitBlock
- Returns:
null-ok;block of exit block ornullif there is none
-
blockIndexToRopLabel
public int blockIndexToRopLabel(int bi) - Parameters:
bi- block index or-1for none- Returns:
- rop label or {code -1} if
biwas-1
-
getRegCount
public int getRegCount()- Returns:
- count of registers used in this method
-
getParamWidth
public int getParamWidth()- Returns:
- the total width, in register units, of the method's parameters
-
isStatic
public boolean isStatic()Returnstrueif this is a static method.- Returns:
trueif this is a static method
-
borrowSpareRegister
public int borrowSpareRegister(int category) Borrows a register to use as a temp. Used in the phi removal process. Call returnSpareRegisters() when done.- Parameters:
category- width (1 or 2) of the register- Returns:
- register number to use
-
returnSpareRegisters
public void returnSpareRegisters()Returns all borrowed registers. -
getBlocks
- Returns:
non-null;basic block list. Do not modify.
-
computeReachability
Computes reachability for all blocks in the method.- Returns:
- a BitSet of reachable blocks.
-
mapRegisters
Remaps unversioned registers.- Parameters:
mapper- maps old registers to new.
-
getDefinitionForRegister
Returns the insn that defines the given register- Parameters:
reg- register in question- Returns:
- insn (actual instance from code) that defined this reg or null if reg is not defined.
-
onInsnsChanged
public void onInsnsChanged()Indicates that the instruction list has changed or the SSA register count has increased, so that internal datastructures that rely on it should be rebuild. In general, the various other on* methods should be called in preference when changes occur if they are applicable. -
getUseListForRegister
-
getUseListCopy
-
isRegALocal
Checks to see if the given SSA reg is ever associated with a local local variable. Each SSA reg may be associated with at most one local var.- Parameters:
spec-non-null;ssa reg- Returns:
- true if reg is ever associated with a local
-
makeNewSsaReg
public int makeNewSsaReg()Makes a new SSA register. For use after renaming has completed.- Returns:
>=0;new SSA register.
-
forEachInsn
Visits all insns in this method.- Parameters:
visitor-non-null;callback interface
-
forEachPhiInsn
Visits each phi insn in this method- Parameters:
v-non-null;callback.
-
forEachBlockDepthFirst
Walks the basic block tree in depth-first order, calling the visitor method once for every block. This depth-first walk may be run forward from the method entry point or backwards from the method exit points.- Parameters:
reverse- true if this should walk backwards from the exit pointsv-non-null;callback interface.parentis set unless this is the root node
-
forEachBlockDepthFirstDom
Visits blocks in dom-tree order, starting at the current node. Theparentparameter of the Visitor.visitBlock callback is currently always set to null.- Parameters:
v-non-null;callback interface
-
deleteInsns
-
setBackMode
public void setBackMode()Sets "back-convert mode". Set during back-conversion when registers are about to be mapped into a non-SSA namespace. When true, use and def lists are unavailable.
-