Skip to content

Commit 28e7ed0

Browse files
committed
AST: Remove the 'legacy' request dependency graph implementation
1 parent 5585cac commit 28e7ed0

File tree

10 files changed

+5
-445
lines changed

10 files changed

+5
-445
lines changed

include/swift/AST/Evaluator.h

Lines changed: 1 addition & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,6 @@ class Evaluator {
188188
/// Whether to dump detailed debug info for cycles.
189189
bool debugDumpCycles;
190190

191-
/// Whether we're building a request dependency graph.
192-
bool buildDependencyGraph;
193-
194191
/// Used to report statistics about which requests were evaluated, if
195192
/// non-null.
196193
UnifiedStatsReporter *stats = nullptr;
@@ -214,17 +211,6 @@ class Evaluator {
214211
/// A cache that stores the results of requests.
215212
evaluator::RequestCache cache;
216213

217-
/// Track the dependencies of each request.
218-
///
219-
/// This is an adjacency-list representation expressing, for each known
220-
/// request, the requests that it directly depends on. It is populated
221-
/// lazily while the request is being evaluated.
222-
///
223-
/// In a well-formed program, the graph should be a directed acycle graph
224-
/// (DAG). However, cyclic dependencies will be recorded within this graph,
225-
/// so all clients must cope with cycles.
226-
llvm::DenseMap<AnyRequest, std::vector<AnyRequest>> dependencies;
227-
228214
evaluator::DependencyRecorder recorder;
229215

230216
/// Retrieve the request function for the given zone and request IDs.
@@ -363,11 +349,6 @@ class Evaluator {
363349
std::make_unique<CyclicalRequestError<Request>>(request, *this));
364350
}
365351

366-
// Clear out the dependencies on this request; we're going to recompute
367-
// them now anyway.
368-
if (buildDependencyGraph)
369-
dependencies.find_as(request)->second.clear();
370-
371352
PrettyStackTraceRequest<Request> prettyStackTrace(request);
372353

373354
// Trace and/or count statistics.
@@ -470,45 +451,12 @@ class Evaluator {
470451
recorder.handleDependencySourceRequest(r, source.get());
471452
}
472453
}
473-
474-
public:
475-
/// Print the dependencies of the given request as a tree.
476-
///
477-
/// This is the core printing operation; most callers will want to use
478-
/// the other overload.
479-
void printDependencies(const AnyRequest &request,
480-
llvm::raw_ostream &out,
481-
llvm::DenseSet<AnyRequest> &visitedAnywhere,
482-
llvm::SmallVectorImpl<AnyRequest> &visitedAlongPath,
483-
ArrayRef<AnyRequest> highlightPath,
484-
std::string &prefixStr,
485-
bool lastChild) const;
486-
487-
/// Print the dependencies of the given request as a tree.
488-
template <typename Request>
489-
void printDependencies(const Request &request, llvm::raw_ostream &out) const {
490-
std::string prefixStr;
491-
llvm::DenseSet<AnyRequest> visitedAnywhere;
492-
llvm::SmallVector<AnyRequest, 4> visitedAlongPath;
493-
printDependencies(AnyRequest(request), out, visitedAnywhere,
494-
visitedAlongPath, { }, prefixStr, /*lastChild=*/true);
495-
}
496-
497-
/// Dump the dependencies of the given request to the debugging stream
498-
/// as a tree.
499-
SWIFT_DEBUG_DUMPER(dumpDependencies(const AnyRequest &request));
500-
501-
/// Print all dependencies known to the evaluator as a single Graphviz
502-
/// directed graph.
503-
void printDependenciesGraphviz(llvm::raw_ostream &out) const;
504-
505-
SWIFT_DEBUG_DUMPER(dumpDependenciesGraphviz());
506454
};
507455

508456
template <typename Request>
509457
void CyclicalRequestError<Request>::log(llvm::raw_ostream &out) const {
510458
out << "Cycle detected:\n";
511-
evaluator.printDependencies(request, out);
459+
simple_display(out, request);
512460
out << "\n";
513461
}
514462

include/swift/Basic/LangOptions.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -221,16 +221,9 @@ namespace swift {
221221
/// Whether to record request references for incremental builds.
222222
bool RecordRequestReferences = true;
223223

224-
/// The path to which we should emit GraphViz output for the complete
225-
/// request-evaluator graph.
226-
std::string RequestEvaluatorGraphVizPath;
227-
228224
/// Whether to dump debug info for request evaluator cycles.
229225
bool DebugDumpCycles = false;
230226

231-
/// Whether to build a request dependency graph for debugging.
232-
bool BuildRequestDependencyGraph = false;
233-
234227
/// Enable SIL type lowering
235228
bool EnableSubstSILFunctionTypesForFunctionValues = true;
236229

include/swift/Option/FrontendOptions.td

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,10 +266,6 @@ def debug_emit_invalid_swiftinterface_syntax : Flag<["-"], "debug-emit-invalid-s
266266

267267
def debug_cycles : Flag<["-"], "debug-cycles">,
268268
HelpText<"Print out debug dumps when cycles are detected in evaluation">;
269-
def build_request_dependency_graph : Flag<["-"], "build-request-dependency-graph">,
270-
HelpText<"Build request dependency graph">;
271-
def output_request_graphviz : Separate<["-"], "output-request-graphviz">,
272-
HelpText<"Emit GraphViz output visualizing the request dependency graph">;
273269

274270
def debug_time_function_bodies : Flag<["-"], "debug-time-function-bodies">,
275271
HelpText<"Dumps the time it takes to type-check each function body">;

lib/AST/ASTContext.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -628,11 +628,6 @@ ASTContext::ASTContext(LangOptions &langOpts, TypeCheckerOptions &typeckOpts,
628628
}
629629

630630
ASTContext::~ASTContext() {
631-
// Emit evaluator dependency graph if requested.
632-
auto graphPath = LangOpts.RequestEvaluatorGraphVizPath;
633-
if (!graphPath.empty()) {
634-
evaluator.emitRequestEvaluatorGraphViz(graphPath);
635-
}
636631
getImpl().~Implementation();
637632
}
638633

0 commit comments

Comments
 (0)