public class SSAValueManager extends Object
Modifier and Type | Field and Description |
---|---|
String |
breadCrumb
User-Defined debugging info
|
Constructor and Description |
---|
SSAValueManager(ParameterAccessor acc) |
Modifier and Type | Method and Description |
---|---|
List<SSAValue> |
getAllForPhi(SSAValue.VariableKey key)
Returns all "free" and "allocated" variables and the invalid ones in a sub-scope.
|
SSAValue |
getCurrent(SSAValue.VariableKey key)
Retrieve the SSA-Number that is valid for a type in the current scope.
|
SSAValue |
getException()
Create new SSAValue with UniqueKey and Exception-Type.
|
SSAValue |
getFree(TypeReference type,
SSAValue.VariableKey key)
Returns and registers a free SSA-Number to a Type.
|
SSAValue |
getSuper(SSAValue.VariableKey key)
Retrieve the SSA-Number that is valid for a type in the super-ordinate scope.
|
SSAValue |
getUnallocated(TypeReference type,
SSAValue.VariableKey key)
Get an unused number to assign to.
|
SSAValue |
getUnmanaged(TypeReference type,
SSAValue.VariableKey key)
Retrieve a SSA-Value that is not under management.
|
SSAValue |
getUnmanaged(TypeReference type,
String name) |
void |
invalidate(SSAValue.VariableKey key)
Marks all known instances of VariableKey invalid.
|
boolean |
isSeen(SSAValue.VariableKey key)
Return if the type is managed by this class.
|
boolean |
isSeen(SSAValue.VariableKey key,
boolean withSuper)
Return if the type is managed by this class.
|
Map<Integer,Atom> |
makeLocalNames()
Collect the variable-names of all known variables.
|
boolean |
needsAllocation(SSAValue.VariableKey key)
Returns if an instance for that type needs to be allocated.
|
boolean |
needsPhi(SSAValue.VariableKey key)
Returns if a PhiInstruction (still) has to be added.
|
int |
scopeDown(boolean doesLoop)
Enter a subordinate scope.
|
int |
scopeUp()
Leave a subordinate scope.
|
void |
setAllocation(SSAValue value,
SSAInstruction setBy)
Register a variable _after_ allocation.
|
void |
setPhi(SSAValue value,
SSAInstruction setBy)
Register a Phi-Instruction _after_ added to the model.
|
String |
toString() |
public String breadCrumb
public SSAValueManager(ParameterAccessor acc)
public void setAllocation(SSAValue value, SSAInstruction setBy)
getUnallocated(com.ibm.wala.types.TypeReference, com.ibm.wala.util.ssa.SSAValue.VariableKey)
. Then
assign it a value. And at last call this function.
You can however directly call the function if the type has not been seen before.value
- an unallocated SSA-Variable to assign the allocation tosetBy
- The instruction that set the value (optional)IllegalStateException
- if you set more than one allocation for that type (TODO better check!)IllegalArgumentException
- if type is null or ssaValue is zero or negativepublic void setPhi(SSAValue value, SSAInstruction setBy)
type
- the type the Phi-Instruction setsssaValue
- the number the SSA-Instruction assigns tosetBy
- the Phi-Instruction itself - may be nullIllegalArgumentException
- if you assign to a number requested using
#getFree(TypeReference)
but types mismatch.IllegalStateException
- if you forgot to close some Phispublic SSAValue getFree(TypeReference type, SSAValue.VariableKey key)
IllegalArgumentException
- if type is nullpublic SSAValue getUnallocated(TypeReference type, SSAValue.VariableKey key)
IllegalStateException
- if there is already an unallocated variable of that typeIllegalArgumentException
- if type is nullpublic SSAValue getUnmanaged(TypeReference type, SSAValue.VariableKey key)
public SSAValue getUnmanaged(TypeReference type, String name)
public SSAValue getCurrent(SSAValue.VariableKey key)
IllegalStateException
- if no number is assignableIllegalArgumentException
- if type was not seen before or is nullpublic SSAValue getSuper(SSAValue.VariableKey key)
IllegalStateException
- if no number is assignableIllegalArgumentException
- if type was not seen before or is nullpublic List<SSAValue> getAllForPhi(SSAValue.VariableKey key)
IllegalArgumentException
- if type was not seen before or is nullpublic boolean isSeen(SSAValue.VariableKey key, boolean withSuper)
withSuper
- when true return true if a managed key may be cast to type,
when false type has to match exactlykey
- the type in questionIllegalArgumentException
- if key is nullpublic boolean isSeen(SSAValue.VariableKey key)
public boolean needsAllocation(SSAValue.VariableKey key)
IllegalArgumentException
- if type is nullpublic boolean needsPhi(SSAValue.VariableKey key)
IllegalArgumentException
- if type is null or has not been seen beforepublic void invalidate(SSAValue.VariableKey key)
key
- Which variables to invalidate.IllegalArgumentException
- if type was not seen before or is nullpublic int scopeDown(boolean doesLoop)
This function influences the placement of Phi-Functions. Thus if you don't change values you don't have to call it.
doesLoop
- set to true if the scope is introduced for a looppublic int scopeUp()
IllegalStateException
- if already at top levelpublic SSAValue getException()