15 #include <boost/foreach.hpp>
16 #include <filteredCFG.h>
17 #include <boost/unordered_map.hpp>
32 ROSE_ASSERT(funcDecl != NULL);
36 if (filename.find(
"include") != std::string::npos)
71 typedef std::vector<SgInitializedName*>
VarName;
88 typedef boost::unordered_map<SgNode*, std::pair<NodeReachingDefTable, NodeReachingDefTable> >
GlobalReachingDefTable;
91 typedef boost::unordered_map<SgNode*, NodeReachingDefTable>
UseTable;
143 void run(
bool interprocedural,
bool treatPointersAsStructures);
161 static bool isBuiltinVar(
const VarName& var);
210 std::multimap< FilteredCfgNode, std::pair<FilteredCfgNode, FilteredCfgEdge> > insertPhiFunctions(
SgFunctionDefinition*
function,
211 const std::vector<FilteredCfgNode>& cfgNodesInPostOrder);
220 void renumberAllDefinitions(
SgFunctionDefinition* func,
const std::vector<FilteredCfgNode>& cfgNodesInPostOrder);
224 void updateIncomingPropagatedDefs(FilteredCfgNode cfgNode);
228 bool propagateDefs(FilteredCfgNode cfgNode);
233 void buildUseTable(
const std::vector<FilteredCfgNode>& cfgNodes);
244 void interproceduralDefPropagation(
const boost::unordered_set<SgFunctionDefinition*>& interestingFunctions);
249 std::vector<SgFunctionDefinition*> calculateInterproceduralProcessingOrder(
250 const boost::unordered_set<SgFunctionDefinition*>& interestingFunctions);
255 const boost::unordered_map<SgFunctionDefinition*, SgGraphNode*>& graphNodeToFunction,
256 std::vector<SgFunctionDefinition*> &processingOrder, std::set<SgFunctionDefinition*> visited);
264 bool insertInterproceduralDefs(
SgFunctionDefinition* funcDef,
const boost::unordered_set<SgFunctionDefinition*>& processed,
272 const boost::unordered_set<SgFunctionDefinition*>& processed,
ClassHierarchyWrapper* classHierarchy);
280 static bool varRequiresThisPointer(
const VarName& var);
292 static bool isDeepConstPointer(
SgType* type);
296 static bool isPointerToDeepConst(
SgType* type);
300 static bool isArgumentNonConstReferenceOrPointer(
SgInitializedName* formalArgument);
304 void printToDOT(
SgSourceFile* file, std::ofstream &outFile);
305 void printToFilteredDOT(
SgSourceFile* file, std::ofstream &outFile);
320 void toDOT(
const std::string fileName);
329 void toFilteredDOT(
const std::string fileName);
331 void printOriginalDefs(
SgNode* node);
332 void printOriginalDefTable();
344 return originalDefTable;
349 return localUsesTable;
355 const NodeReachingDefTable& getOutgoingDefsAtNode(
SgNode* node)
const;
359 const NodeReachingDefTable& getReachingDefsAtNode_(
SgNode* node)
const;
363 const NodeReachingDefTable& getUsesAtNode(
SgNode* node)
const;
367 const NodeReachingDefTable& getDefsAtNode(
SgNode* node)
const;
370 std::set<VarName> getVarsUsedInSubtree(
SgNode* root)
const;
374 std::set<VarName> getVarsDefinedInSubtree(
SgNode* root)
const;
378 std::set<VarName> getOriginalVarsDefinedInSubtree(
SgNode* root)
const;
435 static std::string varnameToString(
const VarName& vec);
437 static void printLocalDefUseTable(
const LocalDefUseTable& table);