com.android.dx.ssa
Class LocalVariableInfo

java.lang.Object
  extended by com.android.dx.util.MutabilityControl
      extended by com.android.dx.ssa.LocalVariableInfo

public class LocalVariableInfo
extends MutabilityControl

Container for local variable information for a particular SsaMethod. Stolen from LocalVariableInfo.


Constructor Summary
LocalVariableInfo(SsaMethod method)
          Constructs an instance.
 
Method Summary
 void addAssignment(SsaInsn insn, RegisterSpec spec)
          Adds an assignment association for the given instruction and register spec.
 void debugDump()
           
 RegisterSpec getAssignment(SsaInsn insn)
          Gets the named register being assigned by the given instruction, if previously stored in this instance.
 int getAssignmentCount()
          Gets the number of assignments recorded by this instance.
 RegisterSpecSet getStarts(int index)
          Gets the register set associated with the start of the block with the given index.
 RegisterSpecSet getStarts(SsaBasicBlock block)
          Gets the register set associated with the start of the given block.
 boolean mergeStarts(int index, RegisterSpecSet specs)
          Merges the given register set into the set for the block with the given index.
 RegisterSpecSet mutableCopyOfStarts(int index)
          Gets a mutable copy of the register set associated with the start of the block with the given index.
 void setStarts(int index, RegisterSpecSet specs)
          Sets the register set associated with the start of the block with the given index.
 
Methods inherited from class com.android.dx.util.MutabilityControl
isImmutable, isMutable, setImmutable, throwIfImmutable, throwIfMutable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalVariableInfo

public LocalVariableInfo(SsaMethod method)
Constructs an instance.

Parameters:
method - non-null; the method being represented by this instance
Method Detail

setStarts

public void setStarts(int index,
                      RegisterSpecSet specs)
Sets the register set associated with the start of the block with the given index.

Parameters:
index - >= 0; the block index
specs - non-null; the register set to associate with the block

mergeStarts

public boolean mergeStarts(int index,
                           RegisterSpecSet specs)
Merges the given register set into the set for the block with the given index. If there was not already an associated set, then this is the same as calling setStarts(int, com.android.dx.rop.code.RegisterSpecSet). Otherwise, this will merge the two sets and call setStarts(int, com.android.dx.rop.code.RegisterSpecSet) on the result of the merge.

Parameters:
index - >= 0; the block index
specs - non-null; the register set to merge into the start set for the block
Returns:
true if the merge resulted in an actual change to the associated set (including storing one for the first time) or false if there was no change

getStarts

public RegisterSpecSet getStarts(int index)
Gets the register set associated with the start of the block with the given index. This returns an empty set with the appropriate max size if no set was associated with the block in question.

Parameters:
index - >= 0; the block index
Returns:
non-null; the associated register set

getStarts

public RegisterSpecSet getStarts(SsaBasicBlock block)
Gets the register set associated with the start of the given block. This is just convenient shorthand for getStarts(block.getLabel()).

Parameters:
block - non-null; the block in question
Returns:
non-null; the associated register set

mutableCopyOfStarts

public RegisterSpecSet mutableCopyOfStarts(int index)
Gets a mutable copy of the register set associated with the start of the block with the given index. This returns a newly-allocated empty RegisterSpecSet of appropriate max size if there is not yet any set associated with the block.

Parameters:
index - >= 0; the block index
Returns:
non-null; the associated register set

addAssignment

public void addAssignment(SsaInsn insn,
                          RegisterSpec spec)
Adds an assignment association for the given instruction and register spec. This throws an exception if the instruction doesn't actually perform a named variable assignment. Note: Although the instruction contains its own spec for the result, it still needs to be passed in explicitly to this method, since the spec that is stored here should always have a simple type and the one in the instruction can be an arbitrary TypeBearer (such as a constant value).

Parameters:
insn - non-null; the instruction in question
spec - non-null; the associated register spec

getAssignment

public RegisterSpec getAssignment(SsaInsn insn)
Gets the named register being assigned by the given instruction, if previously stored in this instance.

Parameters:
insn - non-null; instruction in question
Returns:
null-ok; the named register being assigned, if any

getAssignmentCount

public int getAssignmentCount()
Gets the number of assignments recorded by this instance.

Returns:
>= 0; the number of assignments

debugDump

public void debugDump()


Copyright © 2013. All Rights Reserved.