|
||||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |
java.lang.Object | +--coins.sym.SymImpl
SymImpl class that implements Sym. To use methods in this class, read Sym.java. Sym interface is written so that methods can be used without reading SymImpl.java except when user is interested in the implementation of the methods.
フィールドの概要 | |
protected int |
fDbgLevel
|
protected Sym |
fDefinedIn
Upper construct that defines this symbol such as subprogram for local variable, struct/union tag name for struct/union element, enum tag for enumeration constant, etc. |
protected FlagBox |
fFlagBox
The flag, which represents this symbol's kind by bit mask. |
protected int |
fKind
The Symbol kind |
protected java.lang.String |
fName
The symbol name in the source file. |
protected Sym |
fNextSym
The next symbol |
protected SymTable |
fRecordedIn
fRecordedIn Symbol table recording this symbol. |
protected SourceInf |
fSourceInf
Source program information -- file name, line number, column defining this symbol. |
protected SymInf |
fSymInf
Information attached to this symbol |
protected Type |
fType
The type of this symbol |
Sym |
fUniqueNameSym
The unique name which has been made by this compiler. |
protected java.lang.Object |
fWork
Phase-wise work used for arbitrary purpose in each phase |
protected static MachineParam |
machineParam
|
protected static SourceLanguage |
sourceLanguage
|
SymRoot |
symRoot
|
インタフェース coins.sym.Sym から継承したフィールド |
KIND_NAME, VISIBILITY |
コンストラクタの概要 | |
SymImpl()
|
|
SymImpl(SymRoot pSymRoot)
SymImpl Constructor to set symRoot. |
|
SymImpl(SymRoot pSymRoot,
java.lang.String pInternedName)
|
メソッドの概要 | |
StringConst |
bareStringConst(java.lang.String pInternedName)
|
BaseType |
baseType(java.lang.String pInternedName,
int pTypeKind)
baseType Create an instance of base type. |
BoolConst |
boolConst(boolean pTrueFalse)
boolConst Make BoolConst object corresponding to pBoolConst. |
CharConst |
charConst(char pChar,
Type pType)
Make constant object corresponding to pChar. |
CharConst |
charConst(int pCharCode,
Type pType)
|
CharConst |
charConst(java.lang.String pInternedName,
Type pType)
Make constant object corresponding to pInternedName. |
DefinedType |
definedType(java.lang.String pInternedName,
Type pOriginalType)
definedType with simple parameter Make a defined type |
DefinedType |
definedType(java.lang.String pInternedName,
Type pOriginalType,
Sym pDefinedIn)
|
Elem |
defineElem(java.lang.String pInternedName,
Type pType)
defineElem Define a struct/union element with the name shown by pInternedName in the current symbol table (symTableCurrent of SymRoot) which will be the local symbol table of the struct or union including the element. |
Label |
defineLabel(java.lang.String pInternedName)
defineLabel Define a label named as pInternedName in the symbol table of current subprogram (symRoot.symTableCurrentSubp). |
Param |
defineParam(java.lang.String pInternedName,
Type pType)
defineParam Define a paramater with the name shown by pInternedName in the current symbol table (symTableCurrent of SymRoot) which will be the local symbol table of current subprogram. |
Var |
defineRegionVar(java.lang.String pInternedName,
RegionType pType)
defineRegionVar Define the region variable of the region type pType in the symTableRoot. |
Subp |
defineSubp(java.lang.String pInternedName,
Type pType)
defineSubp Define a subprogram in the current symbol table symRoot.symTableCurrent. |
Var |
defineVar(java.lang.String pInternedName,
Type pType)
defineVar Define a variable with name shown by pInternedName in the current symbol table (symTableCurrent of SymRoot). |
Var |
defineVar(java.lang.String pInternedName,
Type pType,
Sym pDefinedIn)
defineVar with defined-in parameter Define a variable with name shown by pInternedName in the current symbol table (symTableCurrent of SymRoot). |
Sym |
derivedSym()
derivedSym Generate a symbol having the same type and kind as that of this symbol in symTableCurrentSubp, or symTableCurrent if symTableCurrentSubp is null. |
EnumType |
enumType(IrList pElemList,
Sym pTag)
enumType with element list and tag Make an instance of EnumType |
EnumType |
enumType(java.lang.String pInternedName,
IrList pEnumList,
Sym pTag)
|
FloatConst |
floatConst(double pFloatValue,
Type pType)
Make constant object corresponding to pDoubleConst. |
FloatConst |
floatConst(java.lang.String pInternedName,
Type pType)
Make constant object corresponding to pInternedName. |
int |
getDefinedColumn()
getDefinedColumn Get the column number of the first declaration for this symbol. |
java.lang.String |
getDefinedFile()
getDefinedFile Get the symbol table entry representing the name of the file that defined this symbol for the first time. |
Sym |
getDefinedIn()
getDefinedIn Get the name of the construct containing the definition of this symbol (see defineUnique, Define, etc.). |
java.lang.String |
getDefinedInName()
getDefinedInName Get the name of getDefinedIn(). |
int |
getDefinedLine()
getDefinedLine Get the line number of the first declaration for this symbol. |
boolean |
getFlag(int pFlagNumber)
getFlag getFlag returns the value (true/false) of the flag indicated by pFlagNumber. |
SymInf |
getInf()
getInf Get additional information (for optimization, parallelization, etc.) |
java.lang.String |
getName()
getName Get the name of this symbol.( The same name as in the source file. ) |
java.lang.String |
getNameOrNull(Sym pSym)
getNameOrNull If pSym is not null, return its name, else return null. |
Sym |
getNextSym()
getNextSym Get the next symbol |
SymInf |
getOrAddInf()
getOrAddInf get attached information. |
Sym |
getOriginalSym()
Get original symbol corresponding to uniqueNameSym if this is a unique name symbol generated by setUniqueNameToAllSym(). |
Sym |
getOriginalSym(java.lang.String pName)
Get original symbol corresponding to the symbol named pName. |
java.lang.String |
getPureName()
getPureName Get the name of this symbol. |
SymTable |
getRecordedIn()
getRecordedIn Get the symbol table that recorded this symbol. |
SourceInf |
getSourceInf()
|
int |
getSymKind()
getSymKind Get the symbol kind of this symbol (KIND_VAR, KIND_SUBP, etc.). |
java.lang.String |
getSymKindName()
getSymKindName Get the symbol kind name from GlobalConstants. |
Type |
getSymType()
getSymType Get the type of this symbol. |
java.lang.String |
getUniqueName()
getUniqueName Get the UniqueName of this symbol. |
java.lang.Object |
getWork()
Get phase-wise work used for arbitrary purpose in each phase. |
IntConst |
intConst(long pIntValue,
Type pType)
Make integer constant object corresponding to pLongConst. |
IntConst |
intConst(java.lang.String pInternedName,
Type pType)
Make constant object corresponding to pInternedName. |
java.lang.Integer |
intObject(int pIntValue)
Make java.lang.Integer object corresponding to pIntValue. |
boolean |
isGlobal()
isGlobal |
boolean |
isHIR()
Test if this is an HIR object. |
boolean |
isRemoved()
isRemoved |
boolean |
isSym()
Test if this is a Sym object. |
void |
linkSym(Sym pNextSym)
linkSym Link pNextSym as the next to this symbol. |
java.lang.String |
makeCstring(java.lang.String pStringBody)
makeCstring Change the pure string pStringBody to C string representation adding heading, trailing quotes and escape characters if required. |
java.lang.String |
makeCstringWithTrailing0(java.lang.String pStringBody)
makeCstringWithTrailing0 Change the pure string pStringBody to C string representation adding heading, trailing quotes and escape characters if required. |
java.lang.String |
makeEnumTypeName(IrList pElemList)
Make a string |
java.lang.String |
makeExpString(Exp pExp)
|
java.lang.String |
makeJavaString(java.lang.String pStringBody)
makeJavaString Change the pure string pStringBody to Java String representation adding heading, trailing quotes and escape characters if required. |
java.lang.String |
makeStructUnionTypeName(boolean pStruct,
IrList pElemList)
Make a string of |
java.lang.String |
makeSubpTypeName(Type pReturnType,
IrList pParamList,
boolean pOptionalParam)
|
java.lang.String |
makeSubpTypeName(Type pReturnType,
IrList pParamList,
boolean pOptionalParam,
boolean pNoParamSpec)
Make a string |
java.lang.String |
makeVectorTypeName(Type pElemType,
Exp pElemCountExp,
long pElemCount,
Exp pLowerBoundExp,
long pLowerBound)
makeVectorTypeName Make a vector type name of the form |
java.lang.String |
makeVectorTypeName(Type pElemType,
long pElemCount)
makeVectorTypeName with default lower bound Make a vector type name of the form |
java.lang.String |
makeVectorTypeName(Type pElemType,
long pElemCount,
long pLowerBound)
makeVectorTypeName Make a vector type name of the form |
NamedConst |
namedConst(java.lang.String pInternedName,
Const pConst)
Make a constant named as pInternedName. |
NamedConst |
namedConst(java.lang.String pInternedName,
int pIndex,
Type pType)
Make a constant named as pInternedName. |
PointerType |
pointerType(java.lang.String pInternedName,
Type pPointedType,
Sym pDefinedIn)
|
PointerType |
pointerType(Type pPointedType)
pointerType with simple parameter Get the pointer type that points to an object of type pPointedType. |
PointerType |
pointerType(Type pPointedType,
long pElemCount)
pointerType with element count Get a PointeType that points to an object of type pPointedType with element count. |
PointerType |
pointerType(Type pPointedType,
long pElemCount,
long pLowerBound)
pointerType with element count Get a PointeType that points to an object of type pPointedType with element count and lower bound. |
PointerType |
pointerType(Type pPointedType,
SymTable pSymTable)
pointerType specifying symbol table Get the pointer type that points to an object of type pPointedType. |
void |
print(int pIndent)
Print the object. |
void |
print(int pIndent,
boolean pDetail)
Print the object. |
RegionType |
regionType(java.lang.String pRegionNameString)
|
RegionType |
regionType(java.lang.String pRegionNameString,
int pStorageClass)
regionType: Make an instance of RegionType |
void |
remove()
remove Remove this symbol. |
void |
setDefinedFile(java.lang.String pDefinedFile)
setDefinedFile Set the name of the file defining this symbol. |
void |
setDefinedIn(Sym pDefiningSym)
setDefinedIn Set "definedIn" symbol of this symbol if it is not set by defineUnique, Define, and redefine. |
void |
setDefinedLine(int pDefinedLine)
setDefinedLine Set the line number of declaration defining this symbol. |
void |
setFlag(int pFlagNumber,
boolean pYesNo)
setFlag setFlag sets the flag of specified number. |
void |
setOriginalSym(Sym pOriginalSym)
|
void |
setParameters(MachineParam pMachineParam,
SourceLanguage pSourceLanguage)
setParameters makes machineParam and sourceLanguage available to Sym methods. |
void |
setRecordedIn(SymTable pSymTable)
setRecordedIn Link to the symbol table that recorded this symbol. |
void |
setSourceInf(SourceInf pInf)
|
void |
setSymKind(int pSymKind)
setSymKind Set the symbol kind of this symbol (KIND_VAR, KIND_SUBP, etc.). |
void |
setSymType(Type pSymType)
setSymType Set the type of this symbol. |
void |
setUniqueNameSym(Sym pUniqueNameSym)
setUniqueNameSym Set the UniqueName of this symbol. |
void |
setWork(java.lang.Object pWork)
Set phase-wise work used for arbitrary purpose in each phase. |
StringConst |
stringConst(java.lang.String pInternedName)
stringConst Make a string constant (StringConst object) from given string pInternedName which has no heading and trailing quotes ('"'). |
StringConst |
stringConstFromQuotedString(java.lang.String pInternedName)
stringConstFromQuotedString Make a string constant (StringConst object) from given string pInternedName that has heading and trailing quote '"'. |
StructType |
structType(IrList pElemList,
Sym pTag)
structType with element list and tag Make an instance of StructType |
StructType |
structType(java.lang.String pInternedName,
IrList pElemList,
Sym pTag)
|
SubpType |
subpType(Type pReturnType,
IrList pParamList,
boolean pOptionalParam,
boolean pNoParamSpec,
Sym pDefinedIn)
subpType (with pPermitAnyParam) Make subprogram type (SubpType) from parameter list, etc. |
SubpType |
subpType(Type pReturnType,
IrList pParamList,
boolean pOptionalParam,
Sym pDefinedIn)
|
Sym |
symbol(java.lang.String pInternedName,
Type pType,
Sym pDefinedIn)
symbol Create a Sym object of pType. |
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. |
java.lang.String |
toStringShort()
toStringShort Get name and index of this symbol in text which is not interned. |
UnionType |
unionType(IrList pElemList,
Sym pTag)
unionType with element list and tag Make an instance of UnionType |
UnionType |
unionType(java.lang.String pInternedName,
IrList pElemList,
Sym pTag)
|
VectorType |
vectorType(java.lang.String pTypeName,
Type pElemType,
Exp pElemCountExp,
Exp pLowerBoundExp)
vectorType with element count and lower bound as expression. |
VectorType |
vectorType(java.lang.String pTypeName,
Type pElemType,
long pElemCount,
long pLowerBound)
vectorType with element count and lower bound as integer number. |
VectorType |
vectorType(Type pElemType,
Exp pElemCountExp)
vectorType with element count given as an expression. |
VectorType |
vectorType(Type pElemType,
long pElemCount)
vectorType with element count given as integer number. |
VectorType |
vectorTypeUnfixed(Type pElemType,
Exp pLowerBoundExp)
vectorType having unfixed number of element of pElemType. |
VectorType |
vectorTypeUnfixed(Type pElemType,
long pLowerBound)
vectorType having unfixed number of element of pElemType. |
クラス java.lang.Object から継承したメソッド |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
フィールドの詳細 |
public final SymRoot symRoot
public Sym fUniqueNameSym
protected java.lang.String fName
protected int fKind
protected Type fType
protected SymTable fRecordedIn
protected Sym fDefinedIn
protected Sym fNextSym
protected FlagBox fFlagBox
protected SymInf fSymInf
protected SourceInf fSourceInf
protected java.lang.Object fWork
protected static MachineParam machineParam
protected static SourceLanguage sourceLanguage
protected final int fDbgLevel
コンストラクタの詳細 |
public SymImpl()
public SymImpl(SymRoot pSymRoot)
public SymImpl(SymRoot pSymRoot, java.lang.String pInternedName)
メソッドの詳細 |
public void setParameters(MachineParam pMachineParam, SourceLanguage pSourceLanguage)
public BoolConst boolConst(boolean pTrueFalse)
Sym
の記述:
Sym
内の boolConst
pTrueFalse
- true or false.
public CharConst charConst(java.lang.String pInternedName, Type pType)
Sym
の記述:
Sym
内の charConst
pInternedName
- Character string representing the constant.pType
- Type of the constant object to be created;
It may be typeChar or typeU_Char of SymRoot.
public CharConst charConst(char pChar, Type pType)
Sym0
の記述:
Sym0
内の charConst
pChar
- Character representing the constant.pType
- Type of the constant object to be created;
It may be typeChar or typeU_Char of SymRoot.
public CharConst charConst(int pCharCode, Type pType)
public IntConst intConst(java.lang.String pInternedName, Type pType)
Sym
の記述:
Sym
内の intConst
pInternedName
- Character string representing
an integer constant.pType
- Type of the constant object to be created;
It may be typeShort, typeInt, typeLong, typeLongLong,
typeU_short, typeU_int, typeU_Long, typeU_LongLong of SymRoot.
public IntConst intConst(long pIntValue, Type pType)
Sym0
の記述:
Sym0
内の intConst
pIntValue
- Long integer representing the constant.pType
- Type of the constant object to be created;
It may be typeShort, typeInt, typeLong, typeLongLong,
typeU_short, typeU_int, typeU_Long, typeU_LongLong of SymRoot.
public FloatConst floatConst(java.lang.String pInternedName, Type pType)
Sym
の記述:
Sym
内の floatConst
pInternedName
- Character string representing the constant.pType
- Type of the constant object to be created;
It may be typeFloat, typeDouble, typeLongDouble of SymRoot.
public FloatConst floatConst(double pFloatValue, Type pType)
Sym0
の記述:
Sym0
内の floatConst
pFloatValue
- Double constant representing the constant.pType
- Type of the constant object to be created;
It may be typeFloat, typeDouble of SymRoot;
For LongDouble, this method can not be used, but use
another floatConst method.
public StringConst stringConst(java.lang.String pInternedName)
Sym0
の記述: Make a string constant (StringConst object) from given string pInternedName which has no heading and trailing quotes ('"'). If the source language requests heading and trailing quotes in constant representation, they should be pealed off in pInternedName. The string constant is recorded as a pure string (processing escape characters by makeStringBody of coins.SourceLanguage) derived from pInternedName. If pInternedName has heading or trailing quotes, they are treated as a part of the pure string. getStringBody() will give the pure string. getName() or getSymName() will give a string that is composed of heading quote '"', pure string, and trailing quote '"'. Debug print method (toString()) will change the pure string to the form of Java String adding heading, trailing '"', and escape characters. The type of the string constant is set as a vector of characters with length given by getStringLength() of SourceLanguage. See makeJavaString(), makeCstring(), makeCstringWithTrailing0().
Sym0
内の stringConst
pInternedName
- string from which StringConst is to be made.
public StringConst stringConstFromQuotedString(java.lang.String pInternedName)
Sym
の記述:
Sym
内の stringConstFromQuotedString
pInternedName
- string from which StringConst is to be made;
It should have heading and trailing quotes.
public StringConst bareStringConst(java.lang.String pInternedName)
public java.lang.String makeJavaString(java.lang.String pStringBody)
Sym
の記述:
Sym
内の makeJavaString
pStringBody
- String made by makeStringBody of
coins.SourceLanguage.
public java.lang.String makeCstring(java.lang.String pStringBody)
Sym
の記述:
Sym
内の makeCstring
pStringBody
- String made by makeStringBody of
coins.SourceLanguage.
public java.lang.String makeCstringWithTrailing0(java.lang.String pStringBody)
Sym
の記述:
Sym
内の makeCstringWithTrailing0
pStringBody
- String made by makeStringBody of
coins.SourceLanguage.
public NamedConst namedConst(java.lang.String pInternedName, Const pConst)
Sym0
の記述:
Sym0
内の namedConst
pInternedName
- Name of Sym whose kind is
Sym.KIND_NAMED_CONST to represent the constant.pConst
- Constant symbol to be named.
If it is an object that can be converted to integer,
index of the named constant is computed.
public NamedConst namedConst(java.lang.String pInternedName, int pIndex, Type pType)
Sym
の記述:
Sym
内の namedConst
pInternedName
- Name of Sym whose kind is
Sym.KIND_NAMED_CONST to represent the constant.pIndex
- Index to be assigned to the named constant.pType
- Type of the constant to be named;
It may be typeChar, typeShort, typeInt,
typeU_Char, typeU_short, typeU_int.
public java.lang.Integer intObject(int pIntValue)
Sym
の記述:
Sym
内の intObject
pIntValue
- Integer representing the constant.
public Var defineVar(java.lang.String pInternedName, Type pType)
Sym0
の記述:
Sym0
内の defineVar
pInternedName
- Character string representing the name
of the variable to be defined.pType
- Type of the variable to be defined.
public Var defineVar(java.lang.String pInternedName, Type pType, Sym pDefinedIn)
Sym
の記述:
Sym
内の defineVar
pDefinedIn
- outer language construct such as
subprogram that defines the variable.public Var defineRegionVar(java.lang.String pInternedName, RegionType pType)
public Param defineParam(java.lang.String pInternedName, Type pType)
Sym0
の記述:
Sym0
内の defineParam
pInternedName
- Character string representing the name
of the parameter to be defined.pType
- Type of the parameter to be defined.
public Elem defineElem(java.lang.String pInternedName, Type pType)
Sym0
の記述:
Sym0
内の defineElem
pInternedName
- Character string representing the name
of the element to be defined.pType
- Type of the element to be defined.
public Subp defineSubp(java.lang.String pInternedName, Type pType)
Sym0
の記述: Define a subprogram in the current symbol table symRoot.symTableCurrent. In order to define a subprogram symbol, make the subprogram symbol by defineSubp(...), add formal parameters by addParam(....), close the subprogram declaration by closeSubpHeader(....) in such way as Subp lSubp = symRoot.sym.defineSubp("name".intern(), returnType); symRoot.symTableRoot.pushSymTable(lSubp); lSubp.addParam(param1); lSubp.addParam(param2); .... lSubp.setOptionalparam(); // only when optional parameter is given. lSubp.setVisibility(Sym.SYM_PUBLIC); // only if public. lSubp.closeSubpHeader(); Var lVi = symRoot.sym.defineVar("i".intern(), symRoot.typeInt); // local symbols .... symRoot.symTableCurrent.popSymTable(); Above procedsure will make a subprogram object with inevitable fields such as parameter list, return value type, and subprogram type. closeSubpHeader() will make subprogram type of the formreturnValueType optionalParam > where, paramType_1, paramType_2, ... are parameter type, returnValueType is return value type, optionalParam is true or false depending on whether optional parameter (... in C) is specified or not. The subprogram type of a subprogram lSubp can be get by lSubp.getSymType(), whereas the return value type can be get by lSubp.getReturnValueType(). Multiple definition of subprogram symbol is allowed because there may be multiple prototype declaration or extern declaration for the same subprogram in languages such as C. It is the task of semantic analyzer to check the inconsistency between the multiple declarations and to restrict the update of specifications for previously declared subprogram. Until closeSubpHeader() is called for the subprogram lSubp, lSubp.getSymType() is null, and until subprogram body is defined, lSubp.getHirBody() is null. These information may be used in checking the declarations for a subprogram. See seach method of SymTable for searching subprogram with specific name. As for detail, see Subp interface, too. As for prototype declaration, see also Subp interface.
- 定義:
- インタフェース
Sym0
内のdefineSubp
- パラメータ:
pInternedName
- Name of the subprogram.pType
- Return value type; If no value is returned then specify void type (symRoot.typeVoid).
public Label defineLabel(java.lang.String pInternedName)
Sym0
の記述:
Sym0
内の defineLabel
pInternedName
- Name of the label.
public BaseType baseType(java.lang.String pInternedName, int pTypeKind)
Sym
の記述:
Sym
内の baseType
pInternedName
- name of the base type
("int", float", etc.).pTypeKind
- type kind defined in Type.java
(KIND_INT, KIND_FLOAT, etc.).
public VectorType vectorType(Type pElemType, long pElemCount)
Sym0
内の vectorType
pElemType
- Type of the vactor element.pElemCount
- Number of elements in the vector.
public VectorType vectorType(Type pElemType, Exp pElemCountExp)
Sym
内の vectorType
pElemType
- Type of the vactor element.pElemCountExp
- Expression representing the number of elements
in the vector. The element count is computed by evaluating this
parameter.
public VectorType vectorType(java.lang.String pTypeName, Type pElemType, long pElemCount, long pLowerBound)
Sym
内の vectorType
pTypeName
- Type name of the vector. It may have const or volatile
qualifier attached to ordinary vector type name.
If pTypeName is null, a vector type name will be generated by
makeVectorTypeName method.pElemType
- Type of the vactor element.pElemCount
- Number of elements in the vector.pLowerBound
- Lower bound of the subscript of the vector.
public VectorType vectorType(java.lang.String pTypeName, Type pElemType, Exp pElemCountExp, Exp pLowerBoundExp)
Sym
内の vectorType
pElemType
- Type of the vactor element.pElemCountExp
- Number of elements in the vector.pLowerBoundExp
- Lower bound of the subscript of the vector.pTypeName
- Interned name of this vector type;
It takes the form
public VectorType vectorTypeUnfixed(Type pElemType, long pLowerBound)
Sym0
の記述:
Sym0
内の vectorTypeUnfixed
pElemType
- is the type of the vector element.pLowerBound
- is the lower bound of subscript.
public VectorType vectorTypeUnfixed(Type pElemType, Exp pLowerBoundExp)
Sym
の記述:
Sym
内の vectorTypeUnfixed
pElemType
- is the type of the vector element.pLowerBoundExp
- is an expression showing the lower bound of subscript.
public PointerType pointerType(Type pPointedType)
Sym0
の記述:
Sym0
内の pointerType
pPointedType
- type of the object to be pointed.
public PointerType pointerType(Type pPointedType, SymTable pSymTable)
Sym
の記述:
Sym
内の pointerType
pPointedType
- type of the object to be pointed.pSymTable
- the symbol table in which the pointer type
is searched or created, where, the pointed type should
be visible from the symbol table.
public PointerType pointerType(java.lang.String pInternedName, Type pPointedType, Sym pDefinedIn)
public PointerType pointerType(Type pPointedType, long pElemCount)
Sym
の記述:
Sym
内の pointerType
pPointedType
- type of the object to be pointed.pElemCount
- number of elements of the vector
represented by the pointer.
public PointerType pointerType(Type pPointedType, long pElemCount, long pLowerBound)
Sym
の記述:
Sym
内の pointerType
pPointedType
- type of the object to be pointed.pElemCount
- number of elements of the vector
represented by the pointer.pLowerBound
- subscript lower bound of the array represented
by the pointer.
public StructType structType(IrList pElemList, Sym pTag)
Sym0
の記述: Make an instance of StructTypein symRoot.symTableCurrent and prepare for making its origin type where nameOfTag is the name string of pTag, elemSym is struct element and elemType is its type. If pElemList is null, addElem of StructType should be called for each element of the structure in the order of declaration. After all elements has been added, finishStructType of StructType should be called to close the declaration of the structure. If pElemList is null, is an incomplete type until finishStructType is called. If pElemList is not null, the origin type is also created as a complete type. Example of using structType: As for struct listNode { int nodeValue; struct listNode *next; } listAnchor, listNode1; following coding will make corresponding StructType. Sym lTag = symRoot.symTableCurrent.generateTag("listNode".intern()); StructType lListStruct = sym.structType(null, lTag); // Incomplete type. PointerType lListPtrType = sym.pointerType(lListStruct); PointerType lIntPtrType = sym.pointerType(symRoot.typeInt); symRoot.symTableCurrent.pushSymTable(lListStruct); Elem lValue = sym.defineElem("nodeValue".intern(), symRoot.typeInt); Elem lNext = sym.defineElem("next".intern(), lListPtrType); lListStruct.addElem(lValue); lListStruct.addElem(lNext); lListStruct.finishStructType(true); symRoot.symTableCurrent.popSymTable(); As for the size, alignment, element displacement of structure type, see finishStructType in StructType interface. If some element is unfixed-size (getFlag(Sym.FLAG_UNFIXED_SIZE) //##64 is true), then the resultant StructType become unfixed-size //##64 and message will be issued informing that. //##64
- 定義:
- インタフェース
Sym0
内のstructType
- パラメータ:
pElemList
- List of structure element (may be null); It can be created by statement sequence IrList lElemList = symRoot.hirRoot.hir.irList(); lElemList.add(elem1); lElemList.add(elem2); ... If pElemList is not null, it should contain all elements of the structure.pTag
- Tag name of the struct; If it is not given in source program, give it by generating it by generateTag() of SymTable.- 戻り値:
- StructType instance.
public StructType structType(java.lang.String pInternedName, IrList pElemList, Sym pTag)
public UnionType unionType(IrList pElemList, Sym pTag)
Sym0
の記述: Make an instance of UnionTypein symRoot.symTableCurrent and prepare for making its origin type where nameOfTag is the name string of pTag, elemSym is union element and elemType is its type. If pElemList is null, addElem of UnionType should be called for each element of the union in the order of declaration. After all elements has been added, finishUnionType of UnionType should be called to close the declaration of the union. If pElemList is null, is an incomplete type until finishUnionType is called. If pElemList is not null, the origin type is also created as a complete type. If some element is unfixed-size (getFlag(Sym.FLAG_UNFIXED_SIZE) //##64 is true), then the resultant UnionType become unfixed-size //##64 and warning message will be issued informing that. //##64
- 定義:
- インタフェース
Sym0
内のunionType
- パラメータ:
pElemList
- List of union element (may be null); It can be created by statement sequence IrList lElemList = symRoot.hirRoot.hir.irList(); lElemList.add(elem1); lElemList.add(elem2); ... If pElemList is not null, it should contain all elements of the structure.pTag
- Tag name of the union; If it is not given in source program, give it by generating it by generateTag() of SymTable.- 戻り値:
- UnionType instance.
public UnionType unionType(java.lang.String pInternedName, IrList pElemList, Sym pTag)
public RegionType regionType(java.lang.String pRegionNameString, int pStorageClass)
Sym
の記述: Make an instance of RegionTypein symRoot.symTableRoot. Region is a global area shared between subprograms and between compile units. A region may have several symbol tables containing declarations of variables to be allocated in it. After all elements has been added to a region in a subprogram, finishCurrentRegion of RegionType should be called for the region to close the declaration of the region. For unnamed region (blank region), regionType is already called in SymRoot and can be accessed by symRoot.typeRegion, but it is necessary to add elements and call finishCurrentRegion when there is unnamed region in given program. Processing sequence for defining a region is as follows RegionType lRegionType; // Region type to be defined. SymTable lRegionSymTable; // Symbol table to record the // elements declared for the region. // It may be the symbol table local to // the current subprogram. Subp lCurrentSubp; // Subprogram that includes the // declaration of the region. Var lRegionVar; // Aggregate variable that represents // the whole elements declared // in the region. Elem lEmem; // Element declared in the region. lRegionType = symRoot.sym.regionType(regionName.intern()); lRegionSymTable = symRoot.symTableCurrentSubp; lRegionType.addSubp(symRoot.subpCurrent, lRegionSymTable); // For each declaration of variable to be included in // the region do { lElem = symRoot.sym.defineElem(....); lRegionType.addElemToCurrentRegion(lElem); // } lRegionType.finishCurrentRegion(); To use the variables included in the region, treat them in the similar way as structure elements: lRegionVar = lRegionType.getRegionVar(); Exp lExp = hirRoot.hir.qualifiedExp( hirRoot.hir.varNode(lRegionVar), hirRoot.hir.elemNode(lElem)); // See HIR.java for qualifiedExp.
- 定義:
- インタフェース
Sym
内のregionType
- パラメータ:
pRegionNameString
- Interned name of the region;pStorageClass
- give VAR_STATIC or VAR_AUTO of Var interface.- 戻り値:
- RegionType instance.
public RegionType regionType(java.lang.String pRegionNameString)
public EnumType enumType(IrList pElemList, Sym pTag)
Sym0
の記述: Make an instance of EnumTypein symRoot.symTableCurrent and prepare for making its origin type where nameOfTag is the name string of pTag, enumName is enumeration name and enumValue is value. If pElemList is null, addElem of EnumType should be called for each element of the enum in the order of declaration. After all elements has been added, finishEnumType of EnumType should be called to close the declaration of the enum. If pElemList is null, is an incomplete type until finishEnumType is called. If pElemList is not null, the origin type is also created as a complete type.
- 定義:
- インタフェース
Sym0
内のenumType
- パラメータ:
pElemList
- List of the pairs of enum name and value; It can be created by statement sequence IrList lElemList = symRoot.hirRoot.hir.irList(); IrList lEnumPair = symRoot.hirRoot.hir.irList(); lEnumPair.add(elem1); lEnumPair.add(symRoot.sym.intObject(value1); lElemList.add(lEnumPair); lEnumPair = symRoot.hirRoot.hir.irList(); lEnumPair.add(elem2); lEnumPair.add(symRoot.sym.intObject(value2); lElemList.add(lEnumPair); ....pTag
- Tag name of the enum; If it is not given in source program, give it by generating it by generateTag() of SymTable.- 戻り値:
- EnumType instance.
public EnumType enumType(java.lang.String pInternedName, IrList pEnumList, Sym pTag)
public DefinedType definedType(java.lang.String pInternedName, Type pOriginalType)
Sym0
の記述:
Sym0
内の definedType
pInternedName
- name string composing the defined name;
It may be a tag name. It should be given.pOriginalType
- origin type of the defined type;
It should be given.
public DefinedType definedType(java.lang.String pInternedName, Type pOriginalType, Sym pDefinedIn)
public SubpType subpType(Type pReturnType, IrList pParamList, boolean pOptionalParam, Sym pDefinedIn)
public SubpType subpType(Type pReturnType, IrList pParamList, boolean pOptionalParam, boolean pNoParamSpec, Sym pDefinedIn)
Sym0
の記述:
Sym0
内の subpType
pReturnType
- return value type;
If no return value, then give symRoot.typeVoid.pParamList
- Formal parameter list or
IrList of parameter types.pOptionalParam
- true if optional param ("..." in C)
is present, false if no optional parameter.pNoParamSpec
- true if any number of parameters
of any type are permitted in such case as
extern sub();
sub(a); sub(a, b);
in old C language style.pDefinedIn
- null for source languages where
nested subprogram definition is not allowed
(such as C, Fortran), or parent subprogram
which include the subprogram definition for
source languages where nested subprogram definition
is allowed (such as Pascal).
public Sym symbol(java.lang.String pInternedName, Type pType, Sym pDefinedIn)
Sym
の記述:
Sym
内の symbol
pInternedName
- name of the symbol to be created.pType
- type of the symbol to be created.pDefinedIn
- owner symbol.
public Sym derivedSym()
Sym
の記述:
Sym
内の derivedSym
public java.lang.String makeVectorTypeName(Type pElemType, long pElemCount)
Sym
の記述:
Sym
内の makeVectorTypeName
pElemType
- Type of the vector element.pElemCount
- Number of elements in the vector.
public java.lang.String makeVectorTypeName(Type pElemType, long pElemCount, long pLowerBound)
Sym
の記述:
Sym
内の makeVectorTypeName
pElemType
- Type of the vector element.pElemCount
- Number of elements in the vector.pLowerBound
- Lower bound of the subscript of the vector.
public java.lang.String makeVectorTypeName(Type pElemType, Exp pElemCountExp, long pElemCount, Exp pLowerBoundExp, long pLowerBound)
Sym
の記述:
Sym
内の makeVectorTypeName
pElemType
- Type of the vector element.pElemCountExp
- Expression representing the
number of elements in the vector, or null.pElemCount
- If pElemCountExp is null, give the number of elements
in the vector, else 0 (which is not used).pLowerBoundExp
- Expression representing the
lower bound of the subscript of the vector, or null.pLowerBound
- If pLowerBoundExp is null, give the lower bound of the
subscript of the vector, else 0 (which is not used).
public java.lang.String makeExpString(Exp pExp)
public java.lang.String makeStructUnionTypeName(boolean pStruct, IrList pElemList)
Sym
の記述:
Sym
内の makeStructUnionTypeName
pStruct
- true for generating pElemList
- list of struct/union elements.
public java.lang.String makeEnumTypeName(IrList pElemList)
Sym
の記述:
Sym
内の makeEnumTypeName
pElemList
- list of enum elements.
public java.lang.String makeSubpTypeName(Type pReturnType, IrList pParamList, boolean pOptionalParam)
public java.lang.String makeSubpTypeName(Type pReturnType, IrList pParamList, boolean pOptionalParam, boolean pNoParamSpec)
Sym
の記述:
Sym
内の makeSubpTypeName
pReturnType
- type of return value.pParamList
- list of parameters.pOptionalParam
- true if optional param is specified,
false otherwise.pNoParamSpec
- is true if any number of parameters
of any type are permitted in such case as
extern sub();
sub(a); sub(a, b);
in old C language style.
public java.lang.String getSymKindName()
Sym
内の getSymKindName
public void linkSym(Sym pNextSym)
pNextSym
- Symbol to be inserted as the one next to this symbol.public java.lang.String getName()
Sym0
内の getName
public java.lang.String getPureName()
Sym
の記述:
Sym
内の getPureName
public java.lang.String getNameOrNull(Sym pSym)
Sym
の記述:
Sym
内の getNameOrNull
pSym
- any symbol or null.
public Sym getNextSym()
Sym0
内の getNextSym
public java.lang.String getUniqueName()
Sym0
内の getUniqueName
public void setUniqueNameSym(Sym pUniqueNameSym)
Sym
内の setUniqueNameSym
public Sym getOriginalSym()
Sym
の記述:
Sym
内の getOriginalSym
public void setOriginalSym(Sym pOriginalSym)
public Sym getOriginalSym(java.lang.String pName)
Sym
の記述:
Sym
内の getOriginalSym
pName
- the name of the symbol (in symTableUnique).
public Sym getDefinedIn()
Sym0
内の getDefinedIn
public void setDefinedIn(Sym pDefiningSym)
Sym
内の setDefinedIn
pDefiningSym
- name of the construct that include the definition
of this symbol.
Anonymous structure or union shuold be named by GenerateVar so as
pDefiningSym (and pDefinedIn) can be specified.public java.lang.String getDefinedInName()
Sym
の記述:
Sym
内の getDefinedInName
public SymTable getRecordedIn()
Sym0
内の getRecordedIn
public void setRecordedIn(SymTable pSymTable)
Sym
内の setRecordedIn
pSymTable
- Symbol table that recorded this symbol.public int getSymKind()
Sym0
内の getSymKind
public void setSymKind(int pSymKind)
Sym
内の setSymKind
pSymKind
- kind number to be set.
(KIND_TAG, etc.)public Type getSymType()
Sym0
内の getSymType
public void setSymType(Type pSymType)
Sym
内の setSymType
pSymType
- type symbol representing the type of this symbol.public boolean getFlag(int pFlagNumber)
Sym0
内の getFlag
pFlagNumber
- flag identification number.
public void setFlag(int pFlagNumber, boolean pYesNo)
Sym0
内の setFlag
pFlagNumber
- flag identification number.pYesNo
- true or false to be set to the flag.public boolean isGlobal()
Sym0
の記述:
Sym0
内の isGlobal
public void remove()
Sym
の記述:
Sym
内の remove
public boolean isRemoved()
Sym
の記述:
Sym
内の isRemoved
public SymInf getInf()
Sym
内の getInf
public SymInf getOrAddInf()
Sym
の記述:
Sym
内の getOrAddInf
public SourceInf getSourceInf()
public void setSourceInf(SourceInf pInf)
public java.lang.String getDefinedFile()
Sym0
内の getDefinedFile
public void setDefinedFile(java.lang.String pDefinedFile)
Sym
の記述:
Sym
内の setDefinedFile
public int getDefinedLine()
Sym
内の getDefinedLine
public void setDefinedLine(int pDefinedLine)
Sym
の記述:
Sym
内の setDefinedLine
pDefinedLine
- line number of declaration defining this symbol.public int getDefinedColumn()
Sym
内の getDefinedColumn
public java.lang.Object getWork()
Sym
の記述:
Sym
内の getWork
public void setWork(java.lang.Object pWork)
Sym
の記述:
Sym
内の setWork
pWork
- an object to be attached to this symbol;
It may contain any information such as Sym, HIR, etc.public boolean isSym()
HasStringObject
の記述:
HasStringObject
内の isSym
public boolean isHIR()
HasStringObject
の記述:
HasStringObject
内の isHIR
public java.lang.String toString()
HasStringObject
の記述:
HasStringObject
内の toString
java.lang.Object
内の toString
public java.lang.String toStringShort()
Sym
の記述:
Sym
内の toStringShort
public java.lang.String toStringDetail()
Sym
の記述:
Sym
内の toStringDetail
public void print(int pIndent)
HasStringObject
の記述:
HasStringObject
内の print
public void print(int pIndent, boolean pDetail)
HasStringObject
の記述:
HasStringObject
内の print
|
||||||||||
前のクラス 次のクラス | フレームあり フレームなし | |||||||||
概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド |