Class PhiInsn
java.lang.Object
com.android.dx.ssa.SsaInsn
com.android.dx.ssa.PhiInsn
A Phi instruction (magical post-control-flow-merge) instruction
in SSA form. Will be converted to moves in predecessor blocks before
conversion back to ROP form.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceVisitor interface for instances of this (outer) class. -
Constructor Summary
ConstructorsConstructorDescriptionPhiInsn(int resultReg, SsaBasicBlock block) Makes a phi insn with a void result type.PhiInsn(RegisterSpec resultReg, SsaBasicBlock block) Constructs a new phi insn with no operands. -
Method Summary
Modifier and TypeMethodDescriptionvoidAccepts a visitor.voidaddPhiOperand(RegisterSpec registerSpec, SsaBasicBlock predBlock) Adds an operand to this phi instruction.booleanbooleancanThrow()Always returns false forPhiInsns.voidchangeResultType(TypeBearer type, LocalItem local) Changes the result type.clone()Returns the Rop opcode for this insn, or null if this is a phi insn.Returns the original Rop insn for this insn, or null if this is a phi insn.intGets the original rop-form result reg.Gets sources.booleanReturns true if this insn is considered to have a side effect beyond that of assigning to the result reg.booleanbooleanisRegASource(int reg) Indicates whether the specified register is amongst the registers used as sources for this instruction.final voidmapSourceRegisters(RegisterMapper mapper) Maps only source registers.intpredBlockIndexForSourcesIndex(int sourcesIndex) Gets the index of the pred block associated with the RegisterSpec at the particular getSources() index.predBlocksForReg(int reg, SsaMethod ssaMeth) Returns the list of predecessor blocks associated with all operands that haveregas an operand register.voidremovePhiRegister(RegisterSpec registerSpec) Removes all operand uses of a register from this phi instruction.toHuman()Return the "human" string form of this instance.protected final StringtoHumanWithInline(String extra) Returns human-readable string for listing dumps.Always throws an exeption, since a phi insn may not be converted back to rop form.voidupdateSourcesToDefinitions(SsaMethod ssaMeth) Updates the TypeBearers of all the sources (phi operands) to be the current TypeBearer of the register-defining instruction's result.Methods inherited from class SsaInsn
changeResultReg, getBlock, getLocalAssignment, getResult, isMoveException, isNormalMoveInsn, isResultReg, makeFromRop, mapRegisters, setResult, setResultLocal
-
Constructor Details
-
PhiInsn
Constructs a new phi insn with no operands.- Parameters:
resultReg- the result reg for this phi insnblock- block containing this insn.
-
PhiInsn
Makes a phi insn with a void result type.- Parameters:
resultReg- the result register for this phi insn.block- block containing this insn.
-
-
Method Details
-
clone
-
updateSourcesToDefinitions
Updates the TypeBearers of all the sources (phi operands) to be the current TypeBearer of the register-defining instruction's result. This is used during phi-type resolution.Note that local association of operands are preserved in this step.
- Parameters:
ssaMeth- method that contains this insn
-
changeResultType
Changes the result type. Used during phi type resolution- Parameters:
type-non-null;new TypeBearerlocal-null-ok;new local info, if available
-
getRopResultReg
public int getRopResultReg()Gets the original rop-form result reg. This is useful during renaming.- Returns:
- the original rop-form result reg
-
addPhiOperand
Adds an operand to this phi instruction.- Parameters:
registerSpec- register spec, including type and reg of operandpredBlock- predecessor block to be associated with this operand
-
removePhiRegister
Removes all operand uses of a register from this phi instruction.- Parameters:
registerSpec- register spec, including type and reg of operand
-
predBlockIndexForSourcesIndex
public int predBlockIndexForSourcesIndex(int sourcesIndex) Gets the index of the pred block associated with the RegisterSpec at the particular getSources() index.- Parameters:
sourcesIndex- index of source in getSources()- Returns:
- block index
-
getOpcode
-
getOriginalRopInsn
Returns the original Rop insn for this insn, or null if this is a phi insn. TODO: Move this up into NormalSsaInsn. Always returns null forPhiInsns.- Specified by:
getOriginalRopInsnin classSsaInsn- Returns:
null-ok;Rop insn if there is one.
-
canThrow
-
getSources
Gets sources. Constructed lazily from phi operand data structures and then cached.- Specified by:
getSourcesin classSsaInsn- Returns:
non-null;sources list
-
isRegASource
public boolean isRegASource(int reg) Indicates whether the specified register is amongst the registers used as sources for this instruction.- Overrides:
isRegASourcein classSsaInsn- Parameters:
reg- the register in question- Returns:
- true if the reg is a source
-
areAllOperandsEqual
public boolean areAllOperandsEqual()- Returns:
- true if all operands use the same register
-
mapSourceRegisters
Maps only source registers.- Specified by:
mapSourceRegistersin classSsaInsn- Parameters:
mapper- new mapping
-
toRopInsn
-
predBlocksForReg
Returns the list of predecessor blocks associated with all operands that haveregas an operand register.- Parameters:
reg- register to look upssaMeth- method we're operating on- Returns:
- list of predecessor blocks, empty if none
-
isPhiOrMove
public boolean isPhiOrMove()- Specified by:
isPhiOrMovein classSsaInsn- Returns:
- true if this is a PhiInsn or a normal move insn
-
hasSideEffect
public boolean hasSideEffect()Returns true if this insn is considered to have a side effect beyond that of assigning to the result reg.- Specified by:
hasSideEffectin classSsaInsn- Returns:
- true if this insn is considered to have a side effect beyond that of assigning to the result reg.
-
accept
Accepts a visitor. -
toHuman
Return the "human" string form of this instance. This is generally less "debuggy" thantoString().- Returns:
non-null;the human string form
-
toHumanWithInline
-