Add new methods to BUDS for keeping track of a precise call graph

llvm-svn: 7028
This commit is contained in:
Chris Lattner 2003-07-01 16:27:15 +00:00
parent 269467d216
commit 0c770cd936
1 changed files with 13 additions and 12 deletions

View File

@ -12,6 +12,7 @@
#include "Support/hash_set" #include "Support/hash_set"
class Type; class Type;
class CallInst;
class DSGraph; class DSGraph;
class DSNode; class DSNode;
class DSCallSite; class DSCallSite;
@ -75,6 +76,7 @@ class BUDataStructures : public Pass {
// DSInfo, one graph for each function // DSInfo, one graph for each function
hash_map<Function*, DSGraph*> DSInfo; hash_map<Function*, DSGraph*> DSInfo;
DSGraph *GlobalsGraph; DSGraph *GlobalsGraph;
hash_multimap<CallInst*, Function*> ActualCallees;
public: public:
~BUDataStructures() { releaseMemory(); } ~BUDataStructures() { releaseMemory(); }
@ -104,19 +106,15 @@ public:
AU.setPreservesAll(); AU.setPreservesAll();
AU.addRequired<LocalDataStructures>(); AU.addRequired<LocalDataStructures>();
} }
typedef hash_multimap<CallInst*, Function*> ActualCalleesTy;
const ActualCalleesTy &getActualCallees() const {
return ActualCallees;
}
private: private:
void calculateGraph(DSGraph &G); void calculateGraph(DSGraph &G);
// inlineNonSCCGraphs - This method is almost like the other two calculate
// graph methods. This one is used to inline function graphs (from functions
// outside of the SCC) into functions in the SCC. It is not supposed to touch
// functions IN the SCC at all.
//
DSGraph &inlineNonSCCGraphs(Function &F,
hash_set<Function*> &SCCFunctions);
DSGraph &calculateSCCGraph(Function &F,
hash_set<Function*> &InlinedSCCFunctions);
void calculateReachableGraphs(Function *F); void calculateReachableGraphs(Function *F);
@ -135,7 +133,6 @@ private:
class TDDataStructures : public Pass { class TDDataStructures : public Pass {
// DSInfo, one graph for each function // DSInfo, one graph for each function
hash_map<Function*, DSGraph*> DSInfo; hash_map<Function*, DSGraph*> DSInfo;
hash_set<const Function*> GraphDone;
DSGraph *GlobalsGraph; DSGraph *GlobalsGraph;
public: public:
~TDDataStructures() { releaseMyMemory(); } ~TDDataStructures() { releaseMyMemory(); }
@ -169,8 +166,12 @@ public:
} }
private: private:
void calculateGraph(Function &F); void calculateGraphFrom(Function &F);
void inlineGraphIntoCallees(DSGraph &G);
DSGraph &getOrCreateDSGraph(Function &F); DSGraph &getOrCreateDSGraph(Function &F);
void ComputePostOrder(Function &F, hash_set<DSGraph*> &Visited,
std::vector<DSGraph*> &PostOrder,
const BUDataStructures::ActualCalleesTy &ActualCallees);
}; };
#endif #endif