FileDocCategorySizeDatePackage
SsaInsn.javaAPI DocAndroid 5.1 API8281Thu Mar 12 22:18:30 GMT 2015com.android.dx.ssa

SsaInsn

public abstract class SsaInsn extends Object implements com.android.dx.util.ToHuman, Cloneable
An instruction in SSA form

Fields Summary
private final SsaBasicBlock
block
{@code non-null;} the block that contains this instance
private com.android.dx.rop.code.RegisterSpec
result
{@code null-ok;} result register
Constructors Summary
protected SsaInsn(com.android.dx.rop.code.RegisterSpec result, SsaBasicBlock block)
Constructs an instance.

param
result {@code null-ok;} initial result register. May be changed.
param
block {@code non-null;} block containing this insn. Can never change.

        if (block == null) {
            throw new NullPointerException("block == null");
        }

        this.block = block;
        this.result = result;
    
Methods Summary
public abstract voidaccept(com.android.dx.ssa.SsaInsn$Visitor v)
Accepts a visitor.

param
v {@code non-null} the visitor

public abstract booleancanThrow()

return
true if this instruction can throw.

public voidchangeResultReg(int reg)
Changes the result register if this insn has a result. This is used during renaming.

param
reg new result register

        if (result != null) {
            result = result.withReg(reg);
        }
    
public com.android.dx.ssa.SsaInsnclone()
{@inheritDoc}

        try {
            return (SsaInsn)super.clone();
        } catch (CloneNotSupportedException ex) {
            throw new RuntimeException ("unexpected", ex);
        }
    
public SsaBasicBlockgetBlock()
Gets the block to which this insn instance belongs.

return
owning block

        return block;
    
public com.android.dx.rop.code.RegisterSpecgetLocalAssignment()
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 {@code mark-local} insns it may be the source.

see
com.android.dx.rop.code.Insn#getLocalAssignment()
return
{@code null-ok;} a local-associated register spec or null

        if (result != null && result.getLocalItem() != null) {
            return result;
        }

        return null;
    
public abstract com.android.dx.rop.code.RopgetOpcode()
Returns the Rop opcode for this insn, or null if this is a phi insn. TODO: Move this up into NormalSsaInsn.

return
{@code null-ok;} Rop opcode if there is one.

public abstract com.android.dx.rop.code.InsngetOriginalRopInsn()
Returns the original Rop insn for this insn, or null if this is a phi insn. TODO: Move this up into NormalSsaInsn.

return
{@code null-ok;} Rop insn if there is one.

public com.android.dx.rop.code.RegisterSpecgetResult()
Like {@link com.android.dx.rop.code.Insn getResult()}.

return
result register

        return result;
    
public abstract com.android.dx.rop.code.RegisterSpecListgetSources()
Like {@link com.android.dx.rop.code.Insn getSources()}.

return
{@code non-null;} sources list

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

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

public booleanisMoveException()

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

        return false;
    
public booleanisNormalMoveInsn()

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

        return false;
    
public abstract booleanisPhiOrMove()

return
true if this is a PhiInsn or a normal move insn

public booleanisRegASource(int reg)
Indicates whether the specified register is amongst the registers used as sources for this instruction.

param
reg the register in question
return
true if the reg is a source

        return null != getSources().specForRegister(reg);
    
public booleanisResultReg(int reg)
Returns whether or not the specified reg is the result reg.

param
reg register to test
return
true if there is a result and it is stored in the specified register

        return result != null && result.getReg() == reg;
    
public static com.android.dx.ssa.SsaInsnmakeFromRop(com.android.dx.rop.code.Insn insn, SsaBasicBlock block)
Makes a new SSA insn form a rop insn.

param
insn {@code non-null;} rop insn
param
block {@code non-null;} owning block
return
{@code non-null;} an appropriately constructed instance

        return new NormalSsaInsn(insn, block);
    
public final voidmapRegisters(RegisterMapper mapper)
Map registers after register allocation.

param
mapper {@code non-null;} mapping from old to new registers

        RegisterSpec oldResult = result;

        result = mapper.map(result);
        block.getParent().updateOneDefinition(this, oldResult);
        mapSourceRegisters(mapper);
    
public abstract voidmapSourceRegisters(RegisterMapper mapper)
Maps only source registers.

param
mapper new mapping

protected voidsetResult(com.android.dx.rop.code.RegisterSpec result)
Set the result register.

param
result {@code non-null;} the new result register

        if (result == null) {
            throw new NullPointerException("result == null");
        }

        this.result = result;
    
public final voidsetResultLocal(com.android.dx.rop.code.LocalItem local)
Sets the local association for the result of this insn. This is sometimes updated during the SsaRenamer process.

param
local {@code null-ok;} new debug/local variable info

        LocalItem oldItem = result.getLocalItem();

        if (local != oldItem && (local == null
                || !local.equals(result.getLocalItem()))) {
            result = RegisterSpec.makeLocalOptional(
                    result.getReg(), result.getType(), local);
        }
    
public abstract com.android.dx.rop.code.InsntoRopInsn()
Transform back to ROP form. TODO: Move this up into NormalSsaInsn.

return
{@code non-null;} a ROP representation of this instruction, with updated registers.