FileDocCategorySizeDatePackage
SsaInsn.javaAPI DocAndroid 1.5 API7192Wed May 06 22:41:02 BST 2009com.android.dx.ssa

SsaInsn

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

Fields Summary
protected RegisterSpec
result
protected final SsaBasicBlock
block
Constructors Summary
protected SsaInsn(SsaBasicBlock block)
Constructs an instance

param
block block containing this insn. Can never change.

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

param
v 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. 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 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 mark-local insns it may be the source.

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

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

        return null;
    
public abstract RopgetOpcode()
Returns the Rop opcode for this insn, or null if this is a phi insn TODO move this up into NormalSsaInsn

return
null-ok; Rop opcode if there is one.

public abstract InsngetOriginalRopInsn()
Returns the original Rop insn for this insn, or null if this is a phi insn. TODO move this up into NormalSsaInsn

return
null-ok; Rop insn if there is one.

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

return
result register

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

return
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)
is the specified reg 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(Insn insn, SsaBasicBlock block)
Makes a new SSA insn form a ROP insn

param
insn non-null; rop insn
param
block non-null; owning block
return
non-null; an appropriately constructed instance

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

param
mapper

        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

public final voidsetResultLocal(LocalItem local)
Sets the local association for the result of this insn. This is sometimes updated during the SsaRenamer process.

param
local 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 InsntoRopInsn()
Transform back to ROP form. TODO move this up into NormalSsaInsn

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