|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcoins.sym.SymImpl
coins.sym.SubpImpl
Subp Class Subp (subprogram) class. Subprogram means such program construct as procedure, function, method, constructor, destructor, statement function, library function, etc. Each subprogram has its local symbol table which is maintained by pushSymbolTable, popSymbolTable, reopenSymbolTable in SymbolTableInterface. Enhancement is required to implement object oriented languages.
| Field Summary | |
protected java.util.Set |
fAccessedSyms
Set of FlowAnalSym symbols accessed in this subprogram |
protected IrList |
fCallList
List of subprograms called from this subprogram |
protected Label |
fEndLabel
|
protected int |
fErrorCount
|
protected java.lang.Object |
fFlowInf
Information locally used for flow analysis, optimization, parallelyzation, etc. |
protected Stmt |
fHirBody
The HIR body statement of this subprogram |
protected BlockStmt |
fInitiationProcess
initiation procedure of this subprogram |
protected IrList |
fLabelDefList
Defineded labels in this subprogram |
protected SymTable |
fLocalSymTable
|
protected Subp |
fNextSubp
Link to the next subproguram |
protected boolean |
fNoParamSpec
fIsAnyParamPermitted is true if any number of parameters of any kind are permitted. |
protected java.lang.Object |
fOptInf
|
protected Param |
fOptParam
Optional parameter generated for this subprogram if this subprogram has optional parameters. |
protected java.lang.Object |
fParallelInf
|
protected IrList |
fParamList
Parameter IrList of this subprogram. |
protected boolean |
fParamListIsSet
fParamListIsSet is changed to true if fParamList is set (so as not to change it any more). |
protected IrList |
fParamListTemp
Parameter type list of this subprogram. |
protected IrList |
fParamTypeListTemp
Parameter type list temporally used in addParamType. |
protected Type |
fReturnValueType
|
boolean |
fSafeArrayAll
fSafeArrayAll is set to true if #pragama safeArrayAll is given. |
protected Label |
fStartLabel
|
protected SubpDefinition |
fSubpDefinition
The IR SubpDefinition node of this subprogram |
protected int |
fSubpKind
Kind of this subprogram |
protected int |
fTempCount
|
protected int |
fTempDCount
|
protected IrList |
fTempDVarList
List of temporal double variables ganerated by compiler |
protected IrList |
fTempVarList
List of temporal long variables ganerated by compiler |
| 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.Sym |
KIND_NAME, VISIBILITY |
| Constructor Summary | |
SubpImpl(SymRoot pSymRoot)
|
|
SubpImpl(SymRoot pSymRoot,
java.lang.String pName,
Type pReturnValueType,
Sym pDefinedIn)
|
|
| Method Summary | |
void |
addInitiationStmt(Stmt pInitiation)
addInitiationStmt Add pInitiation as the HIR statement in initiation procedure. |
void |
addParam(Param pParam)
addParam |
void |
addParamType(Type pParamType)
addParamType Add parameter type to a temporal parameter type list. |
void |
addToCallList(Subp pCallee)
addToCallList Add pCallee as a subprogram in the call list of this subprogram. |
void |
addToErrorCount(int pCount)
addToErrorCount Add pCount to the number of syntax/semantic error counter of this subprogram. |
void |
addToLabelDefList(Label pLabel)
|
void |
buildLabelRefList()
Build the list of labels defined in the subprogram so as getLabelDefList() returns proper list, and build the list of LabelNode for every labels to show the label node refering them. |
void |
closeSubpHeader()
closeSubpHeader |
void |
closeSubpPrototype()
closeSubpPrototype |
java.util.Set |
getAccessedSyms()
|
IrList |
getCallList()
getCallList Get the list of subprograms called in this subprogram. |
Label |
getEndLabel()
getEndLabel setEndLabel Get/set a label attached to the exit point of this subprogram. |
int |
getErrorCount()
getErrorCount Get the number of syntax/semantic errors of this subprogram. |
java.lang.Object |
getFlowInf()
getEntryBBlock |
Stmt |
getHirBody()
getHirBody Get the procedural body of this subprogram represented in high level intermediate representation (HIR). |
IrList |
getLabelDefList()
getLabelDefList Get the list of labels defined in this subprogram. |
Subp |
getNextSubp()
getNextSubp Get the subprogram next to this one having the same scope as this. |
java.lang.Object |
getOptInf()
|
Param |
getOptionalParam()
getOptionalParam -- TO BE DELETED Get the formal parameter generated by setOptionalParam for this subprogram. |
java.lang.Object |
getParallelInf()
|
IrList |
getParamList()
getParamList Get the parameter list of this subprogram. |
IrList |
getParamTypeList()
getParamTypeList Get the parameter type list of this subprogram. |
Type |
getReturnValueType()
getReturnValueType Get the return value type of this subprogram. |
Label |
getStartLabel()
getStartLabel setStartLabel Get/set a label attached to the entry point of this subprogram. |
Stmt |
getStmtWithLabel(Label pLabel)
getStmtWithLabel Get the HIR Stmt attached with pLabel. |
SubpDefinition |
getSubpDefinition()
getFirstLocalVar //## Deleted. |
int |
getSubpKind()
getSubpKind Get subprogram kind (subpOrdinary/subpMember/subpConstructor/subpDestructor). |
SymTable |
getSymTable()
getSymTable Get the symbol table local to this subprogram. |
int |
getVisibility()
getVisibility setVisibility Get/set the visibility attribute of the subprogram. |
boolean |
hasNoParamSpec()
|
boolean |
hasOptionalParam()
hasOptionalParam |
BlockStmt |
initiationProcedure()
initiationProcedure Get HIR initiation procedure of this subprogram, where the initiation procedure is executed at the first invocation of this subprogram or at the beginning of execution and skipped in later invocations. |
boolean |
isSafeArrayAll()
|
void |
printLabelRefList()
Print the label reference list built by buildLabelRefList(). |
void |
removeLabelDef(Label pLabel)
|
void |
resetLabelLink()
resetLabelLink Reset label reference list of labels in this subprogram. |
void |
setAccessedSyms(java.util.Set pAccessedSyms)
|
void |
setEndLabel(Label pLabel)
|
void |
setFlowInf(java.lang.Object pInf)
|
void |
setHirBody(Stmt pHirBody,
Label pStartLabel,
Label pEndLabel)
setHirBody Set the procedural body of this subprogram represented in high level intermediate representation (HIR). |
void |
setNextSubp(Subp pNext)
setNextSubp Set pNext as the subprogram next to this one and make the original next subprogram as the next one of pNext. |
void |
setNoParamSpec()
Permit any number of parameters of any type for this subprogram. |
void |
setOptInf(java.lang.Object pInf)
|
Param |
setOptionalParam()
setOptionalParam -- TO BE DELETED Generate a formal parameter corresponding to "..." in parameter specification and make getOptionalParam() to be true for this subprogram. |
void |
setParallelInf(java.lang.Object pInf)
|
void |
setReturnValueType(Type pType)
setReturnValueType Set the return value type of this subprogram. |
void |
setStartLabel(Label pLabel)
|
void |
setSubpDefinition(SubpDefinition pSubpDefinition)
setSubpDefinition Set the SubpDefinition node defining the IR body of this subprogram. |
void |
setSubpKind(int pSubpKind)
setSubpKind Set subprogram kind (subpOrdinary/subpMember/subpConstructor/subpDestructor). |
void |
setSymTable(SymTable pSymTable)
setSymTable Set the symbol table local to this subprogram. |
void |
setVisibility(int pVisibility)
SetVisibility Sset the visibility attribute of the subprogram. |
java.lang.String |
toStringDetail()
toStringDetail Get detailed attributes of this symbol in text which is not interned. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| 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 |
protected Subp fNextSubp
protected int fSubpKind
protected Type fReturnValueType
protected SymTable fLocalSymTable
protected IrList fParamList
protected boolean fParamListIsSet
protected IrList fParamListTemp
protected IrList fParamTypeListTemp
protected Param fOptParam
protected boolean fNoParamSpec
protected IrList fTempVarList
protected int fTempCount
protected IrList fTempDVarList
protected int fTempDCount
protected SubpDefinition fSubpDefinition
protected Stmt fHirBody
protected BlockStmt fInitiationProcess
protected IrList fLabelDefList
protected Label fStartLabel
protected Label fEndLabel
protected IrList fCallList
protected java.util.Set fAccessedSyms
public boolean fSafeArrayAll
protected java.lang.Object fFlowInf
protected java.lang.Object fOptInf
protected java.lang.Object fParallelInf
protected int fErrorCount
| Constructor Detail |
public SubpImpl(SymRoot pSymRoot)
public SubpImpl(SymRoot pSymRoot,
java.lang.String pName,
Type pReturnValueType,
Sym pDefinedIn)
| Method Detail |
public Subp getNextSubp()
getNextSubp in interface Subppublic void setNextSubp(Subp pNext)
setNextSubp in interface SubppNext - subprogram defined in the same scope as this
subprogram.public int getSubpKind()
getSubpKind in interface Subppublic void setSubpKind(int pSubpKind)
setSubpKind in interface SubppSubpKind - subprogram kind to be set to this subprogram.
setSubpKind set the subprogram kind of this subprogram as pSubpKind.public int getVisibility()
getVisibility in interface Subppublic void setVisibility(int pVisibility)
Subp
setVisibility in interface SubppVisibility - visibility attribute to be set by setVisibility.
(SYM_EXTERN, SYM_PUBLIC, SYM_PROTECTED, SYM_PRIVATE,
SYM_COMPILE_UNIT)public SymTable getSymTable()
Subp
getSymTable in interface Subppublic void setSymTable(SymTable pSymTable)
Subp
setSymTable in interface Subppublic Type getReturnValueType()
Subp
getReturnValueType in interface Subppublic void setReturnValueType(Type pType)
Subp
setReturnValueType in interface SubppType - the return value type.public IrList getParamList()
Subp
getParamList in interface Subppublic IrList getParamTypeList()
Subp
getParamTypeList in interface Subppublic void addParam(Param pParam)
SubpAdd parameter to the parameter list of this subprogram. If closeSubpPrototype has been called by processing prototype declaration, getParamTypeList will return the list of parameter types. It is recommended to check the consistency between prototype declaration and subprogram definition before calling addParam for each parameter. If null is returned by getParamTypeList, then prototype declaration is not yet given (closeSubpPrototype is not yet called.) See closeSubpHeader.
addParam in interface Subppublic void addParamType(Type pParamType)
Subp
addParamType in interface Subppublic Param getOptionalParam()
public Param setOptionalParam()
public boolean hasOptionalParam()
Subp
hasOptionalParam in interface Subppublic void setNoParamSpec()
Subp
setNoParamSpec in interface Subppublic boolean hasNoParamSpec()
SubphasNoParamSpec in interface Subppublic void closeSubpHeader()
SubpFinalize the header part of subprogram. This method will set subprogram type for this subprogram and set other inevitable information for this subprogram. Before calling this method, addParam, setOptionalParam, setVisibility should be called if required and return value type should be given if required as it is written in defineSubp of Sym interface. It is the responsibility of language dependent front end to check the consistency between prototype declaration and subprogram definition. If closeSubpPrototype has been called by processing prototype declaration, getParamTypeList will return the list of parameter types. It is recommended to check the consistency between prototype declaration and subprogram definition before calling addParam for each parameter. The closeSubpHeader will adjust the parameter type list according to the list get by getParamList and so the consistency check will not be effective after the call.
closeSubpHeader in interface Subppublic void closeSubpPrototype()
Subp
Finalize a prototype declaration of subprogram.
This method will set subprogram type for this subprogram.
Before calling this method, addParamType, setOptionalParam,
setVisibility should be called if required and return value type
should also be given if required.
It is the responsibility of language dependent front end
to check the consistency between prototype declaration and
subprogram definition.
Typical sequence of processing prototype declaration is:
Subp lSubp = symRoot.sym.defineSubp("name".intern(), returnType);
lSubp.resetParamTypeList(); // If multiple declaration is allowed.
lSubp.addParamType(paramType1);
lSubp.addParamType(paramType2);
....
lSubp.setOptionalparam(); // only when optional parameter is given.
lSubp.setVisibility(Sym.SYM_PUBLIC); // only if public.
lSubp.closeSubpPrototype();
closeSubpPrototype in interface Subppublic SubpDefinition getSubpDefinition()
getSubpDefinition in interface Subppublic void setSubpDefinition(SubpDefinition pSubpDefinition)
Subp
setSubpDefinition in interface SubppSubpDefinition - the SubpDefinition node of this subprogram.public Stmt getHirBody()
getHirBody in interface Subp
public void setHirBody(Stmt pHirBody,
Label pStartLabel,
Label pEndLabel)
setHirBody in interface SubppHirBody - procedural body represented in HIR specifying
operations to be performed when this subprogram is called.
setHirBody set pHirBody as the HIR procedural body of this subprogram.pStartLabel - Label to be attached at entry point.pEndLabel - Label to be attached at exit point.public BlockStmt initiationProcedure()
public void addInitiationStmt(Stmt pInitiation)
pInitiation - statement to be put in the ititiation block.public IrList getLabelDefList()
public void resetLabelLink()
Subp
resetLabelLink in interface Subppublic void addToLabelDefList(Label pLabel)
public void removeLabelDef(Label pLabel)
public Stmt getStmtWithLabel(Label pLabel)
Subp
getStmtWithLabel in interface SubppLabel - Label with which Stmt is to be searched.
public Label getStartLabel()
Subp
getStartLabel in interface Subppublic void setStartLabel(Label pLabel)
setStartLabel in interface Subppublic Label getEndLabel()
Subp
getEndLabel in interface Subppublic void setEndLabel(Label pLabel)
setEndLabel in interface Subppublic IrList getCallList()
getCallList in interface Subppublic void addToCallList(Subp pCallee)
addToCallList in interface SubppCallee - a subprogram called in this subprogram.public java.util.Set getAccessedSyms()
public void setAccessedSyms(java.util.Set pAccessedSyms)
public java.lang.Object getFlowInf()
getFlowInf in interface Subppublic void setFlowInf(java.lang.Object pInf)
setFlowInf in interface Subppublic java.lang.Object getOptInf()
getOptInf in interface Subppublic void setOptInf(java.lang.Object pInf)
setOptInf in interface Subppublic java.lang.Object getParallelInf()
getParallelInf in interface Subppublic void setParallelInf(java.lang.Object pInf)
setParallelInf in interface Subppublic boolean isSafeArrayAll()
isSafeArrayAll in interface Subppublic void addToErrorCount(int pCount)
Subp
addToErrorCount in interface Subppublic int getErrorCount()
Subp
getErrorCount in interface Subppublic void buildLabelRefList()
Subp
buildLabelRefList in interface Subppublic void printLabelRefList()
Subp
printLabelRefList in interface Subppublic java.lang.String toStringDetail()
Sym
toStringDetail in interface SymtoStringDetail in class SymImpl
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||