1
- // ===--- DependencyGraph .h - Track intra-module dependencies --- -*- C++ -*-===//
1
+ // ===- CoarseGrainedDependencyGraph .h - Track intra-module dependencies -*- C++ -*-===//
2
2
//
3
3
// This source file is part of the Swift.org open source project
4
4
//
10
10
//
11
11
// ===----------------------------------------------------------------------===//
12
12
13
- #ifndef SWIFT_DRIVER_DEPENDENCYGRAPH_H
14
- #define SWIFT_DRIVER_DEPENDENCYGRAPH_H
13
+ #ifndef SWIFT_DRIVER_COARSEGRAINEDDEPENDENCYGRAPH_H
14
+ #define SWIFT_DRIVER_COARSEGRAINEDDEPENDENCYGRAPH_H
15
15
16
16
#include " swift/AST/DiagnosticEngine.h"
17
17
#include " swift/Basic/LLVM.h"
@@ -36,15 +36,15 @@ namespace swift {
36
36
37
37
class UnifiedStatsReporter ;
38
38
39
- // / The non-templated implementation of DependencyGraph .
39
+ // / The non-templated implementation of CoarseGrainedDependencyGraph .
40
40
// /
41
- // / \see DependencyGraph
42
- class DependencyGraphImpl {
41
+ // / \see CoarseGrainedDependencyGraph
42
+ class CoarseGrainedDependencyGraphImpl {
43
43
public:
44
44
// / Possible dependency kinds.
45
45
// /
46
- // / Clients of DependencyGraph should have no reason to use this type.
47
- // / It is only used in the implementation.
46
+ // / Clients of CoarseGrainedDependencyGraph should have no reason to use this
47
+ // / type. It is only used in the implementation.
48
48
enum class DependencyKind : uint8_t ;
49
49
50
50
// / Describes the result of loading a dependency file for a particular node.
@@ -62,15 +62,17 @@ class DependencyGraphImpl {
62
62
AffectsDownstream
63
63
};
64
64
65
- // / The non-templated implementation of DependencyGraph::MarkTracer.
65
+ // / The non-templated implementation of
66
+ // / CoarseGrainedDependencyGraph::MarkTracer.
66
67
// /
67
- // / \see DependencyGraph ::MarkTracer
68
+ // / \see CoarseGrainedDependencyGraph ::MarkTracer
68
69
class MarkTracerImpl {
69
70
class Entry ;
70
71
llvm::DenseMap<const void *, SmallVector<Entry, 4 >> Table;
71
72
UnifiedStatsReporter *Stats;
72
73
73
- friend class DependencyGraphImpl ;
74
+ friend class CoarseGrainedDependencyGraphImpl ;
75
+
74
76
protected:
75
77
explicit MarkTracerImpl (UnifiedStatsReporter *Stats);
76
78
~MarkTracerImpl ();
@@ -154,7 +156,7 @@ class DependencyGraphImpl {
154
156
(void )newlyInserted;
155
157
}
156
158
157
- // / See DependencyGraph ::markTransitive.
159
+ // / See CoarseGrainedDependencyGraph ::markTransitive.
158
160
159
161
void markTransitive (SmallVectorImpl<const void *> &visited,
160
162
const void *node, MarkTracerImpl *tracer = nullptr );
@@ -196,7 +198,7 @@ class DependencyGraphImpl {
196
198
// / The graph also supports a "mark" operation, which is intended to track
197
199
// / nodes that have been not just visited but transitively marked through.
198
200
template <typename T>
199
- class DependencyGraph : public DependencyGraphImpl {
201
+ class CoarseGrainedDependencyGraph : public CoarseGrainedDependencyGraphImpl {
200
202
using Traits = llvm::PointerLikeTypeTraits<T>;
201
203
static_assert (Traits::NumLowBitsAvailable >= 0 , " not a pointer-like type" );
202
204
@@ -210,7 +212,8 @@ class DependencyGraph : public DependencyGraphImpl {
210
212
}
211
213
212
214
public:
213
- // / Traces the graph traversal performed in DependencyGraph::markTransitive.
215
+ // / Traces the graph traversal performed in
216
+ // / CoarseGrainedDependencyGraph::markTransitive.
214
217
// /
215
218
// / This is intended to be a debugging aid.
216
219
class MarkTracer : public MarkTracerImpl {
@@ -240,8 +243,8 @@ class DependencyGraph : public DependencyGraphImpl {
240
243
// / call site can polymorphically call \ref
241
244
// / fine_grained_dependencies::ModuleDepGraph::loadFromPath
242
245
LoadResult loadFromPath (T node, StringRef path, DiagnosticEngine &) {
243
- return DependencyGraphImpl ::loadFromPath (Traits::getAsVoidPointer (node),
244
- path);
246
+ return CoarseGrainedDependencyGraphImpl ::loadFromPath (
247
+ Traits::getAsVoidPointer (node), path);
245
248
}
246
249
247
250
// / Load "depends" and "provides" data for \p node from a plain string.
@@ -250,16 +253,16 @@ class DependencyGraph : public DependencyGraphImpl {
250
253
// /
251
254
// / \sa loadFromPath
252
255
LoadResult loadFromString (T node, StringRef data) {
253
- return DependencyGraphImpl ::loadFromString (Traits::getAsVoidPointer (node),
254
- data);
256
+ return CoarseGrainedDependencyGraphImpl ::loadFromString (
257
+ Traits::getAsVoidPointer (node), data);
255
258
}
256
259
257
260
// / Adds \p node to the dependency graph without any connections.
258
261
// /
259
262
// / This can be used for new nodes that may be updated later.
260
263
void addIndependentNode (T node) {
261
- return
262
- DependencyGraphImpl::addIndependentNode ( Traits::getAsVoidPointer (node));
264
+ return CoarseGrainedDependencyGraphImpl::addIndependentNode (
265
+ Traits::getAsVoidPointer (node));
263
266
}
264
267
265
268
// / Marks \p node and all nodes that depend on \p node, and places any nodes
@@ -287,17 +290,17 @@ class DependencyGraph : public DependencyGraphImpl {
287
290
void markTransitive (SmallVector<T, N> &visited, T node,
288
291
MarkTracer *tracer = nullptr ) {
289
292
SmallVector<const void *, N> rawMarked;
290
- DependencyGraphImpl::markTransitive (rawMarked,
291
- Traits::getAsVoidPointer (node),
292
- tracer);
293
+ CoarseGrainedDependencyGraphImpl::markTransitive (
294
+ rawMarked, Traits::getAsVoidPointer (node), tracer);
293
295
// FIXME: How can we avoid this copy?
294
296
copyBack (visited, rawMarked);
295
297
}
296
298
297
299
template <unsigned N>
298
300
void markExternal (SmallVector<T, N> &visited, StringRef externalDependency) {
299
301
SmallVector<const void *, N> rawMarked;
300
- DependencyGraphImpl::markExternal (rawMarked, externalDependency);
302
+ CoarseGrainedDependencyGraphImpl::markExternal (rawMarked,
303
+ externalDependency);
301
304
// FIXME: How can we avoid this copy?
302
305
copyBack (visited, rawMarked);
303
306
}
@@ -308,13 +311,14 @@ class DependencyGraph : public DependencyGraphImpl {
308
311
// /
309
312
// / \sa #markTransitive
310
313
bool markIntransitive (T node) {
311
- return
312
- DependencyGraphImpl::markIntransitive ( Traits::getAsVoidPointer (node));
314
+ return CoarseGrainedDependencyGraphImpl::markIntransitive (
315
+ Traits::getAsVoidPointer (node));
313
316
}
314
317
315
318
// / Returns true if \p node has been marked (directly or transitively).
316
319
bool isMarked (T node) const {
317
- return DependencyGraphImpl::isMarked (Traits::getAsVoidPointer (node));
320
+ return CoarseGrainedDependencyGraphImpl::isMarked (
321
+ Traits::getAsVoidPointer (node));
318
322
}
319
323
};
320
324
0 commit comments