- Add support for an "auxillary" call site list

- Original call sites are now never modified after construction by the local
  pass.
- DSGraph::cloneInto can now optionally not clone the call sites
- BUDataStructures no longer has a ton of book-keeping info for a broken
  implementation of the TD data structures


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4631 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2002-11-08 21:24:51 +00:00
parent 93fbd733e7
commit fb39933b75
6 changed files with 72 additions and 88 deletions

View File

@@ -9,6 +9,7 @@
#include "llvm/Analysis/DSSupport.h"
#include "llvm/Pass.h"
#include <set>
class Type;
class DSGraph;
@@ -66,7 +67,6 @@ public:
class BUDataStructures : public Pass {
// DSInfo, one graph for each function
std::map<const Function*, DSGraph*> DSInfo;
std::map<const Function*, std::vector<DSCallSite> > CallSites;
public:
~BUDataStructures() { releaseMemory(); }
@@ -79,21 +79,12 @@ public:
return *I->second;
}
/// getCallSites - Return all of the call sites for the specified function
///
const std::vector<DSCallSite> *getCallSites(const Function &F) const {
std::map<const Function*, std::vector<DSCallSite> >::const_iterator I
= CallSites.find(&F);
return I != CallSites.end() ? &I->second : 0;
}
// print - Print out the analysis results...
// print - Print out the analysis results...
void print(std::ostream &O, const Module *M) const;
// If the pass pipeline is done with this pass, we can release our memory...
virtual void releaseMemory();
// getAnalysisUsage - This obviously provides a data structure graph.
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll();
AU.addRequired<LocalDataStructures>();
@@ -109,24 +100,7 @@ private:
class TDDataStructures : public Pass {
// DSInfo, one graph for each function
std::map<const Function*, DSGraph*> DSInfo;
// Each graph in DSInfo is based on a graph in the BUDS object. The BUMaps
// member keeps the mappings from the BU graphs to the TD graphs as they are
// calculated by calculateGraph. This information is used to properly
// implement resolving of call sites, where the call sites in the BUGraph are
// in terms of the caller function's graph in the BUGraph.
//
typedef std::map<const DSNode*, DSNodeHandle> BUNodeMapTy;
std::map<const Function*, BUNodeMapTy> BUMaps;
// CallSitesForFunction - This is a temporary map that is only kept around
// when building the top-down closures for a program. It traverses all of the
// call sites in the BU graph and holds all of the call sites that each
// function is the "resolving caller" for.
//
std::map<const Function*,
std::vector<const DSCallSite*> > CallSitesForFunction;
std::set<const Function*> GraphDone;
public:
~TDDataStructures() { releaseMemory(); }
@@ -151,7 +125,8 @@ public:
AU.addRequired<BUDataStructures>();
}
private:
DSGraph &calculateGraph(Function &F);
void calculateGraph(Function &F);
DSGraph &getOrCreateDSGraph(Function &F);
void ResolveCallSite(DSGraph &Graph, const DSCallSite &CallSite);
};