Package com.tonic.analysis.ssa.value
Class SSAValue
- java.lang.Object
-
- com.tonic.analysis.ssa.value.SSAValue
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddUse(IRInstruction instruction)Adds a use of this value by an instruction.booleanequals(Object o)Identity byid.IRInstructiongetDefinition()intgetId()StringgetName()IRTypegetType()Gets the IR type of this value.intgetUseCount()Gets the number of uses of this value.List<IRInstruction>getUses()inthashCode()booleanhasUses()Checks if this value has any uses.booleanisConstant()Checks if this value is a constant.voidremoveUse(IRInstruction instruction)Removes a use of this value by an instruction.voidreplaceAllUsesWith(Value newValue)Replaces all uses of this value with a new value.static voidresetIdCounter()Resets the ID counter for SSA values.voidsetDefinition(IRInstruction definition)Records the instruction that produces this value.voidsetName(String name)Renames this value.StringtoString()-
Methods inherited from interface com.tonic.analysis.ssa.value.Value
isNull, isSSAValue
-
-
-
-
Constructor Detail
-
SSAValue
public SSAValue(IRType type)
Creates an SSA value with the given type.- Parameters:
type- the IR type of this value
-
-
Method Detail
-
getId
public int getId()
- Returns:
- the id
-
getType
public IRType getType()
Description copied from interface:ValueGets the IR type of this value.
-
getName
public String getName()
- Returns:
- the name
-
setName
public void setName(String name)
Renames this value.- Parameters:
name- the new name
-
getDefinition
public IRInstruction getDefinition()
- Returns:
- the definition
-
setDefinition
public void setDefinition(IRInstruction definition)
Records the instruction that produces this value.- Parameters:
definition- the defining instruction
-
getUses
public List<IRInstruction> getUses()
- Returns:
- the uses
-
isConstant
public boolean isConstant()
Description copied from interface:ValueChecks if this value is a constant.- Specified by:
isConstantin interfaceValue- Returns:
- true if constant, false otherwise
-
addUse
public void addUse(IRInstruction instruction)
Adds a use of this value by an instruction.- Parameters:
instruction- the instruction using this value
-
removeUse
public void removeUse(IRInstruction instruction)
Removes a use of this value by an instruction.- Parameters:
instruction- the instruction to remove
-
hasUses
public boolean hasUses()
Checks if this value has any uses.- Returns:
- true if there are uses, false otherwise
-
getUseCount
public int getUseCount()
Gets the number of uses of this value.- Returns:
- the use count
-
replaceAllUsesWith
public void replaceAllUsesWith(Value newValue)
Replaces all uses of this value with a new value.- Parameters:
newValue- the value to replace with
-
resetIdCounter
public static void resetIdCounter()
Resets the ID counter for SSA values.
-
-