ROSE 0.11.145.192
functionEvaluationOrderTraversal.h
1#pragma once
2
3// DQ (10/5/2014): This is more strict now that we include rose_config.h in the sage3basic.h.
4// #include "rose.h"
5// rose.h and sage3basic.h should not be included in librose header files. [Robb P. Matzke 2014-10-15]
6// #include "sage3basic.h"
7
9{
13
16
18 enum
19 {
20 INSIDE_FOR_INIT, INSIDE_FOR_TEST, INSIDE_FOR_INCREMENT, INSIDE_WHILE_CONDITION,
21 INSIDE_DO_WHILE_CONDITION, IN_SAFE_PLACE, INSIDE_CONDITIONAL_EXP_TRUE_ARM, INSIDE_CONDITIONAL_EXP_FALSE_ARM, INSIDE_SHORT_CIRCUIT_EXP_RHS
22 }
24
27};
28
57
58
61
62class FunctionEvaluationOrderTraversal : public AstTopDownBottomUpProcessing<FunctionCallInheritedAttribute, bool>
63{
64public:
67 static std::pair< std::vector<FunctionCallInfo>, std::vector<FunctionCallInfo> > GetFunctionCalls(SgNode* root);
68
71
73 bool evaluateSynthesizedAttribute(SgNode* astNode, FunctionCallInheritedAttribute parentAttribute, SynthesizedAttributesList);
74
77
78private:
79
81
83
85 std::vector<FunctionCallInfo> normalizableFunctionCalls;
87 std::vector<FunctionCallInfo> nonNormalizableFunctionCalls;
88};
89
Attribute Evaluator for inherited and synthesized attributes.
Traverses a given AST and finds all function calls in the order in which they're evaluated Also,...
virtual bool IsFunctionCallSideEffectFree(SgFunctionCallExp *functionCall)
Returns true if the function call has no side effects.
static std::pair< std::vector< FunctionCallInfo >, std::vector< FunctionCallInfo > > GetFunctionCalls(SgNode *root)
Traverses the subtree of the given AST node and finds all function calls in function-evaluation order...
bool evaluateSynthesizedAttribute(SgNode *astNode, FunctionCallInheritedAttribute parentAttribute, SynthesizedAttributesList)
Visits AST nodes in post-order.
FunctionCallInheritedAttribute evaluateInheritedAttribute(SgNode *astNode, FunctionCallInheritedAttribute parentAttribute)
Visits AST nodes in pre-order.
This class represents the concept of a C++ function call (which is an expression).
This class represents the base class for all IR nodes within Sage III.
This class represents the notion of a statement.
Stores a function call expression, along with associated information about its context.
InsertionMode
How a statement should be inserted.
@ APPEND_SCOPE
Insert at the bottom of the scope defined by the given statement.
@ INSERT_BEFORE
Insert right before the given statement.
SgStatement * tempVarDeclarationLocation
When a variable is created to replace one of the arguments of this function, where should it be inser...
InsertionMode tempVarDeclarationInsertionMode
How to insert the temporary variable declaration.
SgFunctionCallExp * functionCall
The function call expression.
enum FunctionCallInheritedAttribute::@719 scopeStatus
Is the current node inside a for loop or conditional expresion structure (not the body).
SgNode * currentScope
The innermost scope inside of which this AST node resides.
SgStatement * lastStatement
The last statement encountered before the current node in the AST.