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);
35 bool returnValue =
true;
39 && !isSgTemplateInstantiationMemberFunctionDecl(funcDecl))
73 typedef std::vector<SgInitializedName*>
VarName;
75 typedef boost::shared_ptr<ReachingDef> ReachingDefPtr;
80 typedef std::map<CFGNode, std::set<VarName> > CFGNodeToVarNamesMap;
82 typedef std::map<SgNode*, std::set<SgVarRefExp*> > ASTNodeToVarRefsMap;
84 typedef std::map<CFGNode, NodeReachingDefTable> CFGNodeToDefTableMap;
88 ASTNodeToVarRefsMap astNodeToUses;
92 CFGNodeToDefTableMap localDefTable;
96 CFGNodeToDefTableMap reachingDefTable;
100 CFGNodeToDefTableMap outgoingDefTable;
111 static bool getDebug()
116 static bool getDebugExtra()
127 static bool isBuiltinVar(
const VarName& var);
142 void expandParentMemberDefinitions(
const CFGNodeToVarNamesMap& defs);
148 void insertDefsForChildMemberUses(
const CFGNodeToVarNamesMap& defs,
const std::set<VarName>& usedNames);
151 void insertDefsForExternalVariables(
SgFunctionDefinition* function,
const std::set<VarName>& usedNames);
157 void insertPhiFunctions(
SgFunctionDefinition* function,
const std::vector<CFGNode>& cfgNodesInPostOrder);
163 void renumberAllDefinitions(
SgFunctionDefinition* func,
const std::vector<CFGNode>& cfgNodesInPostOrder);
167 void updateIncomingPropagatedDefs(
const CFGNode& cfgNode);
171 bool propagateDefs(
const CFGNode& cfgNode);
180 void printToDOT(
SgNode* root, std::ostream &outFile);
181 void printToFilteredDOT(
SgSourceFile* file, std::ofstream &outFile);
196 void toDOT(
const std::string fileName);
294 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.
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.