diff options
author | Chris Lattner <sabre@nondot.org> | 2002-10-17 04:24:08 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-10-17 04:24:08 +0000 |
commit | 613692c1069fa77f00bf166555118724254783d1 (patch) | |
tree | 6a39b14f7f8a3388b45c5cd2bc2b698706b36341 /lib/Analysis/DataStructure/BottomUpClosure.cpp | |
parent | 8d00c8210edb95938573d261e773da9c5a9646e3 (diff) |
* Add data structures and code to track the call sites for each function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4213 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/DataStructure/BottomUpClosure.cpp')
-rw-r--r-- | lib/Analysis/DataStructure/BottomUpClosure.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/Analysis/DataStructure/BottomUpClosure.cpp b/lib/Analysis/DataStructure/BottomUpClosure.cpp index 475f6878d5..1f48b65202 100644 --- a/lib/Analysis/DataStructure/BottomUpClosure.cpp +++ b/lib/Analysis/DataStructure/BottomUpClosure.cpp @@ -10,9 +10,7 @@ #include "llvm/Analysis/DataStructure.h" #include "llvm/Analysis/DSGraph.h" #include "llvm/Module.h" -//#include "llvm/DerivedTypes.h" #include "Support/Statistic.h" -//#include <set> using std::map; static RegisterAnalysis<BUDataStructures> @@ -32,6 +30,9 @@ using namespace DataStructureAnalysis; // our memory... here... // void BUDataStructures::releaseMemory() { + // Delete all call site information + CallSites.clear(); + for (map<const Function*, DSGraph*>::iterator I = DSInfo.begin(), E = DSInfo.end(); I != E; ++I) delete I->second; @@ -151,6 +152,10 @@ DSGraph &BUDataStructures::calculateGraph(Function &F) { for (unsigned c = 0; c != Callees.size(); ++c) { // Must be a function type, so this cast MUST succeed. Function &FI = cast<Function>(*Callees[c]); + + // Record that this is a call site of FI. + CallSites[&FI].push_back(CallSite(F, Call)); + if (&FI == &F) { // Self recursion... simply link up the formal arguments with the // actual arguments... @@ -165,6 +170,7 @@ DSGraph &BUDataStructures::calculateGraph(Function &F) { // Erase the entry in the callees vector Callees.erase(Callees.begin()+c--); + } else if (!FI.isExternal()) { DEBUG(std::cerr << "\t[BU] In " << F.getName() << " inlining: " << FI.getName() << "\n"); |