Class SymbolTable
java.lang.Object
com.ibm.wala.ssa.SymbolTable
- All Implemented Interfaces:
Cloneable
A symbol table which associates information with each variable (value number) in an SSA IR.
By convention, symbol numbers start at 1 ... the "this" parameter will be symbol number 1 in a virtual method.
This class is used heavily during SSA construction by SSABuilder
.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncopy()
void
ensureSymbol
(int i) ensure that the symbol table has allocated space for the particular value numberint
getConstant
(boolean b) int
getConstant
(double d) int
getConstant
(float f) int
getConstant
(int i) int
getConstant
(long l) int
getConstantValue
(int v) int
getDefaultValue
(int vn) double
getDoubleValue
(int v) float
getFloatValue
(int v) int
getIntValue
(int v) long
getLongValue
(int v) int
int
int
int
int
getParameter
(int i) Return the value number of the ith parameterint[]
getPhiValue
(int valueNumber) Return the PhiValue that is associated with a given value numbergetStringValue
(int v) getValue
(int valueNumber) getValueString
(int valueNumber) boolean
isBooleanConstant
(int v) boolean
isBooleanOrZeroOneConstant
(int v) boolean
isConstant
(int v) boolean
isDoubleConstant
(int v) boolean
isFalse
(int v) boolean
isFloatConstant
(int v) boolean
isIntegerConstant
(int v) boolean
isLongConstant
(int v) boolean
isNullConstant
(int v) boolean
isNumberConstant
(int v) boolean
isOne
(int v) boolean
isOneOrTrue
(int v) boolean
isParameter
(int valueNumber) boolean
isStringConstant
(int v) boolean
isTrue
(int v) boolean
isZero
(int v) boolean
isZeroOrFalse
(int v) int
newPhi
(int[] rhs) int
Method newSymbol.void
setConstantValue
(int vn, ConstantValue val) void
setDefaultValue
(int vn, Object defaultValue) Set the default value for a value number.
-
Constructor Details
-
SymbolTable
public SymbolTable(int numberOfParameters) - Parameters:
numberOfParameters
- in the IR .. should be ir.getNumberOfParameters()
-
-
Method Details
-
newSymbol
public int newSymbol()Method newSymbol.- Returns:
- int
-
setConstantValue
-
setDefaultValue
Set the default value for a value number. The notion of a default value is for use by languages that do not require variables to be defined before they are used. In this situation, SSA conversion can fail since it depends on the assumption that values are always defined when used. The default value is the constant to be used in cases when a given value is used without having been defined. Currently, this is used only by CAst front ends for languages with this "feature". -
getDefaultValue
public int getDefaultValue(int vn) -
getNullConstant
public int getNullConstant() -
getConstant
public int getConstant(boolean b) -
getConstant
public int getConstant(int i) -
getConstant
public int getConstant(long l) -
getConstant
public int getConstant(float f) -
getConstant
public int getConstant(double d) -
getOtherConstant
-
getConstant
-
getParameter
Return the value number of the ith parameterBy convention, for a non-static method, the 0th parameter is 'this'
- Throws:
IllegalArgumentException
-
ensureSymbol
public void ensureSymbol(int i) ensure that the symbol table has allocated space for the particular value number- Parameters:
i
- a value number
-
getValueString
-
isConstant
public boolean isConstant(int v) -
isZero
public boolean isZero(int v) -
isOne
public boolean isOne(int v) -
isTrue
public boolean isTrue(int v) -
isZeroOrFalse
public boolean isZeroOrFalse(int v) -
isOneOrTrue
public boolean isOneOrTrue(int v) -
isFalse
public boolean isFalse(int v) -
isBooleanOrZeroOneConstant
public boolean isBooleanOrZeroOneConstant(int v) -
isBooleanConstant
public boolean isBooleanConstant(int v) -
isIntegerConstant
public boolean isIntegerConstant(int v) -
isLongConstant
public boolean isLongConstant(int v) -
isFloatConstant
public boolean isFloatConstant(int v) -
isDoubleConstant
public boolean isDoubleConstant(int v) -
isNumberConstant
public boolean isNumberConstant(int v) -
isStringConstant
public boolean isStringConstant(int v) -
isNullConstant
public boolean isNullConstant(int v) -
newPhi
- Throws:
IllegalArgumentException
- if rhs is null
-
getPhiValue
Return the PhiValue that is associated with a given value number -
getMaxValueNumber
public int getMaxValueNumber() -
getParameterValueNumbers
public int[] getParameterValueNumbers() -
getNumberOfParameters
public int getNumberOfParameters() -
getStringValue
- Throws:
IllegalArgumentException
-
getFloatValue
- Throws:
IllegalArgumentException
-
getDoubleValue
- Throws:
IllegalArgumentException
-
getIntValue
- Throws:
IllegalArgumentException
-
getLongValue
- Throws:
IllegalArgumentException
-
getConstantValue
- Throws:
IllegalArgumentException
-
getValue
- Returns:
- the Value object for given value number or null if we have no special information about the value
-
isParameter
public boolean isParameter(int valueNumber) - Returns:
- true iff this valueNumber is a parameter
-
copy
-