coins.sym
Class VectorTypeImpl

java.lang.Object
  extended bycoins.sym.SymImpl
      extended bycoins.sym.TypeImpl
          extended bycoins.sym.VectorTypeImpl
All Implemented Interfaces:
java.lang.Cloneable, HasStringObject, Sym, Sym0, Type, VectorType

public class VectorTypeImpl
extends TypeImpl
implements VectorType


Field Summary
(package private)  int fAlignment
           
(package private)  int fDimension
           
(package private)  long fElemCount
           
(package private)  Exp fElemCountExp
           
(package private)  Type fElemType
           
(package private)  long fLowerBound
           
(package private)  Exp fLowerBoundExp
           
 
Fields inherited from class coins.sym.TypeImpl
fCompleteType, fConst, fOrigin, fRestrict, fTypeCore, fTypeKind, fVolatile
 
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.Type
KIND_ADDRESS, KIND_ALIGNMENT, KIND_BASE_LIM, KIND_BOOL, KIND_CHAR, KIND_DEFINED, KIND_DOUBLE, KIND_ENUM, KIND_FLOAT, KIND_FLOAT_LOWER_LIM, KIND_FLOAT_UPPER_LIM, KIND_INT, KIND_INT_UPPER_LIM, KIND_LONG, KIND_LONG_DOUBLE, KIND_LONG_LONG, KIND_OFFSET, KIND_POINTER, KIND_RANKS, KIND_REGION, KIND_SHORT, KIND_STRING, KIND_STRUCT, KIND_SUBP, KIND_U_CHAR, KIND_U_INT, KIND_U_LONG, KIND_U_LONG_LONG, KIND_U_SHORT, KIND_UNDEF, KIND_UNION, KIND_UNSIGNED_LOWER_LIM, KIND_VECTOR, KIND_VOID, KIND_WCHAR
 
Fields inherited from interface coins.sym.Sym
KIND_NAME, VISIBILITY
 
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_TAG, KIND_TYPE, KIND_VAR, SYM_COMPILE_UNIT, SYM_EXTERN, SYM_PRIVATE, SYM_PROTECTED, SYM_PUBLIC
 
Constructor Summary
VectorTypeImpl(SymRoot pSymRoot, java.lang.String pTypeName, Type pElemType, long pElemCount)
           
VectorTypeImpl(SymRoot pSymRoot, java.lang.String pTypeName, Type pElemType, long pElemCount, Exp pElemCountExp, long pLowerBound, Exp pLowerBoundExp)
          VectorTypeImpl General constructor of VectorTypeImpl.
VectorTypeImpl(SymRoot pSymRoot, Type pElemType, long pElemCount)
           
 
Method Summary
 int getAlignment()
          getAlignment Get alignment value for this type.
 int getDimension()
          getDimension Get the dimension of this type.
 long getElemCount()
          getElemCount Get the number of elements in the vector.
 Exp getElemCountExp()
          getElemCountExp Get the expression representing the number of elements in the vector.
 Type getElemType()
          getElemType
 long getLowerBound()
          getLowerBound
 Exp getLowerBoundExp()
          getLowerBoundExp
 boolean isCompatibleWith(Type pType)
          evaluateElemCount Get the characteristics of "this" array type.
 boolean isRectangularArray()
          isRectangularArray
 void setAlignment(int pAlignment)
          setAlignment Set alignment value to be equal to the pAlignment which should be greater or equal to the alignment of element type.
protected  void setVectorTypeFields(java.lang.String pTypeName, Type pElemType, long pElemCount, Exp pElemCountExp, long pLowerBound, Exp pLowerBoundExp)
           
 java.lang.String toString()
          Get the string image of object.
 java.lang.String toStringDetail()
          toStringDetail Get detailed attributes of this symbol in text which is not interned.
 
Methods inherited from class coins.sym.TypeImpl
getAlignmentGap, getCompleteType, getElemList, getElemListString, getElemListString, getEnumListString, getFinalOrigin, getOrigin, getPointedType, getSizeExp, getSizeValue, getTypeKind, getTypeRank, getUnqualifiedType, isBasicType, isConst, isFloating, isInteger, isRestrict, isScalar, isSizeEvaluable, isUnsigned, isVolatile, makeConstType, makeRestrictType, makeVolatileType, searchTypeCompatibleWithThis, setOrigin, setSizeExp, setSizeValue, setStaticTable, toStringShort
 
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, 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.Type
getAlignmentGap, getCompleteType, getElemList, getElemListString, getFinalOrigin, getOrigin, getPointedType, getSizeExp, getSizeValue, getTypeKind, getTypeRank, getUnqualifiedType, isBasicType, isConst, isFloating, isInteger, isRestrict, isScalar, isSizeEvaluable, isUnsigned, isVolatile, makeConstType, makeRestrictType, makeVolatileType, setOrigin, setSizeExp, setSizeValue
 
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
 

Field Detail

fElemType

Type fElemType

fElemCount

long fElemCount

fElemCountExp

Exp fElemCountExp

fLowerBound

long fLowerBound

fLowerBoundExp

