com.android.dx.ssa
Class SsaInsn

java.lang.Object
  extended by com.android.dx.ssa.SsaInsn
All Implemented Interfaces:
ToHuman, Cloneable
Direct Known Subclasses:
NormalSsaInsn, PhiInsn

public abstract class SsaInsn
extends Object
implements ToHuman, Cloneable

An instruction in SSA form


Nested Class Summary
static interface SsaInsn.Visitor
          Visitor interface for this class.
 
Constructor Summary
protected SsaInsn(RegisterSpec result, SsaBasicBlock block)
          Constructs an instance.
 
Method Summary
abstract  void accept(SsaInsn.Visitor v)
          Accepts a visitor.
abstract  boolean canThrow()
           
 void changeResultReg(int reg)
          Changes the result register if this insn has a result.
 SsaInsn clone()
          
 SsaBasicBlock getBlock()
          Gets the block to which this insn instance belongs.
 RegisterSpec getLocalAssignment()
          Gets the spec of a local variable assignment that occurs at this instruction, or null if no local variable assignment occurs.
abstract  Rop getOpcode()
          Returns the Rop opcode for this insn, or null if this is a phi insn.
abstract  Insn getOriginalRopInsn()
          Returns the original Rop insn for this insn, or null if this is a phi insn.
 RegisterSpec getResult()
          Like getResult().
abstract  RegisterSpecList getSources()
          Like getSources().
abstract  boolean hasSideEffect()
          Returns true if this insn is considered to have a side effect beyond that of assigning to the result reg.
 boolean isMoveException()
           
 boolean isNormalMoveInsn()
           
abstract  boolean isPhiOrMove()
           
 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.
 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.
 void setResultLocal(LocalItem local)
          Sets the local association for the result of this insn.
abstract  Insn toRopInsn()
          Transform back to ROP form.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.android.dx.util.ToHuman
toHuman
 

Constructor Detail

SsaInsn

protected SsaInsn(RegisterSpec result,
                  SsaBasicBlock block)
Constructs an instance.

Parameters:
result - null-ok; initial result register. May be changed.
block - non-null; block containing this insn. Can never change.
Method Detail

makeFromRop

public static SsaInsn makeFromRop(Insn insn,
                                  SsaBasicBlock block)
Makes a new SSA insn form a rop insn.

Parameters:
insn - non-null; rop insn
block - non-null; owning block
Returns:
non-null; an appropriately constructed instance

clone

public SsaInsn clone()

Overrides:
clone in class Object

getResult

public RegisterSpec getResult()
Like getResult().

Returns:
result register

setResult

protected void setResult(RegisterSpec result)
Set the result register.

Parameters:
result - non-null; the new result register

getSources

public abstract RegisterSpecList getSources()
Like getSources().

Returns:
non-null; sources list

getBlock

public SsaBasicBlock 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

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 - null-ok; new debug/local variable info

mapRegisters

public final void mapRegisters(RegisterMapper mapper)
Map registers after register allocation.

Parameters:
mapper - non-null; mapping from old to new registers

mapSourceRegisters

public abstract void mapSourceRegisters(RegisterMapper mapper)
Maps only source registers.

Parameters:
mapper - new mapping

getOpcode

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:
null-ok; Rop opcode if there is one.

getOriginalRopInsn

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:
null-ok; Rop insn if there is one.

getLocalAssignment

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:
null-ok; a local-associated register spec or null
See Also:
Insn.getLocalAssignment()

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

public abstract Insn 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

public abstract void accept(SsaInsn.Visitor v)
Accepts a visitor.

Parameters:
v - non-null the visitor


Copyright © 2015. All rights reserved.