Top Description Inners Fields Constructors Methods
org.droidparts.dexmaker.dx.ssa

public abstract Class SsaInsn

extends Object
implements ToHuman, Cloneable
Class Inheritance
All Implemented Interfaces
java.lang.Cloneable, org.droidparts.dexmaker.dx.util.ToHuman
Known Direct Subclasses
org.droidparts.dexmaker.dx.ssa.NormalSsaInsn, org.droidparts.dexmaker.dx.ssa.PhiInsn
Imports
org.droidparts.dexmaker.dx.rop.code.*, org.droidparts.dexmaker.dx.util.ToHuman

An instruction in SSA form

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
SsaInsn.Visitor

Visitor interface for this class.

Field Summary

Modifier and TypeField and Description
private final SsaBasicBlock
block

non-null; the block that contains this instance

private RegisterSpec
result

null-ok; result register

Constructor Summary

AccessConstructor and Description
protected
SsaInsn(RegisterSpec
null-ok; initial result register. May be changed.
result
,
SsaBasicBlock
non-null; block containing this insn. Can never change.
block
)

Constructs an instance.

Method Summary

Modifier and TypeMethod and Description
public abstract void
accept(SsaInsn.Visitor
non-null the visitor
v
)

Accepts a visitor.

public abstract boolean

Returns:

true if this instruction can throw.
canThrow
()

public void
changeResultReg(int
new result register
reg
)

Changes the result register if this insn has a result.

public SsaInsn
clone()

Overrides java.lang.Object.clone.

Creates and returns a copy of this object.
public SsaBasicBlock

Returns:

owning block
getBlock
()

Gets the block to which this insn instance belongs.

public RegisterSpec

Returns:

null-ok; a local-associated register spec or null
getLocalAssignment
()

Gets the spec of a local variable assignment that occurs at this instruction, or null if no local variable assignment occurs.

public abstract Rop

Returns:

null-ok; Rop opcode if there is one.
getOpcode
()

Returns the Rop opcode for this insn, or null if this is a phi insn.

public abstract Insn

Returns:

null-ok; Rop insn if there is one.
getOriginalRopInsn
()

Returns the original Rop insn for this insn, or null if this is a phi insn.

public RegisterSpec

Returns:

result register
getResult
()

Like getResult().

public abstract RegisterSpecList

Returns:

non-null; sources list
getSources
()

Like getSources().

public abstract boolean

Returns:

true if this insn is considered to have a side effect beyond that of assigning to the result reg.
hasSideEffect
()

Returns true if this insn is considered to have a side effect beyond that of assigning to the result reg.

public boolean

Returns:

true if this is a move-exception instruction. These instructions must immediately follow a preceeding invoke*
isMoveException
()

public boolean

Returns:

true if this is a move (but not a move-operand or move-exception) instruction
isNormalMoveInsn
()

public abstract boolean

Returns:

true if this is a PhiInsn or a normal move insn
isPhiOrMove
()

public boolean

Returns:

true if the reg is a source
isRegASource
(int
the register in question
reg
)

Indicates whether the specified register is amongst the registers used as sources for this instruction.

public boolean

Returns:

true if there is a result and it is stored in the specified register
isResultReg
(int
register to test
reg
)

Returns whether or not the specified reg is the result reg.

public static SsaInsn

Returns:

non-null; an appropriately constructed instance
makeFromRop
(Insn
non-null; rop insn
insn
,
SsaBasicBlock
non-null; owning block
block
)

Makes a new SSA insn form a rop insn.

public final void
mapRegisters(RegisterMapper
non-null; mapping from old to new registers
mapper
)

Map registers after register allocation.

public abstract void
mapSourceRegisters(RegisterMapper
new mapping
mapper
)

Maps only source registers.

protected void
setResult(RegisterSpec
non-null; the new result register
result
)

Set the result register.

public final void
setResultLocal(LocalItem
null-ok; new debug/local variable info
local
)

Sets the local association for the result of this insn.

public abstract Insn

Returns:

non-null; a ROP representation of this instruction, with updated registers.
toRopInsn
()

Transform back to ROP form.

Inherited from java.lang.Object:
equalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

blockback to summary
private final SsaBasicBlock block

non-null; the block that contains this instance

resultback to summary
private RegisterSpec result

null-ok; result register

Constructor Detail

SsaInsnback to summary
protected SsaInsn(RegisterSpec result, SsaBasicBlock block)

Constructs an instance.

Parameters
result:RegisterSpec

null-ok; initial result register. May be changed.

block:SsaBasicBlock

non-null; block containing this insn. Can never change.

Method Detail

acceptback to summary
public abstract void accept(SsaInsn.Visitor v)

Accepts a visitor.

Parameters
v:SsaInsn.Visitor

non-null the visitor

canThrowback to summary
public abstract boolean canThrow()
Returns:boolean

true if this instruction can throw.

changeResultRegback to summary
public void changeResultReg(int reg)

Changes the result register if this insn has a result. This is used during renaming.

Parameters
reg:int

new result register

cloneback to summary
public SsaInsn clone()

Overrides java.lang.Object.clone.

Doc from java.lang.Object.clone.

Creates and returns a copy of this object. The precise meaning of "copy" may depend on the class of the object. The general intent is that, for any object x, the expression:

x.clone() != x
will be true, and that the expression:
x.clone().getClass() == x.getClass()
will be true, but these are not absolute requirements. While it is typically the case that:
x.clone().equals(x)
will be true, this is not an absolute requirement.

