18#include <boost/foreach.hpp>
19#include "filteredCFG.h"
20#include <boost/unordered_map.hpp>
21#include "reachingDefUnfilteredCfg.h"
23#include <uniqueNameTraversal.h>
25namespace ssa_unfiltered_cfg
34 ROSE_ASSERT(funcDecl != NULL);
38 && !isSgTemplateInstantiationMemberFunctionDecl(funcDecl))
48 bool returnValue =
true;
52 && !isSgTemplateInstantiationMemberFunctionDecl(funcDecl))
59 printf (
"In FunctionFilter::operator(): funcDecl = %p = %s name = %s returnValue = %s \n",funcDecl,funcDecl->
class_name().c_str(),funcDecl->get_name().str(),returnValue ?
"true" :
"false");
90 typedef std::vector<SgInitializedName*>
VarName;
92 typedef boost::shared_ptr<ReachingDef> ReachingDefPtr;
97 typedef std::map<CFGNode, std::set<VarName> > CFGNodeToVarNamesMap;
99 typedef std::map<SgNode*, std::set<SgVarRefExp*> > ASTNodeToVarRefsMap;
101 typedef std::map<CFGNode, NodeReachingDefTable> CFGNodeToDefTableMap;
105 ASTNodeToVarRefsMap astNodeToUses;
109 CFGNodeToDefTableMap localDefTable;
113 CFGNodeToDefTableMap reachingDefTable;
117 CFGNodeToDefTableMap outgoingDefTable;
128 static bool getDebug()
133 static bool getDebugExtra()
144 static bool isBuiltinVar(
const VarName& var);
159 void expandParentMemberDefinitions(
const CFGNodeToVarNamesMap& defs);
165 void insertDefsForChildMemberUses(
const CFGNodeToVarNamesMap& defs,
const std::set<VarName>& usedNames);
168 void insertDefsForExternalVariables(
SgFunctionDefinition* function,
const std::set<VarName>& usedNames);
174 void insertPhiFunctions(
SgFunctionDefinition* function,
const std::vector<CFGNode>& cfgNodesInPostOrder);
180 void renumberAllDefinitions(
SgFunctionDefinition* func,
const std::vector<CFGNode>& cfgNodesInPostOrder);
184 void updateIncomingPropagatedDefs(
const CFGNode& cfgNode);
188 bool propagateDefs(
const CFGNode& cfgNode);
197 void printToDOT(
SgNode* root, std::ostream &outFile);
198 void printToFilteredDOT(
SgSourceFile* file, std::ofstream &outFile);
213 void toDOT(
const std::string fileName);
311 static void printFullDefTable(
const CFGNodeToDefTableMap& defTable);
SgDeclarationStatement * get_definingDeclaration() const
This is an access function for the SgDeclarationStatement::p_definingDeclaration data member (see tha...
This class represents the notion of an expression. Expressions are derived from SgLocatedNodes,...
This class represents the concept of a function declaration statement.
virtual std::string class_name() const override
returns a string representing the class name
This class represents the concept of a scope in C++ (e.g. global scope, fuction scope,...
virtual Sg_File_Info * get_file_info() const override
Interface function to implement original SAGE interface to SgFile_Info objects.
This class represents the base class for all IR nodes within Sage III.
This class represents a source project, with a list of SgFile objects and global information about th...
static int get_verbose(void)
DQ: Modified to accept a value on the command line (no longer a boolean variable) value of 0 means qu...
This class represents the concept of a scope in C++ (e.g. global scope, fuction scope,...
This class represents the variable refernece in expressions.
bool isCompilerGenerated() const
Returns true only if compiler generated (either by the front-end or by ROSE).
Class holding a unique name for a variable.
void toFilteredDOT(const std::string fileName)
Print the CFG with any UniqueNames and Def/Use information visible.
const NodeReachingDefTable & getDefsAtNode(const CFGNode &node) const
Returns the definitions that occur at the given node.
void toDOT(const std::string fileName)
Print the CFG with any UniqueNames and Def/Use information visible.
static const VarName & getVarForExpression(SgNode *node)
If an expression evaluates to a reference of a variable, returns that variable.
const ReachingDefPtr getDefinitionForUse(SgVarRefExp *astNode) const
Given a use obtained through getUsesAtNode, resolve its corresponding def.
const NodeReachingDefTable & getReachingDefsBefore(SgNode *astNode) const
Get the reaching definitions before the given AST node is executed.
const NodeReachingDefTable & getLastVersions(SgFunctionDefinition *astNode) const
Get the final versions of all the variables at the end of the given function.
std::map< VarName, ReachingDefPtr > NodeReachingDefTable
A map from each variable to its reaching definitions at the current node.
static SgExpression * buildVariableReference(const VarName &var, SgScopeStatement *scope=NULL)
Get an AST fragment containing the appropriate varRefs and Dot/Arrow ops to access the given variable...
static std::string varnameToString(const VarName &vec)
Get a string representation of a varName.
const NodeReachingDefTable & getReachingDefsAfter(const CFGNode &node) const
Returns the reaching definitions after the given node was executed.
static ssa_private::VarUniqueName * getUniqueName(SgNode *node)
Get the uniqueName attribute for the given node.
const std::set< SgVarRefExp * > & getUsesAtNode(SgNode *astNode) const
Returns all the SgVarRef objects that are used in the execution of the given AST node.
const ASTNodeToVarRefsMap & getUseTable() const
Returns the entire use table, mapping each non-statement AST node to the variables used in its execut...
static const VarName & getVarName(SgNode *node)
Get the variable name of the given node.
static bool isPrefixOfName(VarName name, VarName prefix)
Find if the given prefix is a prefix of the given name.
const NodeReachingDefTable & getReachingDefsBefore(const CFGNode &node) const
Returns the reaching definitions before the given node was executed.
void run()
Run the analysis.
const NodeReachingDefTable & getReachingDefsAfter(SgNode *astNode) const
Get the reaching definitions after the given AST node is executed.
std::vector< SgInitializedName * > VarName
A compound variable name as used by the variable renaming.
This filter determines which function declarations get processed in the analysis.