From 3c579faecef377e0047522ca1692318ea7bf03f2 Mon Sep 17 00:00:00 2001 From: "Vikram S. Adve" Date: Sun, 20 Oct 2002 18:08:55 +0000 Subject: [PATCH] Added a first-class representation for each call site that can be used in the DS graphs in DSGraph.h. With that, the special-purpose class BUDataStructure::CallSite is no longer needed here. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4229 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Analysis/DataStructure.h | 18 +++++------------- .../Analysis/DataStructure/DataStructure.h | 18 +++++------------- 2 files changed, 10 insertions(+), 26 deletions(-) diff --git a/include/llvm/Analysis/DataStructure.h b/include/llvm/Analysis/DataStructure.h index f154a6e629c..2dc4ce4d1e8 100644 --- a/include/llvm/Analysis/DataStructure.h +++ b/include/llvm/Analysis/DataStructure.h @@ -12,6 +12,7 @@ class Type; class DSGraph; class DSNodeHandle; +class DSCallSite; class LocalDataStructures; // A collection of local graphs for a program class BUDataStructures; // A collection of bu graphs for a program class TDDataStructures; // A collection of td graphs for a program @@ -63,19 +64,10 @@ public: // only performs a "Bottom Up" propogation (hence the name). // class BUDataStructures : public Pass { -public: - struct CallSite { - Function *Caller; - std::vector Context; - - CallSite(Function &C, const std::vector &Con) - : Caller(&C), Context(Con) {} - }; - private: // DSInfo, one graph for each function std::map DSInfo; - std::map > CallSites; + std::map > CallSites; public: ~BUDataStructures() { releaseMemory(); } @@ -88,8 +80,8 @@ public: return *I->second; } - const std::vector *getCallSites(const Function &F) const { - std::map >::const_iterator I + const std::vector *getCallSites(const Function &F) const { + std::map >::const_iterator I = CallSites.find(&F); return I != CallSites.end() ? &I->second : 0; } @@ -143,7 +135,7 @@ private: DSGraph &calculateGraph(Function &F); void ResolveCallSite(DSGraph &Graph, - const BUDataStructures::CallSite &CallSite); + const DSCallSite &CallSite); }; #if 0 diff --git a/include/llvm/Analysis/DataStructure/DataStructure.h b/include/llvm/Analysis/DataStructure/DataStructure.h index f154a6e629c..2dc4ce4d1e8 100644 --- a/include/llvm/Analysis/DataStructure/DataStructure.h +++ b/include/llvm/Analysis/DataStructure/DataStructure.h @@ -12,6 +12,7 @@ class Type; class DSGraph; class DSNodeHandle; +class DSCallSite; class LocalDataStructures; // A collection of local graphs for a program class BUDataStructures; // A collection of bu graphs for a program class TDDataStructures; // A collection of td graphs for a program @@ -63,19 +64,10 @@ public: // only performs a "Bottom Up" propogation (hence the name). // class BUDataStructures : public Pass { -public: - struct CallSite { - Function *Caller; - std::vector Context; - - CallSite(Function &C, const std::vector &Con) - : Caller(&C), Context(Con) {} - }; - private: // DSInfo, one graph for each function std::map DSInfo; - std::map > CallSites; + std::map > CallSites; public: ~BUDataStructures() { releaseMemory(); } @@ -88,8 +80,8 @@ public: return *I->second; } - const std::vector *getCallSites(const Function &F) const { - std::map >::const_iterator I + const std::vector *getCallSites(const Function &F) const { + std::map >::const_iterator I = CallSites.find(&F); return I != CallSites.end() ? &I->second : 0; } @@ -143,7 +135,7 @@ private: DSGraph &calculateGraph(Function &F); void ResolveCallSite(DSGraph &Graph, - const BUDataStructures::CallSite &CallSite); + const DSCallSite &CallSite); }; #if 0