By convention, the returned object should be obtained by calling super.clone. If a class and all of its superclasses (except Object) obey this convention, it will be the case that x.clone().getClass() == x.getClass().

By convention, the object returned by this method should be independent of this object (which is being cloned). To achieve this independence, it may be necessary to modify one or more fields of the object returned by super.clone before returning it. Typically, this means copying any mutable objects that comprise the internal "deep structure" of the object being cloned and replacing the references to these objects with references to the copies. If a class contains only primitive fields or references to immutable objects, then it is usually the case that no fields in the object returned by super.clone need to be modified.

Returns:SsaInsn

a clone of this instance.

Annotations
@Override
getBlockback to summary
public SsaBasicBlock getBlock()

Gets the block to which this insn instance belongs.

Returns:SsaBasicBlock

owning block

getLocalAssignmentback to summary
public RegisterSpec 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 for mark-local insns it may be the source.

Returns:RegisterSpec

null-ok; a local-associated register spec or null

See Also
org.droidparts.dexmaker.dx.rop.code.Insn#getLocalAssignment()
getOpcodeback to summary
public abstract Rop getOpcode()

Returns the Rop opcode for this insn, or null if this is a phi insn.

Todo

Move this up into NormalSsaInsn.

Returns:Rop

null-ok; Rop opcode if there is one.

getOriginalRopInsnback to summary
public abstract Insn getOriginalRopInsn()

Returns the original Rop insn for this insn, or null if this is a phi insn.

Todo

Move this up into NormalSsaInsn.

Returns:Insn

null-ok; Rop insn if there is one.

getResultback to summary
public RegisterSpec getResult()

Like getResult().

Returns:RegisterSpec

result register

getSourcesback to summary
public abstract RegisterSpecList getSources()

Like getSources().

Returns:RegisterSpecList

non-null; sources list

hasSideEffectback to summary
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:boolean

true if this insn is considered to have a side effect beyond that of assigning to the result reg.

isMoveExceptionback to summary
public boolean isMoveException()
Returns:boolean

true if this is a move-exception instruction. These instructions must immediately follow a preceeding invoke*

isNormalMoveInsnback to summary
public boolean isNormalMoveInsn()
Returns:boolean

true if this is a move (but not a move-operand or move-exception) instruction

isPhiOrMoveback to summary
public abstract boolean isPhiOrMove()
Returns:boolean

true if this is a PhiInsn or a normal move insn

isRegASourceback to summary
public boolean isRegASource(int reg)

Indicates whether the specified register is amongst the registers used as sources for this instruction.

Parameters
reg:int

the register in question

Returns:boolean

true if the reg is a source

isResultRegback to summary
public boolean isResultReg(int reg)

Returns whether or not the specified reg is the result reg.

Parameters
reg:int

register to test

Returns:boolean

true if there is a result and it is stored in the specified register

makeFromRopback to summary
public static SsaInsn makeFromRop(Insn insn, SsaBasicBlock block)

Makes a new SSA insn form a rop insn.

Parameters
insn:Insn

non-null; rop insn

block:SsaBasicBlock

non-null; owning block

Returns:SsaInsn

non-null; an appropriately constructed instance

mapRegistersback to summary
public final void mapRegisters(RegisterMapper mapper)

Map registers after register allocation.

Parameters
mapper:RegisterMapper

non-null; mapping from old to new registers

mapSourceRegistersback to summary
public abstract void mapSourceRegisters(RegisterMapper mapper)

Maps only source registers.

Parameters
mapper:RegisterMapper

new mapping

setResultback to summary
protected void setResult(RegisterSpec result)

Set the result register.

Parameters
result:RegisterSpec

non-null; the new result register

setResultLocalback to summary
public final void setResultLocal(LocalItem local)

Sets the local association for the result of this insn. This is sometimes updated during the SsaRenamer process.

Parameters
local:LocalItem

null-ok; new debug/local variable info

toRopInsnback to summary
public abstract Insn toRopInsn()

Transform back to ROP form.

Todo

Move this up into NormalSsaInsn.

Returns:Insn

non-null; a ROP representation of this instruction, with updated registers.

org.droidparts.dexmaker.dx.ssa back to summary

public Interface SsaInsn.Visitor

Known Direct Implementers
org.droidparts.dexmaker.dx.ssa.SsaRenamer.BlockRenamer, org.droidparts.dexmaker.dx.ssa.DeadCodeRemover.NoSideEffectVisitor

Visitor interface for this class.

Method Summary

Modifier and TypeMethod and Description
public void
visitMoveInsn(NormalSsaInsn
non-null; the instruction to visit
insn
)

Any non-phi move instruction

public void
visitNonMoveInsn(NormalSsaInsn
non-null; the instruction to visit
insn
)

Any insn that isn't a move or a phi (which is also a move).

public void
visitPhiInsn(PhiInsn
non-null; the instruction to visit
insn
)

Any phi insn

Method Detail

visitMoveInsnback to summary
public void visitMoveInsn(NormalSsaInsn insn)

Any non-phi move instruction

Parameters
insn:NormalSsaInsn

non-null; the instruction to visit

visitNonMoveInsnback to summary
public void visitNonMoveInsn(NormalSsaInsn insn)

Any insn that isn't a move or a phi (which is also a move).

Parameters
insn:NormalSsaInsn

non-null; the instruction to visit

visitPhiInsnback to summary
public void visitPhiInsn(PhiInsn insn)

Any phi insn

Parameters
insn:PhiInsn

non-null; the instruction to visit