mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Remove the top-down call graph ABI and use the reverse bottom-up.
Swift SVN r13544
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user