coins.sym
Class VarImpl
java.lang.Object
coins.sym.SymImpl
coins.sym.VarImpl
- All Implemented Interfaces:
- java.lang.Cloneable, FlowAnalSym, HasStringObject, Sym, Sym0, Var
- Direct Known Subclasses:
- ElemImpl, ParamImpl
- public class VarImpl
- extends SymImpl
- implements Var, FlowAnalSym
VarImpl Class represents Variable symbols.
Sym --- Symbol class (super class of all symbol classes).
|
|- OperandSym
| |
| |- Var --- Variable that can be assigned a value <---- This!
| | | and variable with const attribute.
| | |- Param --- Formal parameter class.
| | |- Elem --- Class for structure element,
| | union element, etc.
|
Field Summary |
protected IrList |
fDefList
Definition list containing IR nodes that define the
value of this symbol. |
protected DefUseList |
fDefUseList
Definition point and using points of this variable |
protected int |
fIndex
|
protected java.util.Set |
fOperandSet
|
protected IrList |
fUseList
Use list containing IR nodes that use (refer) this symbol. |
| Fields inherited from class coins.sym.SymImpl |
fDbgLevel, fDefinedIn, fFlagBox, fKind, fName, fNextSym, fRecordedIn, fSourceInf, fSymInf, fType, fUniqueNameSym, fWork, machineParam, sourceLanguage, symRoot |
| Fields inherited from interface coins.sym.Sym0 |
FLAG_ADDRESS_TAKEN, FLAG_CASTLESS_SUBP, FLAG_COMMON, FLAG_COMPLEX_STRUCT, FLAG_DERIVED_SYM, FLAG_GENERATED_SYM, FLAG_INCOMPLETE_TYPE, FLAG_POINTER_OPERATION, FLAG_REGION_ELEM, FLAG_RESERVED_NAME, FLAG_SIZEOF_TAKEN, FLAG_UNFIXED_SIZE, FLAG_UNIFORM_SIZE, FLAG_VALUE_IS_ASSIGNED, KIND_AREG, KIND_BOOL_CONST, KIND_CHAR_CONST, KIND_CONST_FIRST, KIND_CONST_LAST, KIND_ELEM, KIND_EXP_ID, KIND_FLOAT_CONST, KIND_INT_CONST, KIND_LABEL, KIND_MREG, KIND_NAMED_CONST, KIND_OTHER, KIND_PARAM, KIND_REMOVED, KIND_STRING_CONST, KIND_SUBP, KIND_TAG, KIND_TYPE, KIND_VAR, SYM_COMPILE_UNIT, SYM_EXTERN, SYM_PRIVATE, SYM_PROTECTED, SYM_PUBLIC |
|
Method Summary |
void |
addOperand(FlowAnalSym pOperand)
|
java.lang.Object |
evaluateAsObject()
Get the value of this constant symbol. |
int |
getDimension()
getDimension
Get the dimension of this variable. |
int |
getIndex()
getDefUseList
Get DefUseList (list of definition points and use points) of this variable. |
Exp |
getInitialValue()
getInitialValue
Get the expression of initial value for this variable. |
Var |
getNext()
getNext
Get the next variable having the same scope and the same kind. |
java.util.Set |
getOperandSet()
getOperandSet
Get the set of operands used in computing the value
of this abstract register. |
long |
getSize()
getSize
Get the size of this variable in byte if it is evaluable. |
int |
getStorageClass()
getStrageClass
Get the storage class of the variable. |
int |
getVisibility()
getVisibility
Get the visibility attribute of the variable. |
boolean |
isSizeEvaluable()
isSizeEvaluable
Check this variable is evaluable or not.. |
void |
resetFlowAnalInf()
resetFlowAnalInf
Reset information for flow analysis, that is,
nullify DefUseList, definition list, use list, ExpId,
and reset the index value to 0. |
void |
setIndex(int pIndex)
setIndex
Set the index number assigned to the symbol. |
void |
setInitialValue(Exp pInitialValue)
setInitialValue
Set the expression of initial value for this variable. |
void |
setNext(Var pNext)
setNext
Set the variable specified by parameter as the one next to this symbol,
and make the original next variable of this symbol as the one
next to pNext (that is, insert pNext after this symbol). |
void |
setStorageClass(int pStorageClass)
setStrageClass
Set the storage class of the variable. |
void |
setVisibility(int pVisibility)
setVisibility
Set the visibility attribute of the variable. |
java.lang.String |
toStringDetail()
toStringDetail
Get detailed attributes of this symbol in text which is not
interned. |
| Methods inherited from class coins.sym.SymImpl |
bareStringConst, baseType, boolConst, charConst, charConst, charConst, definedType, definedType, defineElem, defineLabel, defineParam, defineRegionVar, defineSubp, defineVar, defineVar, derivedSym, enumType, enumType, floatConst, floatConst, getDefinedColumn, getDefinedFile, getDefinedIn, getDefinedInName, getDefinedLine, getFlag, getInf, getName, getNameOrNull, getNextSym, getOrAddInf, getOriginalSym, getOriginalSym, getPureName, getRecordedIn, getSourceInf, getSymKind, getSymKindName, getSymType, getUniqueName, getWork, intConst, intConst, intObject, isGlobal, isHIR, isRemoved, isSym, linkSym, makeCstring, makeCstringWithTrailing0, makeEnumTypeName, makeExpString, makeJavaString, makeStructUnionTypeName, makeSubpTypeName, makeSubpTypeName, makeVectorTypeName, makeVectorTypeName, makeVectorTypeName, namedConst, namedConst, pointerType, pointerType, pointerType, pointerType, pointerType, print, print, regionType, regionType, remove, setDefinedFile, setDefinedIn, setDefinedLine, setFlag, setOriginalSym, setParameters, setRecordedIn, setSourceInf, setSymKind, setSymType, setUniqueNameSym, setWork, stringConst, stringConstFromQuotedString, structType, structType, subpType, subpType, symbol, toString, toStringShort, unionType, unionType, vectorType, vectorType, vectorType, vectorType, vectorTypeUnfixed, vectorTypeUnfixed |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface coins.sym.Sym |
baseType, boolConst, charConst, defineVar, derivedSym, floatConst, getDefinedColumn, getDefinedInName, getDefinedLine, getInf, getNameOrNull, getOrAddInf, getOriginalSym, getOriginalSym, getPureName, getSymKindName, getWork, intConst, intObject, isRemoved, makeCstring, makeCstringWithTrailing0, makeEnumTypeName, makeJavaString, makeStructUnionTypeName, makeSubpTypeName, makeVectorTypeName, makeVectorTypeName, makeVectorTypeName, namedConst, pointerType, pointerType, pointerType, regionType, remove, setDefinedFile, setDefinedIn, setDefinedLine, setRecordedIn, setSymKind, setSymType, setUniqueNameSym, setWork, stringConstFromQuotedString, symbol, toStringShort, vectorType, vectorType, vectorType, vectorTypeUnfixed |
| Methods inherited from interface coins.sym.Sym0 |
charConst, definedType, defineElem, defineLabel, defineParam, defineSubp, defineVar, enumType, floatConst, getDefinedFile, getDefinedIn, getFlag, getName, getNextSym, getRecordedIn, getSymKind, getSymType, getUniqueName, intConst, isGlobal, namedConst, pointerType, setFlag, stringConst, structType, subpType, unionType, vectorType, vectorTypeUnfixed |
fDefUseList
protected DefUseList fDefUseList
- Definition point and using points of this variable
fDefList
protected IrList fDefList
- Definition list containing IR nodes that define the
value of this symbol.
fUseList
protected IrList fUseList
- Use list containing IR nodes that use (refer) this symbol.
fIndex
protected int fIndex
fOperandSet
protected java.util.Set fOperandSet
VarImpl
public VarImpl(SymRoot pSymRoot)
VarImpl
public VarImpl(SymRoot pSymRoot,
java.lang.String pName)
getNext
public Var getNext()
- getNext
Get the next variable having the same scope and the same kind.
The order of symbols is the same as the order of creation by
defineUnique, define, redefine or setting by setNext.
"this" should be a variable.
- Specified by:
getNext in interface Var
- Returns:
- the variable next to this one in the same scope and the same
kind, e.g. the next local variable in the same construct,
the next formal parameter of the same subprogram,
the next element of the same structure,
the next field of the same class, etc.
return null if this is the last one in the same construct.
setNext
public void setNext(Var pNext)
- setNext
Set the variable specified by parameter as the one next to this symbol,
and make the original next variable of this symbol as the one
next to pNext (that is, insert pNext after this symbol).
(Default ordering is the order of creation by DefineUnique, Define,
Redefine.)
"this" is a variable.
- Specified by:
setNext in interface Var
- Parameters:
pNext - variable to be set as the next one. It should be defined
in the same construct as this variable.
getSize
public long getSize()
- getSize
Get the size of this variable in byte if it is evaluable.
"this" may be any variable.
- Specified by:
getSize in interface Var
- Returns:
- the size of the type of this variable if
it is evaluable. If it is not evaluable, return 0.
isSizeEvaluable
public boolean isSizeEvaluable()
- isSizeEvaluable
Check this variable is evaluable or not..
- Specified by:
isSizeEvaluable in interface Var
- Returns:
- boolean the size of the type of this variable is evaluable true
false otherwise.
getDimension
public int getDimension()
- getDimension
Get the dimension of this variable.
"this" is a variable.
- Specified by:
getDimension in interface Var
- Returns:
- the dimension of this variable if this is an array variable.
1: 1-dimensinal array, 2: 2-dimensional array, ,,, .
If this is not array variable, return 0.
getInitialValue
public Exp getInitialValue()
- getInitialValue
Get the expression of initial value for this variable.
"this" may be any variable that may have initial value.
- Specified by:
getInitialValue in interface Var
- Returns:
- Exp initial value expression subtree
If no initial value null.
setInitialValue
public void setInitialValue(Exp pInitialValue)
- setInitialValue
Set the expression of initial value for this variable.
"this" may be any variable that may have initial value.
- Specified by:
setInitialValue in interface Var
- Parameters:
pInitialValue - initial value expression subtree.
Set initial value expression for this variable.
getStorageClass
public int getStorageClass()
- getStrageClass
Get the storage class of the variable.
"this" may be any variable.
- Specified by:
getStorageClass in interface Var
- Returns:
- int the storage class of the variable
setStorageClass
public void setStorageClass(int pStorageClass)
- setStrageClass
Set the storage class of the variable.
"this" may be any variable.
- Specified by:
setStorageClass in interface Var
- Parameters:
pStorageClass - storage class to be set to this variable
getVisibility
public int getVisibility()
- getVisibility
Get the visibility attribute of the variable.
(SYM_EXTERN, SYM_PUBLIC, SYM_PROTECTED, SYM_PRIVATE,
SYM_COMPILE_UNIT).
- Specified by:
getVisibility in interface Var
- Returns:
- the visibility attribute.
setVisibility
public void setVisibility(int pVisibility)
- setVisibility
Set the visibility attribute of the variable.
"this" may be any variable.
- Specified by:
setVisibility in interface Var
- Parameters:
pVisibility - visibility attribute to be set by setVisibility.
(SYM_EXTERN, SYM_PUBLIC, SYM_PROTECTED, SYM_PRIVATE,
SYM_COMPILE_UNIT).
getIndex
public int getIndex()
- getDefUseList
Get DefUseList (list of definition points and use points) of this variable.
"this" is a variable.
- Specified by:
getIndex in interface FlowAnalSym
- Returns:
- the DefUseList of this variable if it is computed.
If it is not computed, return null.
Note symRoot.flow should be set before call by FlowRoot.
setIndex
public void setIndex(int pIndex)
- Description copied from interface:
FlowAnalSym
- setIndex
Set the index number assigned to the symbol.
The index number is used in data flow analysis, etc.
For ExpId, do not use setIndex but use setLinkedNode.
- Specified by:
setIndex in interface FlowAnalSym
- Parameters:
pIndex - index number to be set to this symbol.
resetFlowAnalInf
public void resetFlowAnalInf()
- Description copied from interface:
FlowAnalSym
- resetFlowAnalInf
Reset information for flow analysis, that is,
nullify DefUseList, definition list, use list, ExpId,
and reset the index value to 0.
- Specified by:
resetFlowAnalInf in interface FlowAnalSym
getOperandSet
public java.util.Set getOperandSet()
- Description copied from interface:
FlowAnalSym
- getOperandSet
Get the set of operands used in computing the value
of this abstract register. The operands are either
Var or Reg, excluding Const (Const is not FlowAnalSym).
- Specified by:
getOperandSet in interface FlowAnalSym
- Returns:
- the set of operands.
addOperand
public void addOperand(FlowAnalSym pOperand)
toStringDetail
public java.lang.String toStringDetail()
- Description copied from interface:
Sym
- toStringDetail
Get detailed attributes of this symbol in text which is not
interned.
- Specified by:
toStringDetail in interface Sym- Overrides:
toStringDetail in class SymImpl
evaluateAsObject
public java.lang.Object evaluateAsObject()
- Get the value of this constant symbol.
This method is overrided as follows
class returned value
IntConst Long
FloatConst Double
StringConst String
Var Initail value (ExpListExp, etc.) if qualified by const,
else null.
- Specified by:
evaluateAsObject in interface Var
- Returns:
- the constant value of appropriate type.