ExtractFunctionArguments¶
This normalization makes sure each function call argument is a side-effect free expression of only one variable. To accomplish this, temporary variables are declared and the arguments of a function are evaluated before the function itself. Note: Normalization is not performed if it is unsafe. E,g.: while(Foo(Bar()) {} is not equal to t = Bar(); while(Foo(t) {} Note that only SgFunctionCall arguments are normalized. For example the arguments of the constructor initializer MyObject o(foo(), bar()) will not be extracted.
Synopsis¶
Declared in <src/midend/programTransformation/extractFunctionArgumentsNormalization/ExtractFunctionArguments.h>
class ExtractFunctionArguments; Member Functions¶
| Name | Description |
|---|---|
GetTemporariesIntroducedstd::vector<SgVariableDeclaration*> GetTemporariesIntroduced(); | |
IsNormalizablebool IsNormalizable(SgNode* tree); | |
IsNormalizedbool IsNormalized(SgNode* tree); | |
NormalizeTreevoid NormalizeTree( SgNode* tree, bool doUnsafeNormalization = false); | Performs the function argument extraction on all function calls in the given subtree of the AST. |
Private Member Functions¶
| Name | Description |
|---|---|
AreAllFunctionCallsNormalizablebool AreAllFunctionCallsNormalizable(std::vector<FunctionCallInfo> functions); | |
AreAllFunctionCallsTrivialbool AreAllFunctionCallsTrivial(std::vector<FunctionCallInfo> functions); | |
FunctionArgsNeedNormalizationbool FunctionArgsNeedNormalization(SgExprListExp* functionArgs); | Returns true if any of the arguments of the given function call will need to be extracted. |
FunctionArgumentCanBeNormalizedbool FunctionArgumentCanBeNormalized(SgExpression* argument); | |
FunctionArgumentNeedsNormalizationbool FunctionArgumentNeedsNormalization(SgExpression* argument); | Given the expression which is the argument to a function call, returns true if that expression should be pulled out into a temporary variable on a separate line. E.g. if the expression contains a function call, it needs to be normalized, while if it is a constant, there is no need to change it. |
InsertStatementvoid InsertStatement( SgStatement* newStatement, SgStatement* location, FunctionCallInfo const& insertionMode); | Insert a new statement in the specified location. The actual insertion can occur either before or after the location depending on the insertion mode. |
IsFunctionArgumentTrivialbool IsFunctionArgumentTrivial(SgExpression* argument); | |
RewriteFunctionCallArgumentsvoid RewriteFunctionCallArguments(FunctionCallInfo const& functionCallInfo); | Given the information about a function call (obtained through a traversal), extract its arguments into temporary variables where it is necessary. |
SubtreeNeedsNormalizationbool SubtreeNeedsNormalization(SgNode* top); | Returns true if any function calls in the given subtree will need to be instrumented. (to extract function arguments). |
Private Data Members¶
| Name |
|---|
functionCalls |
temporariesIntroduced |
Created with MrDocs