coins.ir.hir
クラス ExpImpl

java.lang.Object
  |
  +--coins.ir.hir.HIR_Impl
        |
        +--coins.ir.hir.ExpImpl
すべての実装インタフェース:
java.lang.Cloneable, Exp, HasStringObject, HIR, HIR0, IR, IR0
直系の既知のサブクラス:
ComplexExp, ExpListExpImpl, FortranCharacterExp, FunctionExpImpl, NullNodeImpl, PhiExpImpl, PointedExpImpl, QualifiedExpImpl, SubscriptedExpImpl, SymNodeImpl

public class ExpImpl
extends HIR_Impl
implements Exp

ExpImpl HIR expression class. The expression class Exp is a subclass of HIR.


フィールドの概要
 
クラス coins.ir.hir.HIR_Impl から継承したフィールド
fAdditionalChild, fChildCount, fChildNode1, fChildNode2, fDbgLevel, fHirAnnex, fOperator, fParentNode, fType, hirRoot, inversionTable, machineParam, sourceLanguage
 
インタフェース coins.ir.hir.HIR から継承したフィールド
OP_CODE_NAME, OP_CODE_NAME_DENSE
 
インタフェース coins.ir.IR から継承したフィールド
OP_INF, OP_LIST, OP_PROG, OP_SUBP_DEF
 
インタフェース coins.ir.hir.HIR0 から継承したフィールド
FLAG_C_PTR, FLAG_CONST_EXP, FLAG_INIT_BLOCK, FLAG_LOOP_WITH_CONDITIONAL_INIT, FLAG_NOCHANGE, FLAG_NONTERMINAL, OP_ADD, OP_ADD_ASSIGN, OP_ADDR, OP_AND, OP_AND_ASSIGN, OP_ARROW, OP_ASM, OP_ASSIGN, OP_BLOCK, OP_CALL, OP_CMP_EQ, OP_CMP_GE, OP_CMP_GT, OP_CMP_LE, OP_CMP_LT, OP_CMP_NE, OP_COMMA, OP_CONST, OP_CONTENTS, OP_CONV, OP_DECAY, OP_DIV, OP_DIV_ASSIGN, OP_ELEM, OP_ENCLOSE, OP_EQ_ZERO, OP_EXP_STMT, OP_EXPLIST, OP_EXPREPEAT, OP_FOR, OP_IF, OP_INDEX, OP_INDEXED_LOOP, OP_JUMP, OP_LABEL, OP_LABEL_DEF, OP_LABELED_STMT, OP_LG_AND, OP_LG_OR, OP_MOD, OP_MOD_ASSIGN, OP_MULT, OP_MULT_ASSIGN, OP_NEG, OP_NOT, OP_NULL, OP_OFFSET, OP_OR, OP_OR_ASSIGN, OP_PARAM, OP_PHI, OP_POST_DECR, OP_POST_INCR, OP_PRE_DECR, OP_PRE_INCR, OP_QUAL, OP_REPEAT, OP_RETURN, OP_SELECT, OP_SEQ, OP_SETDATA, OP_SHIFT_L_ASSIGN, OP_SHIFT_LL, OP_SHIFT_R, OP_SHIFT_R_ASSIGN, OP_SHIFT_RL, OP_SIZEOF, OP_STMT, OP_STMT_UPPER, OP_SUB, OP_SUB_ASSIGN, OP_SUBP, OP_SUBS, OP_SWITCH, OP_SYM, OP_TYPE, OP_UNDECAY, OP_UNTIL, OP_VAR, OP_WHILE, OP_XOR, OP_XOR_ASSIGN
 
コンストラクタの概要
ExpImpl(HirRoot pHirRoot)
           
ExpImpl(HirRoot pHirRoot, int pOperator)
           
ExpImpl(HirRoot pHirRoot, int pOperator, Exp pExp1)
          Build an instance of unary expression.
ExpImpl(HirRoot pHirRoot, int pOperator, Exp pExp1, Exp pExp2)
          Build an instance of binary expression.
