coins.ir.hir
インタフェース Exp
- すべてのスーパーインタフェース:
- java.lang.Cloneable, HIR, HIR0, IR, IR0
- 既知のサブインタフェースの一覧:
- ConstNode, ElemNode, ExpListExp, FunctionExp, LabelNode, NullNode, PhiExp, PointedExp, QualifiedExp, SubpNode, SubscriptedExp, SymNode, TypeNode, VarNode
- 既知の実装クラスの一覧:
- ConstNodeImpl, ElemNodeImpl, ExpImpl, ExpListExpImpl, FunctionExpImpl, LabelNodeImpl, NullNodeImpl, PhiExpImpl, PointedExpImpl, QualifiedExpImpl, SubpNodeImpl, SubscriptedExpImpl, SymNodeImpl, TypeNodeImpl, VarNodeImpl
- public interface Exp
- extends HIR
Exp interface
HIR Exp class interface.
The expression class Exp is a subclass of HIR.
See IR, HIR, Stmt, Sym, IrList.
インタフェース 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 |
メソッドの概要 |
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 buildFunctionExp.
|
Exp |
getSubscriptExp()
|
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 evaluated or not.
|
インタフェース 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.hir.HIR0 から継承したメソッド |
accept, 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 |
getConstSym
public Const getConstSym()
- getConstSym
Get constant symbol attached to this node.
"this" should be a constant node.
- 戻り値:
- constant symbol attached to this node.
getVar
public Var getVar()
- getVar
Get symbol of specified class from SymNode. (##2)
"this" should be a SymNode.
- 戻り値:
- 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()
- getSubp
Get symbol of spefified class from SymNode. (##2)
"this" should be a SymNode.
- 戻り値:
- 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()
- getLabel
Get symbol of spefified class from SymNode. (##2)
"this" should be a SymNode.
- 戻り値:
- 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()
- getElem
Get symbol of spefified class from SymNode. (##2)
"this" should be a SymNode.
- 戻り値:
- 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.
- 戻り値:
- 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.
- 戻り値:
- the source operand 2 expression of this node.
getArrayExp
public Exp getArrayExp()
- getArrayExp (##2)
getSubscriptExp
getElemSizeExp (##2)
Get a component of a subscripted variable.
"this" should be a node built by buildSubscriptedVar method.
- 戻り値:
- a component expression of this subscripted variable.
getSubscriptExp
public Exp getSubscriptExp()
getElemSizeExp
public Exp getElemSizeExp()
getPointerExp
public Exp getPointerExp()
- getPointerExp
getPointedElem
Get a component of pointed variable expression.
"this" should be a node built by buildPointedVar method.
- 戻り値:
- a component expression of this pointed variable.
getPointedElem
public Elem getPointedElem()
getQualifierExp
public Exp getQualifierExp()
- getQualifier
getQualifiedElem
Get a component of qualified variable expression.
"this" should be a node built by BuildQualifiedVar method.
- 戻り値:
- a component of "this" QualifiedVar expression. (##2)
getQualifiedElem
public Elem getQualifiedElem()
getSubpSpec
public Exp getSubpSpec()
- getSubpSpec (##2)
getActualParamList
Get a component expression of the function expression. (##2)
"this" should be a node built by buildFunctionExp.
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.
getActualParamList
public IrList 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.
isEvaluable
public boolean isEvaluable()
- isEvaluable
See if "this" expression can be evaluated or not.
Following expressions are evaluable expression: //##14
constant expression,
expression whose operands are all evaluable expressions.
Expressions with OP_ADDR or OP_NULL are treated as non evaluable.
Variable with initial value is also treated as non evaluable
because its value may change. //##43
- 戻り値:
- 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.
- 戻り値:
- constant as the result of evaluation or null(when failing in the
evaluation)
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.
- 戻り値:
- constant as the result of evaluation or null (when failing in the
evaluation)
evaluateAsInt
public int evaluateAsInt()
- 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.
- 戻り値:
- integer value as the result of evaluation.
evaluateAsLong
public long evaluateAsLong()
- Evaluate "this" expression as long.
"this" should be an evaluable expression. If not, this method returns 0.
- 戻り値:
- long value as the result of evaluation.
evaluateAsFloat
public float evaluateAsFloat()
- 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.
- 戻り値:
- float value as the result of evaluation.
evaluateAsDouble
public double evaluateAsDouble()
- 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.
- 戻り値:
- float value as the result of evaluation.
getValueString
public java.lang.String getValueString()
- 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.
- 戻り値:
- a string representing the evaluated result.
adjustTypesOfBinaryOperands
public 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).
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()
- パラメータ:
pExp1
- operand 1.pExp2
- operand 2.
- 戻り値:
- (HIR.OP_SEQ, adjusted_operand1, adjusted_operand2)
initiateArray
public 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.
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.
- パラメータ:
pArray
- array variable expression.pInitExp
- initial value to be set.pFrom
- array index start positionpTo
- array index end positionpSubp
- subprogram containing the initiation statement.
null for global variable initiation.
- 戻り値:
- the loop statement to set initial value.