Package com.android.dx.ssa
Class SsaInsn
java.lang.Object
com.android.dx.ssa.SsaInsn
- Direct Known Subclasses:
NormalSsaInsn
,PhiInsn
An instruction in SSA form
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Visitor interface for this class. -
Constructor Summary
ModifierConstructorDescriptionprotected
SsaInsn
(RegisterSpec result, SsaBasicBlock block) Constructs an instance. -
Method Summary
Modifier and TypeMethodDescriptionabstract void
Accepts a visitor.abstract boolean
canThrow()
void
changeResultReg
(int reg) Changes the result register if this insn has a result.clone()
getBlock()
Gets the block to which this insn instance belongs.Gets the spec of a local variable assignment that occurs at this instruction, or null if no local variable assignment occurs.abstract Rop
Returns the Rop opcode for this insn, or null if this is a phi insn.abstract Insn
Returns the original Rop insn for this insn, or null if this is a phi insn.LikegetResult()
.abstract RegisterSpecList
LikegetSources()
.abstract boolean
Returns true if this insn is considered to have a side effect beyond that of assigning to the result reg.boolean
boolean
abstract boolean
boolean
isRegASource
(int reg) Indicates whether the specified register is amongst the registers used as sources for this instruction.boolean
isResultReg
(int reg) Returns whether or not the specified reg is the result reg.static SsaInsn
makeFromRop
(Insn insn, SsaBasicBlock block) Makes a new SSA insn form a rop insn.final void
mapRegisters
(RegisterMapper mapper) Map registers after register allocation.abstract void
mapSourceRegisters
(RegisterMapper mapper) Maps only source registers.protected void
setResult
(RegisterSpec result) Set the result register.final void
setResultLocal
(LocalItem local) Sets the local association for the result of this insn.abstract Insn
Transform back to ROP form.
-
Constructor Details
-
SsaInsn
Constructs an instance.- Parameters:
result
-null-ok;
initial result register. May be changed.block
-non-null;
block containing this insn. Can never change.
-
-
Method Details
-
makeFromRop
Makes a new SSA insn form a rop insn.- Parameters:
insn
-non-null;
rop insnblock
-non-null;
owning block- Returns:
non-null;
an appropriately constructed instance
-
clone
-
getResult
LikegetResult()
.- Returns:
- result register
-
setResult
Set the result register.- Parameters:
result
-non-null;
the new result register
-
getSources
LikegetSources()
.- Returns:
non-null;
sources list
-
getBlock
Gets the block to which this insn instance belongs.- Returns:
- owning block
-
isResultReg
public boolean isResultReg(int reg) Returns whether or not the specified reg is the result reg.- Parameters:
reg
- register to test- Returns:
- true if there is a result and it is stored in the specified register
-
changeResultReg
public void changeResultReg(int reg) Changes the result register if this insn has a result. This is used during renaming.- Parameters:
reg
- new result register
-
setResultLocal
Sets the local association for the result of this insn. This is sometimes updated during the SsaRenamer process.- Parameters:
local
-null-ok;
new debug/local variable info
-
mapRegisters
Map registers after register allocation.- Parameters:
mapper
-non-null;
mapping from old to new registers
-
mapSourceRegisters
Maps only source registers.- Parameters:
mapper
- new mapping
-
getOpcode
Returns the Rop opcode for this insn, or null if this is a phi insn. TODO: Move this up into NormalSsaInsn.- Returns:
null-ok;
Rop opcode if there is one.
-
getOriginalRopInsn
Returns the original Rop insn for this insn, or null if this is a phi insn. TODO: Move this up into NormalSsaInsn.- Returns:
null-ok;
Rop insn if there is one.
-
getLocalAssignment
Gets the spec of a local variable assignment that occurs at this instruction, or null if no local variable assignment occurs. This may be the result register, or formark-local
insns it may be the source.- Returns:
null-ok;
a local-associated register spec or null- See Also:
-
isRegASource
public boolean isRegASource(int reg) Indicates whether the specified register is amongst the registers used as sources for this instruction.- Parameters:
reg
- the register in question- Returns:
- true if the reg is a source
-
toRopInsn
Transform back to ROP form. TODO: Move this up into NormalSsaInsn.- Returns:
non-null;
a ROP representation of this instruction, with updated registers.
-
isPhiOrMove
public abstract boolean isPhiOrMove()- Returns:
- true if this is a PhiInsn or a normal move insn
-
hasSideEffect
public abstract boolean hasSideEffect()Returns true if this insn is considered to have a side effect beyond that of assigning to the result reg.- Returns:
- true if this insn is considered to have a side effect beyond that of assigning to the result reg.
-
isNormalMoveInsn
public boolean isNormalMoveInsn()- Returns:
- true if this is a move (but not a move-operand or move-exception) instruction
-
isMoveException
public boolean isMoveException()- Returns:
- true if this is a move-exception instruction. These instructions must immediately follow a preceeding invoke*
-
canThrow
public abstract boolean canThrow()- Returns:
- true if this instruction can throw.
-
accept
Accepts a visitor.- Parameters:
v
-non-null
the visitor
-