ExpImpl(HirRoot pHirRoot, int pOperator, Exp pExp1, Exp pExp2, Exp pExp3)
           
 
メソッドの概要
 void accept(HirVisitor pVisitor)
          accept Acceptor used in HIR visitor.
 Exp adjustTypesOfBinaryOperands(Exp pExp1, Exp pExp2)
          Adjust the types of binary operands according to the C language specifications (See ISO/IEC 9899-1999 Programming language C section 6.3.1.8).
 Const evaluate()
          Evaluate "this" expression.
 double evaluateAsDouble()
          evaluateAsDouble Evaluate "this" expression as double.
 float evaluateAsFloat()
          evaluateAsFloat Evaluate "this" expression as float.
 int evaluateAsInt()
          evaluateAsInt Evaluate "this" expression as int.
 long evaluateAsLong()
          Evaluate "this" expression as long.
 SubpType findSubpType()
          findSubpType Find SubpType represented by this expression.
 Exp fold()
          Fold "this" expression.
 IrList getActualParamList()
           
 Exp getArrayExp()
          getArrayExp (##2) getSubscriptExp getElemSizeExp (##2) Get a component of a subscripted variable.
 Const getConstSym()
          getConstSym Get constant symbol attached to this node.
 Elem getElem()
          getElem Get symbol of spefified class from SymNode. (##2) "this" should be a SymNode.
 Exp getElemSizeExp()
           
 Exp getExp1()
          getExp1 Get source operand 1 from unary or binary expression.
 Exp getExp2()
          getExp2 Get source operand 2 from binary expression.
 Label getLabel()
          getLabel Get symbol of spefified class from SymNode. (##2) "this" should be a SymNode.
 Elem getPointedElem()
           
 Exp getPointerExp()
          getPointerExp getPointedElem Get a component of pointed variable expression.
 Elem getQualifiedElem()
           
 Exp getQualifierExp()
          getQualifier getQualifiedElem Get a component of qualified variable expression.
 Subp getSubp()
          getSubp Get symbol of spefified class from SymNode. (##2) "this" should be a SymNode.
 Exp getSubpSpec()
          getSubpSpec (##2) getActualParamList Get a component expression of the function expression. (##2) "this" should be a node built by functionExp.
 Exp getSubscriptExp()
           
 Sym getSym()
          getSym Get symbol from SymNode.
 java.lang.String getValueString()
          getValueString //##40 Evaluate this subtree and return the result as a string.
 Var getVar()
          getVar Get symbol of specified class from SymNode. (##2) "this" should be a SymNode.
 Stmt initiateArray(Exp pArray, Exp pInitExp, Exp pFrom, Exp pTo, Subp pSubp)
          initiateArray //##15 Create loop statement to initiate all elements of the array pArray and append it to the initiation block of subprogram pSubp.
 boolean isEvaluable()
          isEvaluable: See if "this" expression can be currently evaluated or not.
 boolean isLValue()
           
 
クラス coins.ir.hir.HIR_Impl から継承したメソッド
addInf, addrExp, asmStmt, assignStmt, blockStmt, callStmt, checkLinkage, clone, conditionalExp, conditionalExp1, constNode, contains, contentsExp, convExp, copyInfListFrom, copyWithOperands, copyWithOperandsChangingLabels, cutParentLink, cutParentLink, decayExp, elemNode, exp, exp, exp, expList, expRepeat, expStmt, falseNode, fatalError, finishHir, flagsAreAllFalse, forStmt, forStmt, functionExp, getChild, getChild1, getChild2, getChildCount, getChildNumber, getClone, getExpId, getFlag, getFlagBox, getFlowAnalSym, getIndentSpace, getIndex, getInf, getInfList, getInfString, getIrName, getNextNode, getNextNodeSeeingAncestor, getNextStmt, getOperator, getParent, getResultOperand, getResultVar, getSourceNode, getSourceNode1, getSourceNode2, getStmtContainingThisNode, getSymOrExpId, getType, getWork, hirClone, hirIterator, hirList, hirNodeClone, hirSeq, hirSeq, hirSeq, ifStmt, indexedLoopStmt, indexedLoopStmt, infStmt, infStmt, intConstNode, intConstNode, irList, irList, isEmpty, isHIR, isLIR, isSameAs, isStmt, isSym, isTerminal, isTree, isTree, jumpStmt, labelDef, labeledStmt, labelNode, nullNode, nullStmt, offsetConstNode, phiExp, pointedExp, print, print, program, qualifiedExp, removeInf, repeatStmt, repeatStmt, replaceOperator, replaceResultOperand, replaceResultVar, replaceSource, replaceSource1, replaceSource2, replaceThisNode, returnStmt, returnStmt, setChild, setChild1, setChild2, setChildren, setChildren, setChildren, setChildren, setDataStmt, setFlag, setIndex, setIndexNumberToAllNodes, setIndexNumberToAllNodes, setIndexNumberToAllNodes2, setParameters, setParent, setType, setWork, severeError, sizeofExp, sizeofExp, slightError, subpDefinition, subpDefinition, subpDefinition, subpIterator, subpNode, subscriptedExp, subscriptedExp, switchStmt, symNode, toString, toStringDetail, toStringShort, toStringWithChildren, trueNode, typeNode, undecayExp, undecayExp, undecayExp, undecayExp, varNode, warinig, whileStmt, whileStmt, withInf
 
クラス java.lang.Object から継承したメソッド
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
インタフェース coins.ir.hir.HIR から継承したメソッド
addrExp, asmStmt, checkLinkage, conditionalExp, contains, copyInfListFrom, cutParentLink, exp, expList, expRepeat, forStmt, getExpId, getFlowAnalSym, getIndentSpace, getInfString, getIrName, getSourceNode, getSourceNode1, getSourceNode2, getSymOrExpId, getWork, hirNodeClone, hirSeq, hirSeq, indexedLoopStmt, indexedLoopStmt, infStmt, infStmt, intConstNode, irList, isEmpty, isStmt, isTree, nullNode, nullStmt, offsetConstNode, phiExp, repeatStmt, replaceSource, replaceSource1, replaceSource2, returnStmt, setChild1, setChild2, setChildren, setChildren, setDataStmt, setIndex, setIndexNumberToAllNodes, setParent, setType, setWork, subpDefinition, subpIterator, subscriptedExp, toString, toStringDetail, toStringShort, toStringWithChildren, undecayExp, undecayExp, undecayExp, whileStmt
 
インタフェース coins.ir.IR から継承したメソッド
addInf, getChild1, getChild2, getInf, getInfList, getParent, print, print, removeInf
 
インタフェース coins.ir.IR0 から継承したメソッド
getChild, getChildCount, getIndex, getOperator, setChild
 
インタフェース coins.ir.hir.HIR0 から継承したメソッド
assignStmt, blockStmt, callStmt, constNode, contentsExp, convExp, copyWithOperands, copyWithOperandsChangingLabels, decayExp, elemNode, exp, exp, expStmt, falseNode, finishHir, forStmt, functionExp, getChildNumber, getFlag, getFlagBox, getNextStmt, getStmtContainingThisNode, getType, hirClone, hirIterator, hirList, hirSeq, ifStmt, intConstNode, irList, isSameAs, jumpStmt, labelDef, labeledStmt, labelNode, pointedExp, print, program, qualifiedExp, repeatStmt, replaceThisNode, returnStmt, setFlag, setIndexNumberToAllNodes, sizeofExp, sizeofExp, subpDefinition, subpNode, subscriptedExp, switchStmt, symNode, trueNode, undecayExp, varNode, whileStmt
 

コンストラクタの詳細

ExpImpl

public ExpImpl(HirRoot pHirRoot)

ExpImpl

public ExpImpl(HirRoot pHirRoot,
               int pOperator)

ExpImpl

public ExpImpl(HirRoot pHirRoot,
               int pOperator,
               Exp pExp1)
Build an instance of unary expression. 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.)

パラメータ:
pHirRoot - Specify the current instance of HirRoot.
pOperator - Operator of the unary expression.
pExp1 - Operand expression.

ExpImpl

public ExpImpl(HirRoot pHirRoot,
               int pOperator,
               Exp pExp1,
               Exp pExp2)
Build an instance of binary expression. 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.)

パラメータ:
pHirRoot - Specify the current instance of HirRoot.
pOperator - Operator of the binary expression.
pExp1 - Operand 1 expression.

ExpImpl

public ExpImpl(HirRoot pHirRoot,
               int pOperator,
               Exp pExp1,
               Exp pExp2,
               Exp pExp3)
メソッドの詳細

getConstSym

public Const getConstSym()
getConstSym Get constant symbol attached to this node. "this" should be a constant node.

定義:
インタフェース Exp 内の getConstSym
戻り値:
constant symbol attached to this node.

getSym

public Sym getSym()
getSym Get symbol from SymNode. "this" should be a SymNode (either VarNode, SubpNode, LabelNode, ElemNode, or FieldNode). (##2)

定義:
インタフェース IR 内の getSym
オーバーライド:
クラス HIR_Impl 内の getSym
戻り値:
the symbol attached to the node (either Var, Subp, Label, Elem, or Field).

getVar

public Var getVar()
インタフェース Exp の記述:
getVar Get symbol of specified class from SymNode. (##2) "this" should be a SymNode.

定義:
インタフェース Exp 内の getVar
戻り値:
the symbol of specified class attached to the node. If the symbol is not attached to the node or if its class is not the specified class, then return null.

getSubp

public Subp getSubp()
インタフェース Exp の記述:
getSubp Get symbol of spefified class from SymNode. (##2) "this" should be a SymNode.

定義:
インタフェース Exp 内の getSubp
戻り値:
the symbol of specified class attached to the node. If the symbol is not attached to the node or if its class is not the specified class, then return null.

getLabel

public Label getLabel()
インタフェース Exp の記述:
getLabel Get symbol of spefified class from SymNode. (##2) "this" should be a SymNode.

定義:
インタフェース Exp 内の getLabel
戻り値:
the symbol of specified class attached to the node. If the symbol is not attached to the node or if its class is not the specified class, then return null.

getElem

public Elem getElem()
インタフェース Exp の記述:
getElem Get symbol of spefified class from SymNode. (##2) "this" should be a SymNode.

定義:
インタフェース Exp 内の getElem
戻り値:
the symbol of specified class attached to the node. If the symbol is not attached to the node or if its class is not the specified class, then return null.

getExp1

public Exp getExp1()
getExp1 Get source operand 1 from unary or binary expression. "this" should be either unary or binary expression.

定義:
インタフェース Exp 内の getExp1
戻り値:
the source operand 1 expression of this node.

getExp2

public Exp getExp2()
getExp2 Get source operand 2 from binary expression. "this" should be a binary expression.

定義:
インタフェース Exp 内の getExp2
戻り値:
the source operand 2 expression of this node.

getArrayExp

public Exp getArrayExp()
インタフェース Exp の記述:
getArrayExp (##2) getSubscriptExp getElemSizeExp (##2) Get a component of a subscripted variable. "this" should be a node built by buildSubscriptedVar method.

定義:
インタフェース Exp 内の getArrayExp
戻り値:
a component expression of this subscripted variable.

getSubscriptExp

public Exp getSubscriptExp()
定義:
インタフェース Exp 内の getSubscriptExp

getElemSizeExp

public Exp getElemSizeExp()
定義:
インタフェース Exp 内の getElemSizeExp

getPointerExp

public Exp getPointerExp()
インタフェース Exp の記述:
getPointerExp getPointedElem Get a component of pointed variable expression. "this" should be a node built by buildPointedVar method.

定義:
インタフェース Exp 内の getPointerExp
戻り値:
a component expression of this pointed variable.

getPointedElem

public Elem getPointedElem()
定義:
インタフェース Exp 内の getPointedElem

getQualifierExp

public Exp getQualifierExp()
インタフェース Exp の記述:
getQualifier getQualifiedElem Get a component of qualified variable expression. "this" should be a node built by BuildQualifiedVar method.

定義:
インタフェース Exp 内の getQualifierExp
戻り値:
a component of "this" QualifiedVar expression. (##2)

getQualifiedElem

public Elem getQualifiedElem()
定義:
インタフェース Exp 内の getQualifiedElem

getSubpSpec

public Exp getSubpSpec()
getSubpSpec (##2) getActualParamList Get a component expression of the function expression. (##2) "this" should be a node built by functionExp. getSubpSpec return the expression specifying the subprogram to be called (pSubpSpec). (##2) getActualParamList return the actual parameter list (pParamList). If this has no parameter, then return null.

定義:
インタフェース Exp 内の getSubpSpec

getActualParamList

public IrList getActualParamList()
定義:
インタフェース Exp 内の getActualParamList

findSubpType

public SubpType findSubpType()
findSubpType Find SubpType represented by this expression. If this is SubpNode then return SubpType pointed by this node type, else decompose this expression to find Subpnode. If illegal type is encountered, return null.

定義:
インタフェース Exp 内の findSubpType

isEvaluable

public boolean isEvaluable()
isEvaluable: See if "this" expression can be currently evaluated or not.

定義:
インタフェース Exp 内の isEvaluable
戻り値:
true if this expression can be evaluated as constant value at the invocation of this method, false otherwise.

evaluate

public Const evaluate()
Evaluate "this" expression.

定義:
インタフェース Exp 内の evaluate
戻り値:
constant as the result of evaluation or null(when failing in the evaluation)

evaluateAsInt

public int evaluateAsInt()
インタフェース Exp の記述:
evaluateAsInt Evaluate "this" expression as int. "this" should be an evaluable expression. If not, this method returns 0. It is strongly recommended to confirm isEvaluable() returns true for this expression before calling this method.

定義:
インタフェース Exp 内の evaluateAsInt
戻り値:
integer value as the result of evaluation.

evaluateAsLong

public long evaluateAsLong()
インタフェース Exp の記述:
Evaluate "this" expression as long. "this" should be an evaluable expression. If not, this method returns 0.

定義:
インタフェース Exp 内の evaluateAsLong
戻り値:
long value as the result of evaluation.

evaluateAsFloat

public float evaluateAsFloat()
インタフェース Exp の記述:
evaluateAsFloat Evaluate "this" expression as float. "this" should be an evaluable expression. If not, this method returns 0.0. It is strongly recommended to confirm isEvaluable() returns true for this expression before calling this method.

定義:
インタフェース Exp 内の evaluateAsFloat
戻り値:
float value as the result of evaluation.

evaluateAsDouble

public double evaluateAsDouble()
インタフェース Exp の記述:
evaluateAsDouble Evaluate "this" expression as double. "this" should be an evaluable expression. If not, this method returns 0.0. It is strongly recommended to confirm isEvaluable() returns true for this expression before calling this method.

定義:
インタフェース Exp 内の evaluateAsDouble
戻り値:
float value as the result of evaluation.

adjustTypesOfBinaryOperands

public Exp adjustTypesOfBinaryOperands(Exp pExp1,
                                       Exp pExp2)
インタフェース Exp の記述:
Adjust the types of binary operands according to the C language specifications (See ISO/IEC 9899-1999 Programming language C section 6.3.1.8). The result is an expression (HIR.OP_SEQ, adjusted_operand1, adjusted_operand2). The operands can be get by ((HIR)lResult.getChild1()).copyWithOperands() ((HIR)lResult.getChild2()).copyWithOperands()

定義:
インタフェース Exp 内の adjustTypesOfBinaryOperands
パラメータ:
pExp1 - operand 1.
pExp2 - operand 2.
戻り値:
(HIR.OP_SEQ, adjusted_operand1, adjusted_operand2)

fold

public Exp fold()
Fold "this" expression. evaluate() is called by recursive. If the evaluation succeeded, former node is substituted for the constant node generated as evaluation result.

定義:
インタフェース Exp 内の fold
戻り値:
constant as the result of evaluation or null (when failing in the evaluation)

initiateArray

public Stmt initiateArray(Exp pArray,
                          Exp pInitExp,
                          Exp pFrom,
                          Exp pTo,
                          Subp pSubp)
インタフェース Exp の記述:
initiateArray //##15 Create loop statement to initiate all elements of the array pArray and append it to the initiation block of subprogram pSubp. The initiation statement to be created for pSubp is for (i = pFrom; i <= pTo; i++) pArray[i] = pInitExp; If pSubp is null, set-data statement is generated.

定義:
インタフェース Exp 内の initiateArray
パラメータ:
pArray - array variable expression.
pInitExp - initial value to be set.
pFrom - array index start position
pTo - array index end position
pSubp - subprogram containing the initiation statement. null for global variable initiation.
戻り値:
the loop statement to set initial value.

getValueString

public java.lang.String getValueString()
インタフェース Exp の記述:
getValueString //##40 Evaluate this subtree and return the result as a string. If the result is constant, then return the string representing the constant. If the result is not a constant, then return a string representing the resultant expression. It is strongly recommended to confirm isEvaluable() returns true for this expression before calling this method.

定義:
インタフェース Exp 内の getValueString
戻り値:
a string representing the evaluated result.

isLValue

public boolean isLValue()

accept

public void accept(HirVisitor pVisitor)
インタフェース HIR0 の記述:
accept Acceptor used in HIR visitor. See HirVisitor, HirVisitorModel1, HirVisitormodel2.

定義:
インタフェース HIR0 内の accept
オーバーライド:
クラス HIR_Impl 内の accept
パラメータ:
pVisitor - HirVisitor