Exp fLowerBoundExp

fDimension

int fDimension

fAlignment

int fAlignment
Constructor Detail

VectorTypeImpl

public VectorTypeImpl(SymRoot pSymRoot,
                      java.lang.String pTypeName,
                      Type pElemType,
                      long pElemCount)

VectorTypeImpl

public VectorTypeImpl(SymRoot pSymRoot,
                      java.lang.String pTypeName,
                      Type pElemType,
                      long pElemCount,
                      Exp pElemCountExp,
                      long pLowerBound,
                      Exp pLowerBoundExp)
VectorTypeImpl General constructor of VectorTypeImpl. If pTypeName is null, the type name is generated. If pElemCountExp is evaluable then element count is decided by pElemCountExp else the element count is decided by pElemCount. If pLowerBoundExp is evaluable then lower bound is decided by pLowerBoundExp else the lower bound is decided by pLowerBound.


VectorTypeImpl

public VectorTypeImpl(SymRoot pSymRoot,
                      Type pElemType,
                      long pElemCount)
Method Detail

setVectorTypeFields

protected void setVectorTypeFields(java.lang.String pTypeName,
                                   Type pElemType,
                                   long pElemCount,
                                   Exp pElemCountExp,
                                   long pLowerBound,
                                   Exp pLowerBoundExp)

getDimension

public int getDimension()
Description copied from interface: Type
getDimension Get the dimension of this type. "this" is an array type.

Specified by:
getDimension in interface Type
Overrides:
getDimension in class TypeImpl
Returns:
the dimension of this type if this is an array type. 1: 1-dimensinal array, 2: 2-dimensional array, ,,, . If this is not an array type, return 0.

getElemType

public Type getElemType()
Description copied from interface: VectorType
getElemType

Specified by:
getElemType in interface VectorType
Returns:
the type of vector element.

getElemCount

public long getElemCount()
Description copied from interface: VectorType
getElemCount Get the number of elements in the vector. If the number is not yet fixed or it is given as expression containing variable, 0 will be returned.

Specified by:
getElemCount in interface VectorType
Returns:
the number of elements in the vector.

getElemCountExp

public Exp getElemCountExp()
Description copied from interface: VectorType
getElemCountExp Get the expression representing the number of elements in the vector. If the number of elements is given as constant, then this method returns ConstNode expression representing the value.

Specified by:
getElemCountExp in interface VectorType
Returns:
the expression representing the number of elements in the vector.

getLowerBound

public long getLowerBound()
Description copied from interface: VectorType
getLowerBound

Specified by:
getLowerBound in interface VectorType
Returns:
the lower bound of index for this vector. If the lower bound is not specified, 0 is assumed.

getLowerBoundExp

public Exp getLowerBoundExp()
Description copied from interface: VectorType
getLowerBoundExp

Specified by:
getLowerBoundExp in interface VectorType
Returns:
the expression representing the lower bound of index for this vector.

isCompatibleWith

public boolean isCompatibleWith(Type pType)
evaluateElemCount Get the characteristics of "this" array type. "this" should be an array type symbol. evaluateElemCount: returns element count as integer value. If it can not be evaluated, return 0.

Specified by:
isCompatibleWith in interface Type
Overrides:
isCompatibleWith in class TypeImpl
Returns:
true if this type is compatible with pType.

isRectangularArray

public boolean isRectangularArray()
Description copied from interface: VectorType
isRectangularArray

Specified by:
isRectangularArray in interface VectorType
Returns:
true if this is a vector of constant number of elements whose type has fixed uniform size, where fixed uniform size elements are: basic type (other than PointerType, SubpType) EnumType StructType/UnionType whose elements are all fixed uniform size VectorType with true value for RectangularArray()

getAlignment

public int getAlignment()
Description copied from interface: Type
getAlignment Get alignment value for this type. It depends on target machine. For basic types, the alignment value is a byte count specified in MachineParam.java. The default value of alignment of VectorType is the alignment of element type which may differ vector by vector. The defalut alignment value of StructType or UnionType is set to that of its element with the largest alignment value which may differ struct by struct or union by union. The alignment value of StructType, UnionType, or VectorType should be set by setAlignment method of corresponding type when the type is defined. As for subprogram, if alignment of return value is required, get it by subp.getReturnValueType().getAlignment(), and if alignment of subprogram object code is required, get it by symRoot.machineParam.getAlignment(Type.KIND_SUBP). //##67

Specified by:
getAlignment in interface Type
Overrides:
getAlignment in class TypeImpl

setAlignment

public void setAlignment(int pAlignment)
Description copied from interface: VectorType
setAlignment Set alignment value to be equal to the pAlignment which should be greater or equal to the alignment of element type. Default value of alignment is set to the alignment of element type when an instance of VectorType is created.

Specified by:
setAlignment in interface VectorType
Parameters:
pAlignment - alignment value to be set.

toString

public java.lang.String toString()
Description copied from interface: HasStringObject
Get the string image of object.

Specified by:
toString in interface HasStringObject
Overrides:
toString in class TypeImpl

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 TypeImpl