From ed53fe9945e527570206d419e74e4561da3761cc Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 19 Mar 2005 22:12:33 +0000 Subject: [PATCH] Each DS collection now contains an equivalence class of globals values. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20694 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../Analysis/DataStructure/DataStructure.h | 21 +++++++++++++++++++ .../Analysis/DataStructure/EquivClassGraphs.h | 8 +++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/include/llvm/Analysis/DataStructure/DataStructure.h b/include/llvm/Analysis/DataStructure/DataStructure.h index 1c2f4e654ad..215c4a5409d 100644 --- a/include/llvm/Analysis/DataStructure/DataStructure.h +++ b/include/llvm/Analysis/DataStructure/DataStructure.h @@ -18,11 +18,13 @@ #include "llvm/Target/TargetData.h" #include "llvm/ADT/hash_map" #include "llvm/ADT/hash_set" +#include "llvm/ADT/EquivalenceClasses.h" namespace llvm { class Type; class Instruction; +class GlobalValue; class DSGraph; class DSNode; class DSNodeHandle; @@ -46,6 +48,10 @@ class LocalDataStructures : public ModulePass { // DSInfo, one graph for each function hash_map DSInfo; DSGraph *GlobalsGraph; + + /// GlobalECs - The equivalence classes for each global value that is merged + /// with other global values in the DSGraphs. + EquivalenceClasses GlobalECs; public: ~LocalDataStructures() { releaseMemory(); } @@ -66,6 +72,8 @@ public: DSGraph &getGlobalsGraph() const { return *GlobalsGraph; } + EquivalenceClasses &getGlobalECs() { return GlobalECs; } + /// print - Print out the analysis results... /// void print(std::ostream &O, const Module *M) const; @@ -98,6 +106,10 @@ protected: // This map is only maintained during construction of BU Graphs std::map, std::pair > > *IndCallGraphMap; + + /// GlobalECs - The equivalence classes for each global value that is merged + /// with other global values in the DSGraphs. + EquivalenceClasses GlobalECs; public: ~BUDataStructures() { releaseMemory(); } @@ -118,6 +130,9 @@ public: DSGraph &getGlobalsGraph() const { return *GlobalsGraph; } + EquivalenceClasses &getGlobalECs() { return GlobalECs; } + + /// deleteValue/copyValue - Interfaces to update the DSGraphs in the program. /// These correspond to the interfaces defined in the AliasAnalysis class. void deleteValue(Value *V); @@ -162,6 +177,10 @@ class TDDataStructures : public ModulePass { hash_map DSInfo; hash_set ArgsRemainIncomplete; DSGraph *GlobalsGraph; + + /// GlobalECs - The equivalence classes for each global value that is merged + /// with other global values in the DSGraphs. + EquivalenceClasses GlobalECs; public: ~TDDataStructures() { releaseMyMemory(); } @@ -181,6 +200,8 @@ public: } DSGraph &getGlobalsGraph() const { return *GlobalsGraph; } + EquivalenceClasses &getGlobalECs() { return GlobalECs; } + /// deleteValue/copyValue - Interfaces to update the DSGraphs in the program. /// These correspond to the interfaces defined in the AliasAnalysis class. diff --git a/include/llvm/Analysis/DataStructure/EquivClassGraphs.h b/include/llvm/Analysis/DataStructure/EquivClassGraphs.h index d0e4265db05..5b0a2206d6f 100644 --- a/include/llvm/Analysis/DataStructure/EquivClassGraphs.h +++ b/include/llvm/Analysis/DataStructure/EquivClassGraphs.h @@ -16,9 +16,7 @@ #include "llvm/Analysis/DataStructure/DataStructure.h" #include "llvm/Analysis/DataStructure/DSGraph.h" -#include "llvm/ADT/EquivalenceClasses.h" #include "llvm/ADT/STLExtras.h" -#include "llvm/ADT/hash_map" #include #include @@ -52,6 +50,10 @@ namespace llvm { /// a call site. std::map OneCalledFunction; + /// GlobalECs - The equivalence classes for each global value that is merged + /// with other global values in the DSGraphs. + EquivalenceClasses GlobalECs; + public: /// EquivClassGraphs - Computes the equivalence classes and then the /// folded DS graphs for each class. @@ -62,6 +64,8 @@ namespace llvm { /// void print(std::ostream &O, const Module *M) const; + EquivalenceClasses &getGlobalECs() { return GlobalECs; } + /// getDSGraph - Return the data structure graph for the specified function. /// This returns the folded graph. The folded graph is the same as the CBU /// graph iff the function is in a singleton equivalence class AND all its