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
This commit is contained in:
Vikram S. Adve 2002-10-20 18:08:55 +00:00
parent 42fd169310
commit 3c579faece
2 changed files with 10 additions and 26 deletions

View File

@ -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<DSNodeHandle> Context;
CallSite(Function &C, const std::vector<DSNodeHandle> &Con)
: Caller(&C), Context(Con) {}
};
private:
// DSInfo, one graph for each function
std::map<const Function*, DSGraph*> DSInfo;
std::map<const Function*, std::vector<CallSite> > CallSites;
std::map<const Function*, std::vector<DSCallSite> > CallSites;
public:
~BUDataStructures() { releaseMemory(); }
@ -88,8 +80,8 @@ public:
return *I->second;
}
const std::vector<CallSite> *getCallSites(const Function &F) const {
std::map<const Function*, std::vector<CallSite> >::const_iterator I
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;
}
@ -143,7 +135,7 @@ private:
DSGraph &calculateGraph(Function &F);
void ResolveCallSite(DSGraph &Graph,
const BUDataStructures::CallSite &CallSite);
const DSCallSite &CallSite);
};
#if 0

View File

@ -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<DSNodeHandle> Context;
CallSite(Function &C, const std::vector<DSNodeHandle> &Con)
: Caller(&C), Context(Con) {}
};
private:
// DSInfo, one graph for each function
std::map<const Function*, DSGraph*> DSInfo;
std::map<const Function*, std::vector<CallSite> > CallSites;
std::map<const Function*, std::vector<DSCallSite> > CallSites;
public:
~BUDataStructures() { releaseMemory(); }
@ -88,8 +80,8 @@ public:
return *I->second;
}
const std::vector<CallSite> *getCallSites(const Function &F) const {
std::map<const Function*, std::vector<CallSite> >::const_iterator I
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;
}
@ -143,7 +135,7 @@ private:
DSGraph &calculateGraph(Function &F);
void ResolveCallSite(DSGraph &Graph,
const BUDataStructures::CallSite &CallSite);
const DSCallSite &CallSite);
};
#if 0