LLVM 22.0.0git
WaitingOnGraph.h
Go to the documentation of this file.
1//===------ WaitingOnGraph.h - ORC symbol dependence graph ------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// Defines WaitingOnGraph and related utilities.
10//
11//===----------------------------------------------------------------------===//
12#ifndef LLVM_EXECUTIONENGINE_ORC_WAITINGONGRAPH_H
13#define LLVM_EXECUTIONENGINE_ORC_WAITINGONGRAPH_H
14
15#include "llvm/ADT/DenseMap.h"
16#include "llvm/ADT/DenseSet.h"
17#include "llvm/ADT/STLExtras.h"
20
21#include <algorithm>
22#include <vector>
23
24namespace llvm::orc::detail {
25
26class WaitingOnGraphTest;
27
28/// WaitingOnGraph class template.
29///
30/// This type is intended to provide efficient dependence tracking for Symbols
31/// in an ORC program.
32///
33/// WaitingOnGraph models a directed graph with four partitions:
34/// 1. Not-yet-emitted nodes: Nodes identified as waited-on in an emit
35/// operation.
36/// 2. Emitted nodes: Nodes emitted and waiting on some non-empty set of
37/// other nodes.
38/// 3. Ready nodes: Nodes emitted and not waiting on any other nodes
39/// (either because they weren't waiting on any nodes when they were
40/// emitted, or because all transitively waited-on nodes have since
41/// been emitted).
42/// 4. Failed nodes: Nodes that have been marked as failed-to-emit, and
43/// nodes that were found to transitively wait-on some failed node.
44///
45/// Nodes are added to the graph by *emit* and *fail* operations.
46///
47/// The *emit* operation takes a bipartite *local dependence graph* as an
48/// argument and returns...
49/// a. the set of nodes (both existing and newly added from the local
50/// dependence graph) whose waiting-on set is the empty set, and...
51/// b. the set of newly added nodes that are found to depend on failed
52/// nodes.
53///
54/// The *fail* operation takes a set of failed nodes and returns the set of
55/// Emitted nodes that were waiting on the failed nodes.
56///
57/// The concrete representation adopts several approaches for efficiency:
58///
59/// 1. Only *Emitted* and *Not-yet-emitted* nodes are represented explicitly.
60/// *Ready* and *Failed* nodes are represented by the values returned by the
61/// GetExternalStateFn argument to *emit*.
62///
63/// 2. Labels are (*Container*, *Element*) pairs that are intended to represent
64/// ORC symbols (ORC uses types Container = JITDylib,
65/// Element = NonOwningSymbolStringPtr). The internal representation of the
66/// graph is optimized on the assumption that there are many more Elements
67/// (symbol names) than Containers (JITDylibs) used to construct the labels.
68/// (Consider for example the common case where most JIT'd code is placed in
69/// a single "main" JITDylib).
70///
71/// 3. The data structure stores *SuperNodes* which have multiple labels. This
72/// reduces the number of nodes and edges in the graph in the common case
73/// where many JIT symbols have the same set of dependencies. SuperNodes are
74/// coalesced when their dependence sets become equal.
75///
76/// 4. The *simplify* method can be applied to an initial *local dependence
77/// graph* (as a list of SuperNodes) to eliminate any internal dependence
78/// relationships that would have to be propagated internally by *emit*.
79/// Access to the WaitingOnGraph is assumed to be guarded by a mutex (ORC
80/// will access it from multiple threads) so this allows some pre-processing
81/// to be performed outside the mutex.
82template <typename ContainerIdT, typename ElementIdT> class WaitingOnGraph {
83 friend class WaitingOnGraphTest;
84
85public:
86 using ContainerId = ContainerIdT;
87 using ElementId = ElementIdT;
90
91 class SuperNode {
92 friend class WaitingOnGraph;
93 friend class WaitingOnGraphTest;
94
95 public:
97 : Defs(std::move(Defs)), Deps(std::move(Deps)) {}
98 ContainerElementsMap &defs() { return Defs; }
99 const ContainerElementsMap &defs() const { return Defs; }
100 ContainerElementsMap &deps() { return Deps; }
101 const ContainerElementsMap &deps() const { return Deps; }
102
103 private:
106 };
107
108private:
109 using ElemToSuperNodeMap =
111
112 using SuperNodeDepsMap = DenseMap<SuperNode *, DenseSet<SuperNode *>>;
113
114 class Coalescer {
115 public:
116 std::unique_ptr<SuperNode> addOrCreateSuperNode(ContainerElementsMap Defs,
118 auto H = getHash(Deps);
119 if (auto *ExistingSN = findCanonicalSuperNode(H, Deps)) {
120 for (auto &[Container, Elems] : Defs) {
121 auto &DstCElems = ExistingSN->Defs[Container];
122 [[maybe_unused]] size_t ExpectedSize =
123 DstCElems.size() + Elems.size();
124 DstCElems.insert(Elems.begin(), Elems.end());
125 assert(DstCElems.size() == ExpectedSize);
126 }
127 return nullptr;
128 }
129
130 auto NewSN =
131 std::make_unique<SuperNode>(std::move(Defs), std::move(Deps));
132 CanonicalSNs[H].push_back(NewSN.get());
133 return NewSN;
134 }
135
136 void coalesce(std::vector<std::unique_ptr<SuperNode>> &SNs,
137 ElemToSuperNodeMap &ElemToSN) {
138 for (size_t I = 0; I != SNs.size();) {
139 auto &SN = SNs[I];
140 auto H = getHash(SN->Deps);
141 if (auto *CanonicalSN = findCanonicalSuperNode(H, SN->Deps)) {
142 for (auto &[Container, Elems] : SN->Defs) {
143 CanonicalSN->Defs[Container].insert(Elems.begin(), Elems.end());
144 auto &ContainerElemToSN = ElemToSN[Container];
145 for (auto &Elem : Elems)
146 ContainerElemToSN[Elem] = CanonicalSN;
147 }
148 std::swap(SN, SNs.back());
149 SNs.pop_back();
150 } else {
151 CanonicalSNs[H].push_back(SN.get());
152 ++I;
153 }
154 }
155 }
156
157 template <typename Pred> void remove(Pred &&Remove) {
158 for (auto &[Hash, SNs] : CanonicalSNs) {
159 bool Found = false;
160 for (size_t I = 0; I != SNs.size(); ++I) {
161 if (Remove(SNs[I])) {
162 std::swap(SNs[I], SNs.back());
163 SNs.pop_back();
164 Found = true;
165 break;
166 }
167 }
168 if (Found) {
169 if (SNs.empty())
170 CanonicalSNs.erase(Hash);
171 break;
172 }
173 }
174 }
175
176 private:
177 hash_code getHash(const ContainerElementsMap &M) {
178 SmallVector<ContainerId> SortedContainers;
179 SortedContainers.reserve(M.size());
180 for (auto &[Container, Elems] : M)
181 SortedContainers.push_back(Container);
182 llvm::sort(SortedContainers);
183 hash_code Hash(0);
184 for (auto &Container : SortedContainers) {
185 auto &ContainerElems = M.at(Container);
186 SmallVector<ElementId> SortedElems(ContainerElems.begin(),
187 ContainerElems.end());
188 llvm::sort(SortedElems);
189 Hash = hash_combine(Hash, Container, hash_combine_range(SortedElems));
190 }
191 return Hash;
192 }
193
194 SuperNode *findCanonicalSuperNode(hash_code H,
195 const ContainerElementsMap &M) {
196 for (auto *SN : CanonicalSNs[H])
197 if (SN->Deps == M)
198 return SN;
199 return nullptr;
200 }
201
202 DenseMap<hash_code, SmallVector<SuperNode *>> CanonicalSNs;
203 };
204
205public:
206 /// Build SuperNodes from (definition-set, dependence-set) pairs.
207 ///
208 /// Coalesces definition-sets with identical dependence-sets.
210 public:
212 if (Defs.empty())
213 return;
214 // Remove any self-reference.
216 for (auto &[Container, Elems] : Defs) {
217 assert(!Elems.empty() && "Defs for container must not be empty");
218 auto I = Deps.find(Container);
219 if (I == Deps.end())
220 continue;
221 auto &DepsForContainer = I->second;
222 for (auto &Elem : Elems)
223 DepsForContainer.erase(Elem);
224 if (DepsForContainer.empty())
225 ToRemove.push_back(Container);
226 }
227 for (auto &Container : ToRemove)
228 Deps.erase(Container);
229 if (auto SN = C.addOrCreateSuperNode(std::move(Defs), std::move(Deps)))
230 SNs.push_back(std::move(SN));
231 }
232 std::vector<std::unique_ptr<SuperNode>> takeSuperNodes() {
233 return std::move(SNs);
234 }
235
236 private:
237 Coalescer C;
238 std::vector<std::unique_ptr<SuperNode>> SNs;
239 };
240
241 class SimplifyResult {
242 friend class WaitingOnGraph;
243 friend class WaitingOnGraphTest;
244
245 public:
246 const std::vector<std::unique_ptr<SuperNode>> &superNodes() const {
247 return SNs;
248 }
249
250 private:
251 SimplifyResult(std::vector<std::unique_ptr<SuperNode>> SNs,
252 ElemToSuperNodeMap ElemToSN)
253 : SNs(std::move(SNs)), ElemToSN(std::move(ElemToSN)) {}
254 std::vector<std::unique_ptr<SuperNode>> SNs;
255 ElemToSuperNodeMap ElemToSN;
256 };
257
258 /// Preprocess a list of SuperNodes to remove all intra-SN dependencies.
259 static SimplifyResult simplify(std::vector<std::unique_ptr<SuperNode>> SNs) {
260 // Build ElemToSN map.
261 ElemToSuperNodeMap ElemToSN;
262 for (auto &SN : SNs) {
263 for (auto &[Container, Elements] : SN->Defs) {
264 auto &ContainerElemToSN = ElemToSN[Container];
265 for (auto &E : Elements)
266 ContainerElemToSN[E] = SN.get();
267 }
268 }
269
270 SuperNodeDepsMap SuperNodeDeps;
271 hoistDeps(SuperNodeDeps, SNs, ElemToSN);
272 propagateSuperNodeDeps(SuperNodeDeps);
273 sinkDeps(SNs, SuperNodeDeps);
274
275 // Pre-coalesce nodes.
276 Coalescer().coalesce(SNs, ElemToSN);
277
278 return {std::move(SNs), std::move(ElemToSN)};
279 }
280
281 struct EmitResult {
282 std::vector<std::unique_ptr<SuperNode>> Ready;
283 std::vector<std::unique_ptr<SuperNode>> Failed;
284 };
285
286 enum class ExternalState { None, Ready, Failed };
287
288 /// Add the given SuperNodes to the graph, returning any SuperNodes that
289 /// move to the Ready or Failed states as a result.
290 /// The GetExternalState function is used to represent SuperNodes that have
291 /// already become Ready or Failed (since such nodes are not explicitly
292 /// represented in the graph).
293 template <typename GetExternalStateFn>
294 EmitResult emit(SimplifyResult SR, GetExternalStateFn &&GetExternalState) {
295 auto NewSNs = std::move(SR.SNs);
296 auto ElemToNewSN = std::move(SR.ElemToSN);
297
298 // First process any dependencies on nodes with external state.
299 auto FailedSNs = processExternalDeps(NewSNs, GetExternalState);
300
301 // Collect the PendingSNs whose dep sets are about to be modified.
302 std::vector<std::unique_ptr<SuperNode>> ModifiedPendingSNs;
303 for (size_t I = 0; I != PendingSNs.size();) {
304 auto &SN = PendingSNs[I];
305 bool Remove = false;
306 for (auto &[Container, Elems] : SN->Deps) {
307 auto I = ElemToNewSN.find(Container);
308 if (I == ElemToNewSN.end())
309 continue;
310 for (auto Elem : Elems) {
311 if (I->second.contains(Elem)) {
312 Remove = true;
313 break;
314 }
315 }
316 if (Remove)
317 break;
318 }
319 if (Remove) {
320 ModifiedPendingSNs.push_back(std::move(SN));
321 std::swap(SN, PendingSNs.back());
322 PendingSNs.pop_back();
323 } else
324 ++I;
325 }
326
327 // Remove cycles from the graphs.
328 SuperNodeDepsMap SuperNodeDeps;
329 hoistDeps(SuperNodeDeps, ModifiedPendingSNs, ElemToNewSN);
330
331 CoalesceToPendingSNs.remove(
332 [&](SuperNode *SN) { return SuperNodeDeps.count(SN); });
333
334 hoistDeps(SuperNodeDeps, NewSNs, ElemToPendingSN);
335 propagateSuperNodeDeps(SuperNodeDeps);
336 sinkDeps(NewSNs, SuperNodeDeps);
337 sinkDeps(ModifiedPendingSNs, SuperNodeDeps);
338
339 // Process supernodes. Pending first, since we'll update PendingSNs when we
340 // incorporate NewSNs.
341 std::vector<std::unique_ptr<SuperNode>> ReadyNodes, FailedNodes;
342 processReadyOrFailed(ModifiedPendingSNs, ReadyNodes, FailedNodes,
343 SuperNodeDeps, ElemToPendingSN, FailedSNs);
344 processReadyOrFailed(NewSNs, ReadyNodes, FailedNodes, SuperNodeDeps,
345 ElemToNewSN, FailedSNs);
346
347 CoalesceToPendingSNs.coalesce(ModifiedPendingSNs, ElemToPendingSN);
348 CoalesceToPendingSNs.coalesce(NewSNs, ElemToPendingSN);
349
350 // Integrate remaining ModifiedPendingSNs and NewSNs into PendingSNs.
351 for (auto &SN : ModifiedPendingSNs)
352 PendingSNs.push_back(std::move(SN));
353
354 // Update ElemToPendingSN for the remaining elements.
355 for (auto &SN : NewSNs) {
356 for (auto &[Container, Elems] : SN->Defs) {
357 auto &Row = ElemToPendingSN[Container];
358 for (auto &Elem : Elems)
359 Row[Elem] = SN.get();
360 }
361 PendingSNs.push_back(std::move(SN));
362 }
363
364 return {std::move(ReadyNodes), std::move(FailedNodes)};
365 }
366
367 /// Identify the given symbols as Failed.
368 /// The elements of the Failed map will not be included in the returned
369 /// result, so clients should take whatever actions are needed to mark
370 /// this as failed in their external representation.
371 std::vector<std::unique_ptr<SuperNode>>
373 std::vector<std::unique_ptr<SuperNode>> FailedSNs;
374
375 for (size_t I = 0; I != PendingSNs.size();) {
376 auto &PendingSN = PendingSNs[I];
377 bool FailPendingSN = false;
378 for (auto &[Container, Elems] : PendingSN->Deps) {
379 if (FailPendingSN)
380 break;
381 auto I = Failed.find(Container);
382 if (I == Failed.end())
383 continue;
384 for (auto &Elem : Elems) {
385 if (I->second.count(Elem)) {
386 FailPendingSN = true;
387 break;
388 }
389 }
390 }
391 if (FailPendingSN) {
392 FailedSNs.push_back(std::move(PendingSN));
393 PendingSN = std::move(PendingSNs.back());
394 PendingSNs.pop_back();
395 } else
396 ++I;
397 }
398
399 for (auto &SN : FailedSNs) {
400 CoalesceToPendingSNs.remove(
401 [&](SuperNode *SNC) { return SNC == SN.get(); });
402 for (auto &[Container, Elems] : SN->Defs) {
403 assert(ElemToPendingSN.count(Container));
404 auto &CElems = ElemToPendingSN[Container];
405 for (auto &Elem : Elems)
406 CElems.erase(Elem);
407 if (CElems.empty())
408 ElemToPendingSN.erase(Container);
409 }
410 }
411
412 return FailedSNs;
413 }
414
416 bool AllGood = true;
417 auto ErrLog = [&]() -> raw_ostream & {
418 AllGood = false;
419 return Log;
420 };
421
422 size_t DefCount = 0;
423 for (auto &PendingSN : PendingSNs) {
424 if (PendingSN->Deps.empty())
425 ErrLog() << "Pending SN " << PendingSN.get() << " has empty dep set.\n";
426 else {
427 bool BadElem = false;
428 for (auto &[Container, Elems] : PendingSN->Deps) {
429 auto I = ElemToPendingSN.find(Container);
430 if (I == ElemToPendingSN.end())
431 continue;
432 if (Elems.empty())
433 ErrLog() << "Pending SN " << PendingSN.get()
434 << " has dependence map entry for " << Container
435 << " with empty element set.\n";
436 for (auto &Elem : Elems) {
437 if (I->second.count(Elem)) {
438 ErrLog() << "Pending SN " << PendingSN.get()
439 << " has dependence on emitted element ( " << Container
440 << ", " << Elem << ")\n";
441 BadElem = true;
442 break;
443 }
444 }
445 if (BadElem)
446 break;
447 }
448 }
449
450 for (auto &[Container, Elems] : PendingSN->Defs) {
451 if (Elems.empty())
452 ErrLog() << "Pending SN " << PendingSN.get()
453 << " has def map entry for " << Container
454 << " with empty element set.\n";
455 DefCount += Elems.size();
456 auto I = ElemToPendingSN.find(Container);
457 if (I == ElemToPendingSN.end())
458 ErrLog() << "Pending SN " << PendingSN.get() << " has "
459 << Elems.size() << " defs in container " << Container
460 << " not covered by ElemsToPendingSN.\n";
461 else {
462 for (auto &Elem : Elems) {
463 auto J = I->second.find(Elem);
464 if (J == I->second.end())
465 ErrLog() << "Pending SN " << PendingSN.get() << " has element ("
466 << Container << ", " << Elem
467 << ") not covered by ElemsToPendingSN.\n";
468 else if (J->second != PendingSN.get())
469 ErrLog() << "ElemToPendingSN value invalid for (" << Container
470 << ", " << Elem << ")\n";
471 }
472 }
473 }
474 }
475
476 size_t DefCount2 = 0;
477 for (auto &[Container, Elems] : ElemToPendingSN)
478 DefCount2 += Elems.size();
479
480 assert(DefCount2 >= DefCount);
481 if (DefCount2 != DefCount)
482 ErrLog() << "ElemToPendingSN contains extra elements.\n";
483
484 return AllGood;
485 }
486
487private:
488 // Replace individual dependencies with supernode dependencies.
489 //
490 // For all dependencies in SNs, if the corresponding node is defined in
491 // ElemToSN then remove the individual dependency and add the record the
492 // dependency on the corresponding supernode in SuperNodeDeps.
493 static void hoistDeps(SuperNodeDepsMap &SuperNodeDeps,
494 std::vector<std::unique_ptr<SuperNode>> &SNs,
495 ElemToSuperNodeMap &ElemToSN) {
496 for (auto &SN : SNs) {
497 auto &SNDeps = SuperNodeDeps[SN.get()];
498 for (auto &[DefContainer, DefElems] : ElemToSN) {
499 auto I = SN->Deps.find(DefContainer);
500 if (I == SN->Deps.end())
501 continue;
502 for (auto &[DefElem, DefSN] : DefElems)
503 if (I->second.erase(DefElem))
504 SNDeps.insert(DefSN);
505 if (I->second.empty())
506 SN->Deps.erase(I);
507 }
508 }
509 }
510
511 // Compute transitive closure of deps for each node.
512 static void propagateSuperNodeDeps(SuperNodeDepsMap &SuperNodeDeps) {
513 for (auto &[SN, Deps] : SuperNodeDeps) {
514 DenseSet<SuperNode *> Reachable({SN});
515 SmallVector<SuperNode *> Worklist(Deps.begin(), Deps.end());
516
517 while (!Worklist.empty()) {
518 auto *DepSN = Worklist.pop_back_val();
519 if (!Reachable.insert(DepSN).second)
520 continue;
521 auto I = SuperNodeDeps.find(DepSN);
522 if (I == SuperNodeDeps.end())
523 continue;
524 for (auto *DepSNDep : I->second)
525 Worklist.push_back(DepSNDep);
526 }
527
528 Deps = std::move(Reachable);
529 }
530 }
531
532 // Sink SuperNode dependencies back to dependencies on individual nodes.
533 static void sinkDeps(std::vector<std::unique_ptr<SuperNode>> &SNs,
534 SuperNodeDepsMap &SuperNodeDeps) {
535 for (auto &SN : SNs) {
536 auto I = SuperNodeDeps.find(SN.get());
537 if (I == SuperNodeDeps.end())
538 continue;
539
540 for (auto *DepSN : I->second)
541 for (auto &[Container, Elems] : DepSN->Deps)
542 SN->Deps[Container].insert(Elems.begin(), Elems.end());
543 }
544 }
545
546 template <typename GetExternalStateFn>
547 static std::vector<SuperNode *>
548 processExternalDeps(std::vector<std::unique_ptr<SuperNode>> &SNs,
549 GetExternalStateFn &GetExternalState) {
550 std::vector<SuperNode *> FailedSNs;
551 for (auto &SN : SNs) {
552 bool SNHasError = false;
553 SmallVector<ContainerId> ContainersToRemove;
554 for (auto &[Container, Elems] : SN->Deps) {
555 SmallVector<ElementId> ElemToRemove;
556 for (auto &Elem : Elems) {
557 switch (GetExternalState(Container, Elem)) {
559 break;
561 ElemToRemove.push_back(Elem);
562 break;
564 ElemToRemove.push_back(Elem);
565 SNHasError = true;
566 break;
567 }
568 }
569 for (auto &Elem : ElemToRemove)
570 Elems.erase(Elem);
571 if (Elems.empty())
572 ContainersToRemove.push_back(Container);
573 }
574 for (auto &Container : ContainersToRemove)
575 SN->Deps.erase(Container);
576 if (SNHasError)
577 FailedSNs.push_back(SN.get());
578 }
579
580 return FailedSNs;
581 }
582
583 void processReadyOrFailed(std::vector<std::unique_ptr<SuperNode>> &SNs,
584 std::vector<std::unique_ptr<SuperNode>> &Ready,
585 std::vector<std::unique_ptr<SuperNode>> &Failed,
586 SuperNodeDepsMap &SuperNodeDeps,
587 ElemToSuperNodeMap &ElemToSNs,
588 std::vector<SuperNode *> FailedSNs) {
589 for (size_t I = 0; I != SNs.size();) {
590 auto &SN = SNs[I];
591
592 bool SNFailed = false;
593 assert(SuperNodeDeps.count(SN.get()));
594 auto &SNSuperNodeDeps = SuperNodeDeps[SN.get()];
595 for (auto *FailedSN : FailedSNs) {
596 if (FailedSN == SN.get() || SNSuperNodeDeps.count(FailedSN)) {
597 SNFailed = true;
598 break;
599 }
600 }
601
602 bool SNReady = SN->Deps.empty();
603
604 if (SNReady || SNFailed) {
605 auto &NodeList = SNFailed ? Failed : Ready;
606 NodeList.push_back(std::move(SN));
607 std::swap(SN, SNs.back());
608 SNs.pop_back();
609 } else
610 ++I;
611 }
612 }
613
614 std::vector<std::unique_ptr<SuperNode>> PendingSNs;
615 ElemToSuperNodeMap ElemToPendingSN;
616 Coalescer CoalesceToPendingSNs;
617};
618
619} // namespace llvm::orc::detail
620
621#endif // LLVM_EXECUTIONENGINE_ORC_WAITINGONGRAPH_H
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
ReachingDefInfo InstSet & ToRemove
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This file defines the DenseMap class.
This file defines the DenseSet and SmallDenseSet classes.
#define I(x, y, z)
Definition MD5.cpp:58
#define H(x, y, z)
Definition MD5.cpp:57
register Register Coalescer
This file contains some templates that are useful if you are working with the STL at all.
This file defines the SmallVector class.
iterator find(const_arg_type_t< KeyT > Val)
Definition DenseMap.h:178
bool erase(const KeyT &Val)
Definition DenseMap.h:322
bool empty() const
Definition DenseMap.h:109
iterator end()
Definition DenseMap.h:81
Implements a dense probed hash-table based set.
Definition DenseSet.h:279
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
const std::vector< std::unique_ptr< SuperNode > > & superNodes() const
Build SuperNodes from (definition-set, dependence-set) pairs.
void add(ContainerElementsMap Defs, ContainerElementsMap Deps)
std::vector< std::unique_ptr< SuperNode > > takeSuperNodes()
const ContainerElementsMap & defs() const
const ContainerElementsMap & deps() const
SuperNode(ContainerElementsMap Defs, ContainerElementsMap Deps)
WaitingOnGraph class template.
std::vector< std::unique_ptr< SuperNode > > fail(const ContainerElementsMap &Failed)
Identify the given symbols as Failed.
EmitResult emit(SimplifyResult SR, GetExternalStateFn &&GetExternalState)
Add the given SuperNodes to the graph, returning any SuperNodes that move to the Ready or Failed stat...
static SimplifyResult simplify(std::vector< std::unique_ptr< SuperNode > > SNs)
Preprocess a list of SuperNodes to remove all intra-SN dependencies.
bool validate(raw_ostream &Log)
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
@ C
The default llvm calling convention, compatible with C.
Definition CallingConv.h:34
SmallVector< Node, 4 > NodeList
Definition RDFGraph.h:550
testing::Matcher< const detail::ErrorHolder & > Failed()
Definition Error.h:198
void sort(IteratorTy Start, IteratorTy End)
Definition STLExtras.h:1622
class LLVM_GSL_OWNER SmallVector
Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition STLExtras.h:1867
hash_code hash_combine(const Ts &...args)
Combine values into a single hash_code.
Definition Hashing.h:592
hash_code hash_combine_range(InputIteratorT first, InputIteratorT last)
Compute a hash_code for a sequence of values.
Definition Hashing.h:466
Implement std::hash so that hash_code can be used in STL containers.
Definition BitVector.h:867
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
Definition BitVector.h:869
std::vector< std::unique_ptr< SuperNode > > Failed
std::vector< std::unique_ptr< SuperNode > > Ready