|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcoins.ir.hir.HIR_Impl
HIR_Impl class
| Field Summary | |
protected IR[] |
fAdditionalChild
|
protected int |
fChildCount
|
protected IR |
fChildNode1
|
protected IR |
fChildNode2
|
protected int |
fDbgLevel
|
protected HirAnnex |
fHirAnnex
|
protected int |
fOperator
|
protected IR |
fParentNode
|
protected Type |
fType
|
HirRoot |
hirRoot
|
(package private) static int[] |
inversionTable
|
protected static MachineParam |
machineParam
|
protected static SourceLanguage |
sourceLanguage
|
| Fields inherited from interface coins.ir.hir.HIR |
OP_CODE_NAME, OP_CODE_NAME_DENSE |
| Fields inherited from interface coins.ir.IR |
OP_INF, OP_LIST, OP_PROG, OP_SUBP_DEF |
| Constructor Summary | |
|
HIR_Impl()
Default constructor |
|
HIR_Impl(HirRoot pHirRoot)
Constructor to set hirRoot |
protected |
HIR_Impl(HirRoot pHirRoot,
int pOperator)
Usually, HIR constructor should be given operation code. |
| Method Summary | |
void |
accept(HirVisitor pVisitor)
accept Acceptor used in HIR visitor. |
void |
addInf(java.lang.String pInfKindInterned,
java.lang.Object pInfObject)
addInf Add (attach) information pInfObject to this IR node. |
Exp |
addrExp(Exp pExp)
addrExp Build addr expression representing the address of pExp. |
AsmStmt |
asmStmt(java.lang.String pInstructions,
HirList pActualParamList)
asmStmt Make a statement representing asm( formalParams, instructionList, actualParams ). |
AssignStmt |
assignStmt(Exp pLeft,
Exp pRight)
assignStmt Build an assignemnt statement. |
BlockStmt |
blockStmt(Stmt pStmtSequence)
blockStmt Make an instance of block statement that may contain a sequence of statements. |
ExpStmt |
callStmt(Exp pSubpSpec,
IrList pActualParamList)
callStmt Build a subprogram call statement. |
void |
checkLinkage(java.lang.String pHeader)
Check parent-child linkage if debug level (ioRoot.dbgHir.getLevel()) is greater than 0. |
java.lang.Object |
clone()
clone Override Object.clone in HIR. |
Exp |
conditionalExp(Exp pExp)
conditionalExp builds boolean expression to be used as conditional expression of IfStmt and LoopStmt. |
Exp |
conditionalExp1(Exp pExp)
|
ConstNode |
constNode(Const pConst)
constNode Make a ConstNode instance having constant symbol pConst. |
boolean |
contains(HIR pSubtree)
Check if pSubtree is contained in this subtree. |
Exp |
contentsExp(Exp pPointerExp)
contentsExp Build an expression that gets the contents pointed by pPointerExp. |
Exp |
convExp(Type pType,
Exp pExp)
convExp Build an expression to convert the type of pExp to pType. |
void |
copyInfListFrom(HIR pFromHir)
Copy the contents of InfList attached to pFromHir to the InfList of this node. |
HIR |
copyWithOperands()
copyWithOperands |
HIR |
copyWithOperandsChangingLabels(IrList pLabelCorrespondence)
copyWithOperandsChangingLabels Copy this subtree changing labels that are defined in this subtree to avoid label duplication. |
void |
cutParentLink()
cutParentLink Cut both links from/to parent node if they exist. |
void |
cutParentLink(int pChildNumber)
|
Exp |
decayExp(Exp pExp)
decayExp Build an expression that decay a vector to a pointer to vector element, or decay a String into a pointer to Char element. |
ElemNode |
elemNode(Elem pElem)
elemNode Make an ElemNode instance having Elem symbol pElem. |
Exp |
exp(int pOperator,
Exp pExp1)
exp |
Exp |
exp(int pOperator,
Exp pExp1,
Exp pExp2)
exp Build binary expression. |
Exp |
exp(int pOperator,
Exp pExp1,
Exp pExp2,
Exp pExp3)
exp: Build ternary expression (OP_SELECT, etc.). |
Exp |
expList(java.util.List pList)
expList Make an expression representing a list of expressions, that is, make an instance of ExpListExp. |
Exp |
expRepeat(Exp pValue,
Exp pCount)
expRepeat Make an expression representing a list of expressions of the same value. |
ExpStmt |
expStmt(Exp pExp)
expStmt Create a statement treating pExp as a statement. |
ConstNode |
falseNode()
falseNode Make a ConstNode instance having boolean false value. |
void |
fatalError(int pId,
java.lang.String pMessage)
|
boolean |
finishHir()
finishHir does closing operations for HIR. |
boolean |
flagsAreAllFalse()
|
ForStmt |
forStmt(Stmt pInitStmt,
Exp pCondition,
Stmt pLoopBody,
Stmt pStepPart)
|
ForStmt |
forStmt(Stmt pInitStmt,
Label pLoopBackLabel,
Exp pCondition,
Stmt pLoopBody,
Label pLoopStepLabel,
Stmt pStepPart,
Label pLoopEndLabel)
|
FunctionExp |
functionExp(Exp pFunctionSpec,
IrList pActualParamList)
functionExp Build a function expression node that computes function value. |
IR |
getChild(int pNumber)
getChild |
IR |
getChild1()
getChild1 Get the first child of this node. |
IR |
getChild2()
getChild2 Get the second child of this node. |
int |
getChildCount()
getChildCount Get the number of children that may be attached to this node. |
int |
getChildNumber()
getChildNumber Get the child number of this node. |
IR |
getClone()
|
ExpId |
getExpId()
getExpId Get the expression identifier assigned to this node. |
boolean |
getFlag(int pFlagNumber)
getFlag returns the value (true/false) of the flag indicated by pFlagNumber. |
FlagBox |
getFlagBox()
getFlagBox Users are recommended to use getFlag( int pFlagNumber ) except when they understand the treatment of FlagBox in detail. |
FlowAnalSym |
getFlowAnalSym()
getFlowAnalSym Get the flow analysis symbol assigned to this node if it is given. |
java.lang.String |
getIndentSpace(int pIndent)
getIndentSace Get a sequence of spaces specified by pIndent. |
int |
getIndex()
getIndex Get the index number assigned to "this" node. |
java.lang.Object |
getInf(java.lang.String pInfKindInterned)
getInf Get the information of the kind pInfKindInterned. |
IrList |
getInfList()
getInfList Get the information list attached to this node. |
java.lang.String |
getInfString()
Get the string image of Inf. |
java.lang.String |
getIrName()
getIrName Get operation name and node index to display node in compact form for flow analysis, debug, etc. |
HIR |
getNextNode()
getNextNode is not recommended to be used in traversing HIR subtree because it has high overhead. |
protected HIR |
getNextNodeSeeingAncestor(HIR pHir)
|
Stmt |
getNextStmt()
getNextStmt Get statement next to this statement. |
int |
getOperator()
getOperator Get operation code of "this" node. |
IR |
getParent()
getParent Get the parent of this node. |
Sym |
getResultOperand()
|
Sym |
getResultVar()
|
HIR |
getSourceNode(int pNumber)
getSourceNode Get the pNumber-th source operand of "this" node. |
HIR |
getSourceNode1()
getSourceNode1 Get the 1st source operand node of "this" node where the source is an operand used/refered in "this" operation. |
HIR |
getSourceNode2()
getSourceNode2 Get the 2nd source operand node of "this" node. |
Stmt |
getStmtContainingThisNode()
getStmtContainingThisNode Get the innermost statement or LabeledStmt containing this node by traversing ancestors of this node. |
Sym |
getSym()
getSym Get the symbol represented by "this" node if this is a node representing a symbol (simple variable, element/field name, subprogram, label, constant, etc.). |
FlowAnalSym |
getSymOrExpId()
getSymOrExpId If this is a SymNode with FlowAnalSym instance, then return it else return getExpId(). |
Type |
getType()
getType Get the type attached to this node. |
java.lang.Object |
getWork()
getWork Get information set by setWork for this node. |
HIR |
hirClone()
hirClone Make the clone of this node to get a clone in the situation where clone() can not be used directly. |
HirIterator |
hirIterator(IR pSubtree)
hirIterator |
HirList |
hirList()
|
HIR |
hirNodeClone()
Make a copy of this HIR node without copying children. |
HirSeq |
hirSeq(HIR pChild1)
hirSeq Make an HirSeq node that have some definite number of children. |
HirSeq |
hirSeq(HIR pChild1,
HIR pChild2)
hirSeq Make an HirSeq node that have some definite number of children. |
HirSeq |
hirSeq(HIR pChild1,
HIR pChild2,
HIR pChild3)
hirSeq Make an HirSeq node that have some definite number of children. |
IfStmt |
ifStmt(Exp pCondition,
Stmt pThenPart,
Stmt pElsePart)
ifStmt Build an if-statement with then-part (pThenPart) and else-part (pElsePart). |
IndexedLoopStmt |
indexedLoopStmt(Var pLoopIndex,
Exp pStartValue,
Exp pEndValue,
Exp pStepValue,
boolean pUpward,
Stmt pStmtBody)
|
IndexedLoopStmt |
indexedLoopStmt(Var pLoopIndex,
Exp pStartValue,
Exp pEndValue,
Exp pStepValue,
Stmt pStmtBody)
|
InfStmt |
infStmt(java.lang.String pInfKind,
IrList pInfData)
infStmt Build an InfStmt representing some information. |
InfStmt |
infStmt(java.lang.String pInfKind,
java.lang.Object pInfData)
|
ConstNode |
intConstNode(int pIntValue)
intConstNode Make a ConstNode instance having pIntValue as its value. |
ConstNode |
intConstNode(long pIntValue)
intConstNode Make a ConstNode instance having pIntValue as its value. |
IrList |
irList()
irList Make an empty HirList node that make a LinkedList. |
IrList |
irList(java.util.LinkedList pList)
irList Make an HirList node that makes a LinkedList. |
boolean |
isEmpty(HIR pHir)
isEmpty Decide if pHir is empty or not, where empty means either null, NullNode, HIR with OP_NULL as its operator, LabeledStmt whose statement body isEmpty, or ExpStmt whose Exp part isEmpty. |
boolean |
isHIR()
Test if this is an HIR object. |
boolean |
isLIR()
|
boolean |
isSameAs(HIR pTree)
isSameAs Compare this tree with pTree and if they have the same tree shape (same operator and same operands) then return true. |
boolean |
isStmt()
isStmt |
boolean |
isSym()
Test if this is a Sym object. |
boolean |
isTerminal()
|
boolean |
isTree()
isTree Test if this does not violates tree structure, that is, detect node adherence in branches and handshake miss in parent-child relation. |
protected boolean |
isTree(java.util.Set pVisitedNodes,
int pErrorCounter,
java.util.Set pSetOfLabels)
isTree Test if this does not violates tree structure, that is, detect node adherence in branches and handshake miss in parent-child relation. |
JumpStmt |
jumpStmt(Label pLabelSym)
jumpStmt Create a jump statement and increment reference count of pLabelSym. |
LabelDef |
labelDef(Label pLabel)
labelDef Make a LabelDef instance that defines the label pLabel. |
LabeledStmt |
labeledStmt(Label pLabel,
Stmt pStmt)
labeledStmt Build labeled statement using pLabel as its label and pStmt as its statement body. |
LabelNode |
labelNode(Label pLabel)
labelNode Make a LabelNode instance having Label symbol pLabel. |
NullNode |
nullNode()
nullNode Make a NullNode instance. |
Stmt |
nullStmt()
nullStmt Make a statement having NullNode as its statement body. |
ConstNode |
offsetConstNode(long pIntValue)
offsetConstNode Make a ConstNode instance having pIntValue as its offset value. |
PhiExp |
phiExp(Var pVar,
Label pLabel)
phiExp Make a phi expression used in SSA. |
PointedExp |
pointedExp(Exp pStructUnionExp,
ElemNode pElemNode)
pointedExp Build a pointed expression. |
void |
print(int pIndent)
Print the object. |
void |
print(int pIndent,
boolean pDetail)
Print the object. |
Program |
program(Sym pProgSym,
SymTable pGlobalSymTable,
IR pInitiationPart,
IrList pSubpList)
program Make a program node. |
QualifiedExp |
qualifiedExp(Exp pStructUnionExp,
ElemNode pElemNode)
qualifiedExp Build a qualified expression. |
void |
removeInf(java.lang.String pInfKindInterned)
removeInf Remove the information of the kind pInfKindInterned. |
RepeatStmt |
repeatStmt(Label pLoopBackLabel,
Stmt pLoopBody,
Label pLoopStepLabel,
Exp pCondition,
Label pLoopEndLabel)
|
RepeatStmt |
repeatStmt(Stmt pLoopBody,
Exp pCondition)
|
void |
replaceOperator(int pOperator)
|
void |
replaceResultOperand(HIR pOperand)
|
void |
replaceResultVar(HIR pOperand)
|
HIR |
replaceSource(int pNumber,
IR pOperand)
replaceSource Replace pNumber-th source operand of "this" node by pOperand. |
HIR |
replaceSource1(HIR pOperand)
replaceSource1 Replace the source operand 1 of "this" node by pOperand. |
HIR |
replaceSource2(HIR pOperand)
replaceSource2 Replace the source operand 2 of "this" node by pOperand. |
HIR |
replaceThisNode(HIR pNewNode)
replaceThisNode Replace "this" node by pNewNode. |
ReturnStmt |
returnStmt()
returnStmt Build return statement that terminates the execution of current subprogram under construction. |
ReturnStmt |
returnStmt(Exp pReturnValue)
returnStmt Build return statement that terminates the execution of current subprogram under construction. |
void |
setChild(int pNumber,
IR pHir)
setChild Set pHir as pNumber-th child of this node. |
void |
setChild1(IR pChild)
|
void |
setChild2(IR pChild)
|
void |
setChildren(IR p1,
IR p2)
|
void |
setChildren(IR p1,
IR p2,
IR p3)
|
void |
setChildren(IR p1,
IR p2,
IR p3,
IR p4)
|
void |
setChildren(IR p1,
IR p2,
IR p3,
IR p4,
IR p5)
|
SetDataStmt |
setDataStmt(Exp pVariable,
Exp pValueExp)
setDataStmt Make the statement that sets initial value or a list of initial values (pValueExp) to a variable (pVariable). |
void |
setFlag(int pFlagNumber,
boolean pYesNo)
setFlag setFlag sets the flag of specified number. |
void |
setIndex(int pIndex)
setIndex Set an index number to "this" node. |
int |
setIndexNumberToAllNodes(int pStartNumber)
setIndexNumberToAllNodes Set sequencial index number to all nodes traversing the subtree rooted by this node in depth-first order. |
int |
setIndexNumberToAllNodes(int pStartNumber,
boolean pResetSymIndex)
Set index number to all nodes and if pResetSymIndex is true, reset Sym index by resetFlowAnalInf for FlowAnalSym nodes. |
int |
setIndexNumberToAllNodes2(int pStartNumber,
boolean pResetSymIndex)
|
void |
setParameters(MachineParam pMachineParam,
SourceLanguage pSourceLanguage)
|
void |
setParent(IR pParent)
setParent Set the parent of this node as pParent. |
void |
setType(Type pType)
setType Attach a type to this node. |
void |
setWork(java.lang.Object pWork)
setWork Set information privately used in each phase. |
void |
severeError(int pId,
java.lang.String pMessage)
|
Exp |
sizeofExp(Exp pExp)
sizeofExp Build the expression that get the size of pExp. |
Exp |
sizeofExp(Type pType)
sizeofExp Build the expression that get the size of pType. |
void |
slightError(int pId,
java.lang.String pMessage)
|
SubpDefinition |
subpDefinition(Subp pSubpSym)
|
SubpDefinition |
subpDefinition(Subp pSubpSym,
SymTable pLocalSymTable)
subpDefifnition Make a subprogram definition node and set symRoot.subpCurrent = pSubpSym, set symRoot.symTableCurrentSubp = pLocalSymTable. |
SubpDefinition |
subpDefinition(Subp pSubpSym,
SymTable pLocalSymTable,
BlockStmt pInitiationPart,
BlockStmt pHIRbody)
subpDefinition with full specification. |
java.util.Iterator |
subpIterator()
subpIterator Make an iterator that traverses all subprogram definitions in the current compile unit. |
SubpNode |
subpNode(Subp pSubp)
subpNode Make a SubpNode instance having Subp symbol pSubp. |
SubscriptedExp |
subscriptedExp(Exp pArrayExp,
Exp pSubscript)
subscriptedExp Build a subscripted expression. |
Exp |
subscriptedExp(Exp pArrayExp,
Exp pSubscript,
Exp pElemSize)
subscriptedExp Build an expression representing the indicated element of a vector whose element size is unfixed. |
SwitchStmt |
switchStmt(Exp pSelectExp,
IrList pJumpList,
Label pDefaultLabel,
Stmt pSwitchBody,
Label pEndLabel)
switchStmt Make a SwitchStmt instance. |
SymNode |
symNode(Sym pSym)
symNode Make a SymNode instance having pSym as attached symbol. |
java.lang.String |
toString()
toString Get text representation of this node without traversing children. |
java.lang.String |
toStringDetail()
toStringDetail Get text string of this node showing detail information. |
java.lang.String |
toStringShort()
toStringShort Get text string of this node showing node name and index only. |
java.lang.String |
toStringWithChildren()
toStringWithChildren Get the string of this node and its children traversing the children in depth-first order. |
ConstNode |
trueNode()
trueNode Make a ConstNode instance having boolean true value. |
TypeNode |
typeNode(Type pType)
|
Exp |
undecayExp(Exp pPointerExp,
ConstNode pElemCount)
undecayExp Build an expression that undecay a pointer to a vector whose element type is pointed type. |
Exp |
undecayExp(Exp pPointerExp,
Exp pElemCount,
Exp pLowerBound)
undecayExp Build an expression that undecay a pointer to a vector whose element type is pointed type. |
Exp |
undecayExp(Exp pPointerExp,
long pElemCount)
undecayExp Build an expression that undecay a pointer to a vector whose element type is pointed type. |
Exp |
undecayExp(Exp pPointerExp,
long pElemCount,
long pLowerBound)
undecayExp Build an expression that undecay a pointer to a vector whose element type is pointed type. |
VarNode |
varNode(Var pVar)
varNode Make a VarNode instance having Var symbol pVar. |
void |
warinig(int pId,
java.lang.String pMessage)
|
WhileStmt |
whileStmt(Exp pCondition,
Stmt pLoopBody)
|
WhileStmt |
whileStmt(Label pLoopBackLabel,
Exp pCondition,
Stmt pLoopBody,
Label pLoopStepLabel,
Label pLoopEndLabel)
ifStmt Build an if-statement with then-part (pThenPart) and else-part (pElsePart). |
boolean |
withInf()
|
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public final HirRoot hirRoot
protected int fOperator
protected IR fChildNode1
protected IR fChildNode2
protected IR[] fAdditionalChild
protected IR fParentNode
protected int fChildCount
protected HirAnnex fHirAnnex
protected Type fType
protected final int fDbgLevel
protected static MachineParam machineParam
protected static SourceLanguage sourceLanguage
static final int[] inversionTable
| Constructor Detail |
public HIR_Impl()
public HIR_Impl(HirRoot pHirRoot)
protected HIR_Impl(HirRoot pHirRoot,
int pOperator)
| Method Detail |
public void setParameters(MachineParam pMachineParam,
SourceLanguage pSourceLanguage)
public int getOperator()
IR0
getOperator in interface IR0public IR getParent()
IR
getParent in interface IRpublic void setParent(IR pParent)
HIR
setParent in interface HIRpParent - node to be set as parent of this node.public int getChildCount()
IR0
getChildCount in interface IR0public IR getChild1()
IR
getChild1 in interface IRpublic IR getChild2()
IR
getChild2 in interface IRpublic IR getChild(int pNumber)
IR0
getChild in interface IR0pNumber - the child number of the child to be returned.
public void setChild1(IR pChild)
setChild1 in interface HIRpublic void setChild2(IR pChild)
setChild2 in interface HIR
public void setChild(int pNumber,
IR pHir)
setChild in interface IR0pNumber - Child numberpublic int getChildNumber()
HIR0
getChildNumber in interface HIR0
public void addInf(java.lang.String pInfKindInterned,
java.lang.Object pInfObject)
IR
addInf in interface IRpInfObject - Object to be added as information.
It may be String, Sym, IR, List, and so on,
hence they may be non-IR elements.public java.lang.Object getInf(java.lang.String pInfKindInterned)
IR
getInf in interface IRpublic void removeInf(java.lang.String pInfKindInterned)
IR
removeInf in interface IRpublic IrList getInfList()
IR
getInfList in interface IRpublic void copyInfListFrom(HIR pFromHir)
HIR
copyInfListFrom in interface HIRpFromHir - HIR node that may have InfList.public java.lang.String getInfString()
HIR
getInfString in interface HIRpublic boolean withInf()
public java.lang.Object getWork()
HIR
getWork in interface HIRpublic void setWork(java.lang.Object pWork)
HIR
setWork in interface HIRpWork - any information of arbitrary class to be set to this node;
You may define a new class that represents arbitrary information
and give its reference as pWork.
This method is moved to IR interface.public int getIndex()
IR0
getIndex in interface IR0public void setIndex(int pIndex)
HIR
setIndex in interface HIRpIndex - the index number to be assigned to "this" node.public boolean isStmt()
HIR
isStmt in interface HIRpublic Stmt getStmtContainingThisNode()
HIR0
getStmtContainingThisNode in interface HIR0public ExpId getExpId()
HIR
getExpId in interface HIRpublic FlowAnalSym getSymOrExpId()
HIR
getSymOrExpId in interface HIRpublic FlowAnalSym getFlowAnalSym()
HIR
getFlowAnalSym in interface HIRpublic HIR getSourceNode1()
HIR
getSourceNode1 in interface HIRpublic HIR getSourceNode2()
HIR
getSourceNode2 in interface HIRpublic HIR getSourceNode(int pNumber)
HIR
getSourceNode in interface HIRpNumber - 1: source 1, 2: source 2, 3: source 3, ... .
public Sym getSym()
IR
getSym in interface IRpublic Sym getResultOperand()
public Sym getResultVar()
public HIR replaceSource1(HIR pOperand)
HIR
replaceSource1 in interface HIRpOperand - node that take place of source operand 1.public HIR replaceSource2(HIR pOperand)
HIR
replaceSource2 in interface HIRpOperand - node that take place of source operand 2.
public HIR replaceSource(int pNumber,
IR pOperand)
HIR
replaceSource in interface HIRpNumber - 1: source 1, 2: source 2, 3: source 3, ... .pOperand - node that take place of source operand.public void replaceResultOperand(HIR pOperand)
public void replaceResultVar(HIR pOperand)
public HIR replaceThisNode(HIR pNewNode)
HIR0
replaceThisNode in interface HIR0pNewNode - node that takes place of "this" node.public void replaceOperator(int pOperator)
public void cutParentLink()
HIR
cutParentLink in interface HIRpublic void cutParentLink(int pChildNumber)
public boolean isSym()
HasStringObject
isSym in interface HasStringObjectpublic boolean isHIR()
HasStringObject
isHIR in interface HasStringObjectpublic boolean isLIR()
public boolean isEmpty(HIR pHir)
HIR
isEmpty in interface HIRpHir - HIR node to be tested if empty or not.
public boolean isTerminal()
public boolean contains(HIR pSubtree)
HIR
contains in interface HIRpSubtree - subtree to be searched.
public java.lang.String toString()
HIR
toString in interface HIRpublic java.lang.String toStringShort()
HIR
toStringShort in interface HIRpublic java.lang.String toStringDetail()
HIR
toStringDetail in interface HIRpublic java.lang.String toStringWithChildren()
HIR
toStringWithChildren in interface HIRpublic java.lang.String getIrName()
HIR
getIrName in interface HIRpublic void print(int pIndent)
HasStringObject
print in interface IRpIndent - number of heading spaces for indentation.
public void print(int pIndent,
boolean pDetail)
HasStringObject
print in interface IRpIndent - number of heading spaces for indentation.pDetail - true if detail print is requested, false otherwise.public java.lang.String getIndentSpace(int pIndent)
HIR
getIndentSpace in interface HIRpIndent - number of spaces to be generated.
public int setIndexNumberToAllNodes(int pStartNumber)
HIR0
setIndexNumberToAllNodes in interface HIR0pStartNumber - starting value of the index
(greater than 0).
public int setIndexNumberToAllNodes(int pStartNumber,
boolean pResetSymIndex)
HIR
setIndexNumberToAllNodes in interface HIRpStartNumber - pResetSymIndex - true if resetFlowAnalInf is to be done.
public int setIndexNumberToAllNodes2(int pStartNumber,
boolean pResetSymIndex)
public boolean finishHir()
HIR0
finishHir does closing operations for HIR.
finishHir should be called for Program or SubpDefinition
when HIR building or restructuring were completed in such
timing as
at the end of new HIR generation in front-end
(call for hirRoot.programRoot),
at the end of restructuring (optimization, parallelization, etc.)
(call for corresponding SubpDefinition subtree).
If finishHir is scheduled to be called for programRoot after successive
generation or restructuring of SubpDefinitions before passing it to other
phases, then it is unnecessary to call it for each SubpDefinition.
finishHir set index number to all nodes of this subtree
and verifies its tree structure.
It also certificates the value of getHirPosition() for labels //##60
and buildLabelRefList is called for SubpDefinition
(for Program, buildLabelRefList is called for every SubpDefinitions). //##62
If finishHir is called then it is not necessary to call
setIndexNumberToAllNnodes() nor isTree().
If error is found, then finishHir() returns false after isuing
error message. If no error is found then it returns true.
In either case, processing will continue.
finishHir in interface HIR0
public void warinig(int pId,
java.lang.String pMessage)
public void slightError(int pId,
java.lang.String pMessage)
public void severeError(int pId,
java.lang.String pMessage)
public void fatalError(int pId,
java.lang.String pMessage)
public Program program(Sym pProgSym,
SymTable pGlobalSymTable,
IR pInitiationPart,
IrList pSubpList)
HIR0
program in interface HIR0pProgSym - Program name (may be null).pGlobalSymTable - Symbol table for global symbols.pInitiationPart - Initiation statement (may be null).pSubpList - List of subprograms; At first, it may be
an empty list; (See addSubpDefinition of Program interface).
public SubpDefinition subpDefinition(Subp pSubpSym,
SymTable pLocalSymTable)
HIR0
subpDefinition in interface HIR0pSubpSym - Subprogram symbol. Should be given.pLocalSymTable - Symbol table local in the subprogram;
If subprogram uses a local symbol table, this parameter
should be given (by using pushSymTable() of SymTable
interface); If the source language permits no local symbol
for subprogram, this parameter may be null.
public SubpDefinition subpDefinition(Subp pSubpSym)
public SubpDefinition subpDefinition(Subp pSubpSym,
SymTable pLocalSymTable,
BlockStmt pInitiationPart,
BlockStmt pHIRbody)
HIR
subpDefinition in interface HIRpSubpSym - Subprogram symbol. Should be given.pLocalSymTable - Symbol table local in the subprogram;
If subprogram uses a local symbol table, this parameter
should be given (by using pushSymTable() of SymTable
interface); Even if the source program does not use
local symbol, this parameter is required to register
temporal variables and internal labels generated by
the compiler. //##51pInitiationPart - Initiation statement block. optional.pHIRbody - Subprogram body in HIR. optional.public IrList irList(java.util.LinkedList pList)
HIR
irList in interface HIRpList - List of objects to be included in the HirList;
The elements of the list are an HIR object or Sym object.
public IrList irList()
HIR0
irList in interface HIR0public HirList hirList()
hirList in interface HIR0
public InfStmt infStmt(java.lang.String pInfKind,
IrList pInfData)
HIR
infStmt in interface HIRpInfKind - pInfData -
public InfStmt infStmt(java.lang.String pInfKind,
java.lang.Object pInfData)
infStmt in interface HIRpublic VarNode varNode(Var pVar)
HIR0
varNode in interface HIR0pVar - Variable symbol to be attached to the node.
public ElemNode elemNode(Elem pElem)
HIR0
elemNode in interface HIR0pElem - Struct/union element symbol to be attached to the node.
public SubpNode subpNode(Subp pSubp)
HIR0
subpNode in interface HIR0pSubp - Subprogram symbol to be attached to the node.
public TypeNode typeNode(Type pType)
public LabelNode labelNode(Label pLabel)
HIR0
labelNode in interface HIR0pLabel - Label symbol to be attached to the node.
public ConstNode constNode(Const pConst)
HIR0
constNode in interface HIR0pConst - Constant symbol to be attached to the node.
public ConstNode intConstNode(int pIntValue)
HIR
intConstNode in interface HIRpIntValue - Integer value to be attached to the node.
public ConstNode intConstNode(long pIntValue)
HIR0
intConstNode in interface HIR0pIntValue - Integer value to be attached to the node.
public ConstNode offsetConstNode(long pIntValue)
HIR
offsetConstNode in interface HIRpIntValue - Offset value to be attached to the node.
public ConstNode trueNode()
HIR0
trueNode in interface HIR0public ConstNode falseNode()
HIR0
falseNode in interface HIR0public SymNode symNode(Sym pSym)
HIR0
symNode in interface HIR0pSym - Symbol to be attached to the node.
public NullNode nullNode()
HIR
nullNode in interface HIRpublic LabelDef labelDef(Label pLabel)
HIR0
labelDef in interface HIR0pLabel - Label symbol to be defined.
public Exp exp(int pOperator,
Exp pExp1)
HIR0
Build unary expression according to the
operator given:
OP_NOT // bitwise not (~) one's complement
// logical not for bool (!)
OP_NEG // negate (unary minus)
OP_ADDR // get address (&)
OP_CONTENTS // get contents of pointed memory
OP_CONV // type conversion for basic type
OP_DECAY // convert array to pointer
OP_SIZEOF // sizeof operator
OP_ENCLOSE // honor parenthesis
The type of resultant expression is set according to the rule
described in the HIR specifications, however, it may be necessary
to do language-wise treatment. In such case, front-end part of the
language should set type after creating the instance of Exp.
(In C, expressions related to pointer and vector are specially
treated in C front end ToHirC.)
exp in interface HIR0pOperator - unary operator such as
OP_NOT, OP_NEG, OP_ADDR, OP_CONTENTS, OP_CONV,
OP_DECAY, OP_SIZEOF, OP_ENCLOSE
defined in HIR interface.pExp1 - operand expression.
public Exp exp(int pOperator,
Exp pExp1,
Exp pExp2)
HIR0
exp in interface HIR0pOperator - binary operator such as OP_ADD, OP_MULT, etc.
defined in HIR interface.pExp1 - operand 1 expression.pExp2 - operand 2 expression.
public Exp exp(int pOperator,
Exp pExp1,
Exp pExp2,
Exp pExp3)
HIR
exp in interface HIRpExp1 - operand 1 expression.pExp2 - operand 2 expression.pExp3 - operand 3 expression.
public Exp decayExp(Exp pExp)
HIR0
decayExp in interface HIR0pExp - vector variable or string constant.
public Exp undecayExp(Exp pPointerExp,
ConstNode pElemCount)
HIR
undecayExp in interface HIRpPointerExp - pointer expression pointing to the
first element of the resultant vector.pElemCount - Constant expression showing element count of
the resultant vector.
public Exp undecayExp(Exp pPointerExp,
Exp pElemCount,
Exp pLowerBound)
HIR
undecayExp in interface HIRpPointerExp - pointer expression pointing to the
first element of the resultant vector.pElemCount - Expression showing element count of
the resultant vector.pLowerBound - Expression showing the lower index bound of
the resultant vector.
public Exp undecayExp(Exp pPointerExp,
long pElemCount)
HIR
undecayExp in interface HIRpPointerExp - pointer expression pointing to the
first element of the resultant vector.pElemCount - element count of the resultant vector.
public Exp undecayExp(Exp pPointerExp,
long pElemCount,
long pLowerBound)
HIR0
undecayExp in interface HIR0pPointerExp - pointer expression pointing to the
first element of the resultant vector.pElemCount - element count of the resultant vector.pLowerBound - lower index bound of the resultant vector.
public SubscriptedExp subscriptedExp(Exp pArrayExp,
Exp pSubscript)
HIR0
subscriptedExp in interface HIR0pArrayExp - array expression to which subscript is
to be attached;
If multi-dimensional subscript is required, make pArrayExp
as a subscripted variable and add more subscript by this method.pSubscript - subscript expression.
public Exp subscriptedExp(Exp pArrayExp,
Exp pSubscript,
Exp pElemSize)
HIR
subscriptedExp in interface HIRpArrayExp - is array expression to which subscript is
to be attached (it is unfixed size vector).pSubscript - is subscript expression.pElemSize - is the element size of pArrayExp in bytes.
public QualifiedExp qualifiedExp(Exp pStructUnionExp,
ElemNode pElemNode)
HIR0
qualifiedExp in interface HIR0pStructUnionExp - expression specifying structure or union
or region_variable to qualify.pElemNode - An element of pStructUnionExp.
public PointedExp pointedExp(Exp pStructUnionExp,
ElemNode pElemNode)
HIR0
pointedExp in interface HIR0pStructUnionExp - expression specifying structure or union
whose element is to be pointed.pElemNode - An element of pStructUnionExp.
public Exp contentsExp(Exp pPointerExp)
HIR0
contentsExp in interface HIR0pPointerExp - Expression representing a pointer.
public Exp convExp(Type pType,
Exp pExp)
HIR0
convExp in interface HIR0pType - Type to which pExp is to be changed.pExp - Expression to be converted.
public Exp sizeofExp(Type pType)
HIR0
sizeofExp in interface HIR0pType - Type of object.
public Exp sizeofExp(Exp pExp)
HIR0
sizeofExp in interface HIR0pExp - Expression whose size is to be taken.
public FunctionExp functionExp(Exp pFunctionSpec,
IrList pActualParamList)
HIR0
functionExp in interface HIR0pFunctionSpec - function specification part which may be either
a function name (SubpNode), or an expression specifying
a function name ((addr SubpNode), etc.).pActualParamList - actual parameter list (made by hirList).
public Exp addrExp(Exp pExp)
HIR
addrExp in interface HIRpExp - l-value expression or SubpNode.
public Exp conditionalExp1(Exp pExp)
public Exp conditionalExp(Exp pExp)
HIR
conditionalExp in interface HIRpExp - boolean expression.
public ExpStmt callStmt(Exp pSubpSpec,
IrList pActualParamList)
HIR0
callStmt in interface HIR0pSubpSpec - subprogram specification part which may be either
a subprogram name (SubpNode), or an expression specifying
a subprogram name ((addr SubpNode), etc.).pActualParamList - actual parameter list (made by hirList).
public AssignStmt assignStmt(Exp pLeft,
Exp pRight)
HIR0
assignStmt in interface HIR0pLeft - left hand side (l-value) expression to which
the value of expression is to be assigned.pRight - expression (subtree) that is to be assigned
to pLeftSide.
public IfStmt ifStmt(Exp pCondition,
Stmt pThenPart,
Stmt pElsePart)
HIR0
ifStmt in interface HIR0pCondition - conditional expression subtree.pThenPart - then-part statement that is executed when
pCondition is true.pElsePart - else-part statement that is executed when
pCondition is false.
public WhileStmt whileStmt(Exp pCondition,
Stmt pLoopBody)
whileStmt in interface HIR0
public WhileStmt whileStmt(Label pLoopBackLabel,
Exp pCondition,
Stmt pLoopBody,
Label pLoopStepLabel,
Label pLoopEndLabel)
HIR
whileStmt in interface HIRpCondition - conditional expression subtree.
public ForStmt forStmt(Stmt pInitStmt,
Exp pCondition,
Stmt pLoopBody,
Stmt pStepPart)
forStmt in interface HIR0
public ForStmt forStmt(Stmt pInitStmt,
Label pLoopBackLabel,
Exp pCondition,
Stmt pLoopBody,
Label pLoopStepLabel,
Stmt pStepPart,
Label pLoopEndLabel)
forStmt in interface HIR
public RepeatStmt repeatStmt(Stmt pLoopBody,
Exp pCondition)
repeatStmt in interface HIR0
public RepeatStmt repeatStmt(Label pLoopBackLabel,
Stmt pLoopBody,
Label pLoopStepLabel,
Exp pCondition,
Label pLoopEndLabel)
repeatStmt in interface HIR
public IndexedLoopStmt indexedLoopStmt(Var pLoopIndex,
Exp pStartValue,
Exp pEndValue,
Exp pStepValue,
Stmt pStmtBody)
indexedLoopStmt in interface HIR
public IndexedLoopStmt indexedLoopStmt(Var pLoopIndex,
Exp pStartValue,
Exp pEndValue,
Exp pStepValue,
boolean pUpward,
Stmt pStmtBody)
indexedLoopStmt in interface HIR
public LabeledStmt labeledStmt(Label pLabel,
Stmt pStmt)
HIR0
labeledStmt in interface HIR0public BlockStmt blockStmt(Stmt pStmtSequence)
HIR0
blockStmt in interface HIR0pStmtSequence - statement to be included in BlockStmt
(may be null).
public ReturnStmt returnStmt(Exp pReturnValue)
HIR0
returnStmt in interface HIR0pReturnValue - return value of function subprogram.
If the subprogram has no return value, it is null.
public ReturnStmt returnStmt()
HIR
returnStmt in interface HIRpublic JumpStmt jumpStmt(Label pLabelSym)
HIR0
jumpStmt in interface HIR0pLabelSym - jump target label.
public SwitchStmt switchStmt(Exp pSelectExp,
IrList pJumpList,
Label pDefaultLabel,
Stmt pSwitchBody,
Label pEndLabel)
HIR0
switchStmt in interface HIR0pSelectExp - Expression to select case statement.pJumpList - Jump list that correlate case constant
and case label.pDefaultLabel - label to be attached to default statement part.pSwitchBody - Switch statement body that contains statements
with case-label.pEndLabel - Label as the target of jump corresponding to break.
public ExpStmt expStmt(Exp pExp)
HIR0
expStmt in interface HIR0pExp - expression to be treated as a statement.
public Stmt nullStmt()
HIR
nullStmt in interface HIR
public PhiExp phiExp(Var pVar,
Label pLabel)
HIR
phiExp in interface HIRpVar - variable to be selected.pLabel - label attached to a basic block from which
control tranfers.
public HirSeq hirSeq(HIR pChild1)
HIR
hirSeq in interface HIRpChild1 - Child 1 HIR node.
public HirSeq hirSeq(HIR pChild1,
HIR pChild2)
HIR0
hirSeq in interface HIR0pChild1 - Child 1 HIR node.pChild2 - Child 2 HIR node.
public HirSeq hirSeq(HIR pChild1,
HIR pChild2,
HIR pChild3)
HIR
hirSeq in interface HIRpChild1 - Child 1 HIR node.pChild2 - Child 2 HIR node.pChild3 - Child 3 HIR node.
public SetDataStmt setDataStmt(Exp pVariable,
Exp pValueExp)
HIR
setDataStmt in interface HIRpVariable - Variable to which initial value is to be set.pValueExp - Value or list of values to be set to pVariable.
public Exp expList(java.util.List pList)
HIR
expList in interface HIRpList - list of expressions.
public Exp expRepeat(Exp pValue,
Exp pCount)
HIR
expRepeat in interface HIRpValue - Expression representing a value to be repeated.pCount - Specifies the number of repeat count.
public AsmStmt asmStmt(java.lang.String pInstructions,
HirList pActualParamList)
HIR
asmStmt in interface HIRpInstructions - String representing formal parameters and
sequence of instructions.pActualParamList - List of variable nodes and arithmetic expressions
representing actual parameters.
public void setChildren(IR p1,
IR p2)
setChildren in interface HIR
public void setChildren(IR p1,
IR p2,
IR p3)
setChildren in interface HIR
public void setChildren(IR p1,
IR p2,
IR p3,
IR p4)
public void setChildren(IR p1,
IR p2,
IR p3,
IR p4,
IR p5)
public Type getType()
HIR0
getType in interface HIR0public void setType(Type pType)
HIR
setType in interface HIRpType - type to be attached to this node;
It should represent a proper type corresponding to the
result of subtree represented by this node.public Stmt getNextStmt()
HIR0
getNextStmt in interface HIR0public HIR getNextNode()
protected HIR getNextNodeSeeingAncestor(HIR pHir)
public boolean getFlag(int pFlagNumber)
getFlag in interface HIR0pFlagNumber - flag identification number.
public void setFlag(int pFlagNumber,
boolean pYesNo)
setFlag in interface HIR0pFlagNumber - flag identification number.pYesNo - true or false to be set to the flag.public boolean flagsAreAllFalse()
public FlagBox getFlagBox()
HIR0
getFlagBox in interface HIR0
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
java.lang.CloneNotSupportedException
public IR getClone()
throws java.lang.CloneNotSupportedException
java.lang.CloneNotSupportedExceptionpublic HIR hirClone()
HIR0
hirClone in interface HIR0public HIR hirNodeClone()
HIR
hirNodeClone in interface HIRpublic HIR copyWithOperands()
HIR0Make a subtree that is the same to this subtree. (Labels are not renamed.) In general, a subtree represents the computation of an operation and also the computation of its operands. Flow information is invalid as for copied subtree and should be computed again if required. If the subtree contains labels, it is recommended to use copyWithOperandsChangingLabels. Note that, IfStmt, LoopStmt (for, while, until, etc.), SwitchStmt contain internal labels and it is recommended to use copyWithOperandsChangingLabels to the subtree that may contain these statements. "this" should be the root node of a subtree contained in a subprogram body. Subprogram body itself should not be copied.
copyWithOperands in interface HIR0public HIR copyWithOperandsChangingLabels(IrList pLabelCorrespondence)
copyWithOperandsChangingLabels in interface HIR0pLabelCorrespondence - null if this method is called
from outside HIR access methods. If it is null, it is
computed in this method and passed to subclasses
after copyWithOperands (without changing label).
protected boolean isTree(java.util.Set pVisitedNodes,
int pErrorCounter,
java.util.Set pSetOfLabels)
pVisitedNodes - Give null in usual case;
Set of visited nodes is given when isTree is
invoked recursively by isTree.
public boolean isTree()
HIR
isTree in interface HIRpublic boolean isSameAs(HIR pTree)
isSameAs in interface HIR0pTree - HIR tree to be compared.
public void checkLinkage(java.lang.String pHeader)
HIR
checkLinkage in interface HIRpHeader - name of HIR modification operation.public java.util.Iterator subpIterator()
HIR
subpIterator in interface HIRpublic HirIterator hirIterator(IR pSubtree)
HIR0
Get an iterator to traverse all nodes or statements under
pSubtree. YOu can traverse the subtree by following methods
of HirIterator
next(): traverse all nodes.
getNextStmt(): traverse all statements.
getNextExecutableNode(): traverse executable nodes only.
See HirIterator interface.
hirIterator in interface HIR0pSubtree - root of the subtree to be traversed.
public void accept(HirVisitor pVisitor)
HIR0
accept in interface HIR0pVisitor - HirVisitor
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||