Remove the top-down call graph ABI and use the reverse bottom-up.

Swift SVN r13544
This commit is contained in:
Nadav Rotem
2014-02-06 01:52:14 +00:00
parent cf602d3527
commit 93b5cac34e
5 changed files with 2 additions and 30 deletions

View File

@@ -75,7 +75,6 @@ namespace swift {
}
void bottomUpCallGraphOrder(std::vector<SILFunction*> &order);
void topDownCallGraphOrder(std::vector<SILFunction*> &order);
virtual void invalidate(InvalidationKind K) {
// TODO: invalidate the cache once we implement one.

View File

@@ -58,10 +58,6 @@ namespace swift {
/// include functions that don't participate in any call (caller or callee).
void bottomUpCallGraphOrder(SILModule *M, std::vector<SILFunction*> &order);
/// Return the top-down call-graph order for module M. Notice that we don't
/// include functions that don't participate in any call (caller or callee).
void topDownCallGraphOrder(SILModule *M, std::vector<SILFunction*> &order);
/// Does the passed in BuiltinFunctionRefInst have any side effects?
bool isSideEffectFree(BuiltinFunctionRefInst *FR);

View File

@@ -28,13 +28,6 @@ CallGraphAnalysis::bottomUpCallGraphOrder(std::vector<SILFunction*> &order) {
swift::bottomUpCallGraphOrder(M, order);
}
void
CallGraphAnalysis::topDownCallGraphOrder(std::vector<SILFunction*> &order) {
// TODO: cache this calculation.
swift::topDownCallGraphOrder(M, order);
}
SILAnalysis *swift::createCallGraphAnalysis(SILModule *M) {
return new CallGraphAnalysis(M);
}

View File

@@ -375,7 +375,8 @@ public:
// Collect a call-graph bottom-up list of functions.
std::vector<SILFunction *> Worklist;
CGA->topDownCallGraphOrder(Worklist);
CGA->bottomUpCallGraphOrder(Worklist);
std::reverse(Worklist.begin(), Worklist.end());
SILPerformanceInliner inliner(Threshold);

View File

@@ -187,20 +187,3 @@ void swift::bottomUpCallGraphOrder(SILModule *M,
sorter.sort(order);
}
void swift::topDownCallGraphOrder(SILModule *M,
std::vector<SILFunction*> &order) {
CallGraphSorter<SILFunction *> sorter;
// NOTE: we are inserting edges in reverse to get the top-down call graph.
for (auto &Caller : *M)
for (auto &BB : Caller)
for (auto &I : BB)
if (FunctionRefInst *FRI = dyn_cast<FunctionRefInst>(&I)) {
SILFunction *Callee = FRI->getReferencedFunction();
sorter.addEdge(Callee, &Caller);
}
// Perform the topological sorting.
sorter.sort(order);
}