clang 23.0.0git
Action.h
Go to the documentation of this file.
1//===- Action.h - Abstract compilation steps --------------------*- 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#ifndef LLVM_CLANG_DRIVER_ACTION_H
10#define LLVM_CLANG_DRIVER_ACTION_H
11
12#include "clang/Basic/LLVM.h"
13#include "clang/Driver/Types.h"
14#include "clang/Driver/Util.h"
15#include "llvm/ADT/ArrayRef.h"
16#include "llvm/ADT/STLExtras.h"
17#include "llvm/ADT/SmallVector.h"
18#include "llvm/ADT/StringRef.h"
19#include "llvm/ADT/iterator_range.h"
20#include <string>
21
22namespace llvm {
23namespace opt {
24
25class Arg;
26
27} // namespace opt
28} // namespace llvm
29
30namespace clang {
31namespace driver {
32
33class ToolChain;
34
35/// Action - Represent an abstract compilation step to perform.
36///
37/// An action represents an edge in the compilation graph; typically
38/// it is a job to transform an input using some tool.
39///
40/// The current driver is hard wired to expect actions which produce a
41/// single primary output, at least in terms of controlling the
42/// compilation. Actions can produce auxiliary files, but can only
43/// produce a single output to feed into subsequent actions.
44///
45/// Actions are usually owned by a Compilation, which creates new
46/// actions via MakeAction().
47class Action {
48public:
49 using size_type = ActionList::size_type;
50 using input_iterator = ActionList::iterator;
51 using input_const_iterator = ActionList::const_iterator;
52 using input_range = llvm::iterator_range<input_iterator>;
53 using input_const_range = llvm::iterator_range<input_const_iterator>;
54
84
85 // The offloading kind determines if this action is binded to a particular
86 // programming model. Each entry reserves one bit. We also have a special kind
87 // to designate the host offloading tool chain.
89 OFK_None = 0x00,
90
91 // The host offloading tool chain.
92 OFK_Host = 0x01,
93
94 // The device offloading tool chains - one bit for each programming model.
95 OFK_Cuda = 0x02,
96 OFK_OpenMP = 0x04,
97 OFK_HIP = 0x08,
98 OFK_SYCL = 0x10,
99
102 };
103
104 static const char *getClassName(ActionClass AC);
105
106private:
107 ActionClass Kind;
108
109 /// The output type of this action.
111
112 ActionList Inputs;
113
114 /// Flag that is set to true if this action can be collapsed with others
115 /// actions that depend on it. This is true by default and set to false when
116 /// the action is used by two different tool chains, which is enabled by the
117 /// offloading support implementation.
118 bool CanBeCollapsedWithNextDependentAction = true;
119
120protected:
121 ///
122 /// Offload information.
123 ///
124
125 /// The host offloading kind - a combination of kinds encoded in a mask.
126 /// Multiple programming models may be supported simultaneously by the same
127 /// host.
129
130 /// Offloading kind of the device.
132
133 /// The Offloading architecture associated with this action.
134 const char *OffloadingArch = nullptr;
135
136 /// The Offloading toolchain associated with this device action.
138
139 Action(ActionClass Kind, types::ID Type) : Action(Kind, ActionList(), Type) {}
140 Action(ActionClass Kind, Action *Input, types::ID Type)
141 : Action(Kind, ActionList({Input}), Type) {}
143 : Action(Kind, ActionList({Input}), Input->getType()) {}
144 Action(ActionClass Kind, const ActionList &Inputs, types::ID Type)
145 : Kind(Kind), Type(Type), Inputs(Inputs) {}
146
147public:
148 virtual ~Action();
149
150 const char *getClassName() const { return Action::getClassName(getKind()); }
151
152 ActionClass getKind() const { return Kind; }
153 types::ID getType() const { return Type; }
154
155 ActionList &getInputs() { return Inputs; }
156 const ActionList &getInputs() const { return Inputs; }
157
158 size_type size() const { return Inputs.size(); }
159
160 input_iterator input_begin() { return Inputs.begin(); }
161 input_iterator input_end() { return Inputs.end(); }
163 input_const_iterator input_begin() const { return Inputs.begin(); }
164 input_const_iterator input_end() const { return Inputs.end(); }
168
169 /// Mark this action as not legal to collapse.
171 CanBeCollapsedWithNextDependentAction = false;
172 }
173
174 /// Return true if this function can be collapsed with others.
176 return CanBeCollapsedWithNextDependentAction;
177 }
178
179 /// Return a string containing the offload kind of the action.
180 std::string getOffloadingKindPrefix() const;
181
182 /// Return a string that can be used as prefix in order to generate unique
183 /// files for each offloading kind. By default, no prefix is used for
184 /// non-device kinds, except if \a CreatePrefixForHost is set.
185 static std::string
186 GetOffloadingFileNamePrefix(OffloadKind Kind,
187 StringRef NormalizedTriple,
188 bool CreatePrefixForHost = false);
189
190 /// Return a string containing a offload kind name.
191 static StringRef GetOffloadKindName(OffloadKind Kind);
192
193 /// Set the device offload info of this action and propagate it to its
194 /// dependences.
195 void propagateDeviceOffloadInfo(OffloadKind OKind, const char *OArch,
196 const ToolChain *OToolChain);
197
198 /// Append the host offload info of this action and propagate it to its
199 /// dependences.
200 void propagateHostOffloadInfo(unsigned OKinds, const char *OArch);
201
202 void setHostOffloadInfo(unsigned OKinds, const char *OArch) {
203 ActiveOffloadKindMask |= OKinds;
204 OffloadingArch = OArch;
205 }
206
207 /// Set the offload info of this action to be the same as the provided action,
208 /// and propagate it to its dependences.
209 void propagateOffloadInfo(const Action *A);
210
213 }
214
216 const char *getOffloadingArch() const { return OffloadingArch; }
218 return OffloadingToolChain;
219 }
220
221 /// Check if this action have any offload kinds. Note that host offload kinds
222 /// are only set if the action is a dependence to a host offload action.
223 bool isHostOffloading(unsigned int OKind) const {
224 return ActiveOffloadKindMask & OKind;
225 }
226 bool isDeviceOffloading(OffloadKind OKind) const {
227 return OffloadingDeviceKind == OKind;
228 }
229 bool isOffloading(OffloadKind OKind) const {
230 return isHostOffloading(OKind) || isDeviceOffloading(OKind);
231 }
232};
233
234class InputAction : public Action {
235 const llvm::opt::Arg &Input;
236 std::string Id;
237 virtual void anchor();
238
239public:
240 InputAction(const llvm::opt::Arg &Input, types::ID Type,
241 StringRef Id = StringRef());
242
243 const llvm::opt::Arg &getInputArg() const { return Input; }
244
245 void setId(StringRef _Id) { Id = _Id.str(); }
246 StringRef getId() const { return Id; }
247
248 static bool classof(const Action *A) {
249 return A->getKind() == InputClass;
250 }
251};
252
253class BindArchAction : public Action {
254 virtual void anchor();
255
256 /// The architecture to bind, or 0 if the default architecture
257 /// should be bound.
258 StringRef ArchName;
259
260public:
261 BindArchAction(Action *Input, StringRef ArchName);
262
263 StringRef getArchName() const { return ArchName; }
264
265 static bool classof(const Action *A) {
266 return A->getKind() == BindArchClass;
267 }
268};
269
270/// An offload action combines host or/and device actions according to the
271/// programming model implementation needs and propagates the offloading kind to
272/// its dependences.
273class OffloadAction final : public Action {
274 LLVM_DECLARE_VIRTUAL_ANCHOR_FUNCTION();
275
276public:
277 /// Type used to communicate device actions. It associates bound architecture,
278 /// toolchain, and offload kind to each action.
279 class DeviceDependences final {
280 public:
284
285 private:
286 // Lists that keep the information for each dependency. All the lists are
287 // meant to be updated in sync. We are adopting separate lists instead of a
288 // list of structs, because that simplifies forwarding the actions list to
289 // initialize the inputs of the base Action class.
290
291 /// The dependence actions.
292 ActionList DeviceActions;
293
294 /// The offloading toolchains that should be used with the action.
295 ToolChainList DeviceToolChains;
296
297 /// The architectures that should be used with this action.
298 BoundArchList DeviceBoundArchs;
299
300 /// The offload kind of each dependence.
301 OffloadKindList DeviceOffloadKinds;
302
303 public:
304 /// Add an action along with the associated toolchain, bound arch, and
305 /// offload kind.
306 void add(Action &A, const ToolChain &TC, const char *BoundArch,
307 OffloadKind OKind);
308
309 /// Add an action along with the associated toolchain, bound arch, and
310 /// offload kinds.
311 void add(Action &A, const ToolChain &TC, const char *BoundArch,
312 unsigned OffloadKindMask);
313
314 /// Get each of the individual arrays.
315 const ActionList &getActions() const { return DeviceActions; }
316 const ToolChainList &getToolChains() const { return DeviceToolChains; }
317 const BoundArchList &getBoundArchs() const { return DeviceBoundArchs; }
319 return DeviceOffloadKinds;
320 }
321 };
322
323 /// Type used to communicate host actions. It associates bound architecture,
324 /// toolchain, and offload kinds to the host action.
325 class HostDependence final {
326 /// The dependence action.
327 Action &HostAction;
328
329 /// The offloading toolchain that should be used with the action.
330 const ToolChain &HostToolChain;
331
332 /// The architectures that should be used with this action.
333 const char *HostBoundArch = nullptr;
334
335 /// The offload kind of each dependence.
336 unsigned HostOffloadKinds = 0u;
337
338 public:
339 HostDependence(Action &A, const ToolChain &TC, const char *BoundArch,
340 const unsigned OffloadKinds)
341 : HostAction(A), HostToolChain(TC), HostBoundArch(BoundArch),
342 HostOffloadKinds(OffloadKinds) {}
343
344 /// Constructor version that obtains the offload kinds from the device
345 /// dependencies.
346 HostDependence(Action &A, const ToolChain &TC, const char *BoundArch,
347 const DeviceDependences &DDeps);
348 Action *getAction() const { return &HostAction; }
349 const ToolChain *getToolChain() const { return &HostToolChain; }
350 const char *getBoundArch() const { return HostBoundArch; }
351 unsigned getOffloadKinds() const { return HostOffloadKinds; }
352 };
353
355 llvm::function_ref<void(Action *, const ToolChain *, const char *)>;
356
357private:
358 /// The host offloading toolchain that should be used with the action.
359 const ToolChain *HostTC = nullptr;
360
361 /// The tool chains associated with the list of actions.
363
364public:
365 OffloadAction(const HostDependence &HDep);
366 OffloadAction(const DeviceDependences &DDeps, types::ID Ty);
367 OffloadAction(const HostDependence &HDep, const DeviceDependences &DDeps);
368
369 /// Execute the work specified in \a Work on the host dependence.
370 void doOnHostDependence(const OffloadActionWorkTy &Work) const;
371
372 /// Execute the work specified in \a Work on each device dependence.
373 void doOnEachDeviceDependence(const OffloadActionWorkTy &Work) const;
374
375 /// Execute the work specified in \a Work on each dependence.
376 void doOnEachDependence(const OffloadActionWorkTy &Work) const;
377
378 /// Execute the work specified in \a Work on each host or device dependence if
379 /// \a IsHostDependenceto is true or false, respectively.
380 void doOnEachDependence(bool IsHostDependence,
381 const OffloadActionWorkTy &Work) const;
382
383 /// Return true if the action has a host dependence.
384 bool hasHostDependence() const;
385
386 /// Return the host dependence of this action. This function is only expected
387 /// to be called if the host dependence exists.
388 Action *getHostDependence() const;
389
390 /// Return true if the action has a single device dependence. If \a
391 /// DoNotConsiderHostActions is set, ignore the host dependence, if any, while
392 /// accounting for the number of dependences.
393 bool hasSingleDeviceDependence(bool DoNotConsiderHostActions = false) const;
394
395 /// Return the single device dependence of this action. This function is only
396 /// expected to be called if a single device dependence exists. If \a
397 /// DoNotConsiderHostActions is set, a host dependence is allowed.
398 Action *
399 getSingleDeviceDependence(bool DoNotConsiderHostActions = false) const;
400
401 static bool classof(const Action *A) { return A->getKind() == OffloadClass; }
402};
403
404class JobAction : public Action {
405 virtual void anchor();
406
407protected:
408 JobAction(ActionClass Kind, Action *Input, types::ID Type);
409 JobAction(ActionClass Kind, const ActionList &Inputs, types::ID Type);
410
411public:
412 static bool classof(const Action *A) {
413 return (A->getKind() >= JobClassFirst &&
414 A->getKind() <= JobClassLast);
415 }
416};
417
419 void anchor() override;
420
421public:
422 PreprocessJobAction(Action *Input, types::ID OutputType);
423
424 static bool classof(const Action *A) {
425 return A->getKind() == PreprocessJobClass;
426 }
427};
428
430 void anchor() override;
431
432protected:
433 PrecompileJobAction(ActionClass Kind, Action *Input, types::ID OutputType);
434
435public:
436 PrecompileJobAction(Action *Input, types::ID OutputType);
437
438 static bool classof(const Action *A) {
439 return A->getKind() == PrecompileJobClass;
440 }
441};
442
444 void anchor() override;
445
446public:
447 ExtractAPIJobAction(Action *Input, types::ID OutputType);
448
449 static bool classof(const Action *A) {
450 return A->getKind() == ExtractAPIJobClass;
451 }
452
453 void addHeaderInput(Action *Input) { getInputs().push_back(Input); }
454};
455
457 void anchor() override;
458
459public:
460 AnalyzeJobAction(Action *Input, types::ID OutputType);
461
462 static bool classof(const Action *A) {
463 return A->getKind() == AnalyzeJobClass;
464 }
465};
466
468 void anchor() override;
469
470public:
471 CompileJobAction(Action *Input, types::ID OutputType);
472
473 static bool classof(const Action *A) {
474 return A->getKind() == CompileJobClass;
475 }
476};
477
479 void anchor() override;
480
481public:
482 BackendJobAction(Action *Input, types::ID OutputType);
483
484 static bool classof(const Action *A) {
485 return A->getKind() == BackendJobClass;
486 }
487};
488
490 void anchor() override;
491
492public:
493 AssembleJobAction(Action *Input, types::ID OutputType);
494
495 static bool classof(const Action *A) {
496 return A->getKind() == AssembleJobClass;
497 }
498};
499
501 void anchor() override;
502
503public:
505
506 static bool classof(const Action *A) {
507 return A->getKind() == IfsMergeJobClass;
508 }
509};
510
511class LinkJobAction : public JobAction {
512 void anchor() override;
513
514public:
515 LinkJobAction(ActionList &Inputs, types::ID Type);
516
517 static bool classof(const Action *A) {
518 return A->getKind() == LinkJobClass;
519 }
520};
521
522class LipoJobAction : public JobAction {
523 void anchor() override;
524
525public:
526 LipoJobAction(ActionList &Inputs, types::ID Type);
527
528 static bool classof(const Action *A) {
529 return A->getKind() == LipoJobClass;
530 }
531};
532
534 void anchor() override;
535
536public:
538
539 static bool classof(const Action *A) {
540 return A->getKind() == DsymutilJobClass;
541 }
542};
543
545 void anchor() override;
546
547public:
548 VerifyJobAction(ActionClass Kind, Action *Input, types::ID Type);
549
550 static bool classof(const Action *A) {
551 return A->getKind() == VerifyDebugInfoJobClass ||
553 }
554};
555
557 void anchor() override;
558
559public:
561
562 static bool classof(const Action *A) {
563 return A->getKind() == VerifyDebugInfoJobClass;
564 }
565};
566
568 void anchor() override;
569
570public:
571 VerifyPCHJobAction(Action *Input, types::ID Type);
572
573 static bool classof(const Action *A) {
574 return A->getKind() == VerifyPCHJobClass;
575 }
576};
577
579 void anchor() override;
580
581public:
582 // Offloading bundling doesn't change the type of output.
584
585 static bool classof(const Action *A) {
586 return A->getKind() == OffloadBundlingJobClass;
587 }
588};
589
591 void anchor() override;
592
593public:
594 /// Type that provides information about the actions that depend on this
595 /// unbundling action.
596 struct DependentActionInfo final {
597 /// The tool chain of the dependent action.
599
600 /// The bound architecture of the dependent action.
602
603 /// The offload kind of the dependent action.
605
612 };
613
614private:
615 /// Container that keeps information about each dependence of this unbundling
616 /// action.
617 SmallVector<DependentActionInfo, 6> DependentActionInfoArray;
618
619public:
620 // Offloading unbundling doesn't change the type of output.
622
623 /// Register information about a dependent action.
624 void registerDependentActionInfo(const ToolChain *TC, StringRef BoundArch,
625 OffloadKind Kind) {
626 DependentActionInfoArray.push_back({TC, BoundArch, Kind});
627 }
628
629 /// Return the information about all depending actions.
631 return DependentActionInfoArray;
632 }
633
634 static bool classof(const Action *A) {
635 return A->getKind() == OffloadUnbundlingJobClass;
636 }
637};
638
640 void anchor() override;
641
642public:
644
645 static bool classof(const Action *A) {
646 return A->getKind() == OffloadPackagerJobClass;
647 }
648};
649
651 void anchor() override;
652
653public:
655
656 static bool classof(const Action *A) {
657 return A->getKind() == LinkerWrapperJobClass;
658 }
659};
660
662 void anchor() override;
663
664public:
666
667 static bool classof(const Action *A) {
668 return A->getKind() == StaticLibJobClass;
669 }
670};
671
673 void anchor() override;
674
675public:
677
678 static bool classof(const Action *A) {
679 return A->getKind() == BinaryAnalyzeJobClass;
680 }
681};
682
684 void anchor() override;
685
686public:
688
689 static bool classof(const Action *A) {
690 return A->getKind() == BinaryTranslatorJobClass;
691 }
692};
693
695 void anchor() override;
696
697public:
698 ObjcopyJobAction(Action *Input, types::ID Type);
699
700 static bool classof(const Action *A) {
701 return A->getKind() == ObjcopyJobClass;
702 }
703};
704
705} // namespace driver
706} // namespace clang
707
708#endif // LLVM_CLANG_DRIVER_ACTION_H
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
The base class of the type hierarchy.
Definition TypeBase.h:1871
Action - Represent an abstract compilation step to perform.
Definition Action.h:47
void setHostOffloadInfo(unsigned OKinds, const char *OArch)
Definition Action.h:202
input_const_iterator input_begin() const
Definition Action.h:163
OffloadKind OffloadingDeviceKind
Offloading kind of the device.
Definition Action.h:131
Action(ActionClass Kind, types::ID Type)
Definition Action.h:139
const char * getOffloadingArch() const
Definition Action.h:216
size_type size() const
Definition Action.h:158
bool isCollapsingWithNextDependentActionLegal() const
Return true if this function can be collapsed with others.
Definition Action.h:175
types::ID getType() const
Definition Action.h:153
void setCannotBeCollapsedWithNextDependentAction()
Mark this action as not legal to collapse.
Definition Action.h:170
std::string getOffloadingKindPrefix() const
Return a string containing the offload kind of the action.
Definition Action.cpp:105
ActionList::size_type size_type
Definition Action.h:49
void propagateDeviceOffloadInfo(OffloadKind OKind, const char *OArch, const ToolChain *OToolChain)
Set the device offload info of this action and propagate it to its dependences.
Definition Action.cpp:62
const ToolChain * getOffloadingToolChain() const
Definition Action.h:217
input_iterator input_end()
Definition Action.h:161
const ToolChain * OffloadingToolChain
The Offloading toolchain associated with this device action.
Definition Action.h:137
Action(ActionClass Kind, Action *Input, types::ID Type)
Definition Action.h:140
static std::string GetOffloadingFileNamePrefix(OffloadKind Kind, StringRef NormalizedTriple, bool CreatePrefixForHost=false)
Return a string that can be used as prefix in order to generate unique files for each offloading kind...
Definition Action.cpp:148
Action(ActionClass Kind, Action *Input)
Definition Action.h:142
void propagateOffloadInfo(const Action *A)
Set the offload info of this action to be the same as the provided action, and propagate it to its de...
Definition Action.cpp:96
const ActionList & getInputs() const
Definition Action.h:156
ActionClass getKind() const
Definition Action.h:152
ActionList::iterator input_iterator
Definition Action.h:50
static StringRef GetOffloadKindName(OffloadKind Kind)
Return a string containing a offload kind name.
Definition Action.cpp:164
input_const_range inputs() const
Definition Action.h:165
const char * getClassName() const
Definition Action.h:150
OffloadKind getOffloadingDeviceKind() const
Definition Action.h:215
input_const_iterator input_end() const
Definition Action.h:164
input_iterator input_begin()
Definition Action.h:160
void propagateHostOffloadInfo(unsigned OKinds, const char *OArch)
Append the host offload info of this action and propagate it to its dependences.
Definition Action.cpp:82
unsigned ActiveOffloadKindMask
Offload information.
Definition Action.h:128
input_range inputs()
Definition Action.h:162
Action(ActionClass Kind, const ActionList &Inputs, types::ID Type)
Definition Action.h:144
bool isHostOffloading(unsigned int OKind) const
Check if this action have any offload kinds.
Definition Action.h:223
bool isDeviceOffloading(OffloadKind OKind) const
Definition Action.h:226
ActionList::const_iterator input_const_iterator
Definition Action.h:51
const char * OffloadingArch
The Offloading architecture associated with this action.
Definition Action.h:134
ActionList & getInputs()
Definition Action.h:155
llvm::iterator_range< input_iterator > input_range
Definition Action.h:52
llvm::iterator_range< input_const_iterator > input_const_range
Definition Action.h:53
unsigned getOffloadingHostActiveKinds() const
Definition Action.h:211
bool isOffloading(OffloadKind OKind) const
Definition Action.h:229
static bool classof(const Action *A)
Definition Action.h:462
AnalyzeJobAction(Action *Input, types::ID OutputType)
Definition Action.cpp:377
AssembleJobAction(Action *Input, types::ID OutputType)
Definition Action.cpp:392
static bool classof(const Action *A)
Definition Action.h:495
static bool classof(const Action *A)
Definition Action.h:484
BackendJobAction(Action *Input, types::ID OutputType)
Definition Action.cpp:387
static bool classof(const Action *A)
Definition Action.h:678
BinaryAnalyzeJobAction(Action *Input, types::ID Type)
Definition Action.cpp:464
BinaryTranslatorJobAction(Action *Input, types::ID Type)
Definition Action.cpp:469
static bool classof(const Action *A)
Definition Action.h:689
static bool classof(const Action *A)
Definition Action.h:265
StringRef getArchName() const
Definition Action.h:263
BindArchAction(Action *Input, StringRef ArchName)
Definition Action.cpp:191
static bool classof(const Action *A)
Definition Action.h:473
CompileJobAction(Action *Input, types::ID OutputType)
Definition Action.cpp:382
DsymutilJobAction(ActionList &Inputs, types::ID Type)
Definition Action.cpp:412
static bool classof(const Action *A)
Definition Action.h:539
static bool classof(const Action *A)
Definition Action.h:449
ExtractAPIJobAction(Action *Input, types::ID OutputType)
Definition Action.cpp:372
void addHeaderInput(Action *Input)
Definition Action.h:453
static bool classof(const Action *A)
Definition Action.h:506
IfsMergeJobAction(ActionList &Inputs, types::ID Type)
Definition Action.cpp:397
void setId(StringRef _Id)
Definition Action.h:245
InputAction(const llvm::opt::Arg &Input, types::ID Type, StringRef Id=StringRef())
Definition Action.cpp:186
const llvm::opt::Arg & getInputArg() const
Definition Action.h:243
static bool classof(const Action *A)
Definition Action.h:248
StringRef getId() const
Definition Action.h:246
static bool classof(const Action *A)
Definition Action.h:412
JobAction(ActionClass Kind, Action *Input, types::ID Type)
Definition Action.cpp:348
static bool classof(const Action *A)
Definition Action.h:517
LinkJobAction(ActionList &Inputs, types::ID Type)
Definition Action.cpp:402
static bool classof(const Action *A)
Definition Action.h:656
LinkerWrapperJobAction(ActionList &Inputs, types::ID Type)
Definition Action.cpp:453
static bool classof(const Action *A)
Definition Action.h:528
LipoJobAction(ActionList &Inputs, types::ID Type)
Definition Action.cpp:407
static bool classof(const Action *A)
Definition Action.h:700
ObjcopyJobAction(Action *Input, types::ID Type)
Definition Action.cpp:475
Type used to communicate device actions.
Definition Action.h:279
void add(Action &A, const ToolChain &TC, const char *BoundArch, OffloadKind OKind)
Add an action along with the associated toolchain, bound arch, and offload kind.
Definition Action.cpp:316
SmallVector< const ToolChain *, 3 > ToolChainList
Definition Action.h:281
const BoundArchList & getBoundArchs() const
Definition Action.h:317
const OffloadKindList & getOffloadKinds() const
Definition Action.h:318
const ActionList & getActions() const
Get each of the individual arrays.
Definition Action.h:315
SmallVector< OffloadKind, 3 > OffloadKindList
Definition Action.h:283
SmallVector< const char *, 3 > BoundArchList
Definition Action.h:282
const ToolChainList & getToolChains() const
Definition Action.h:316
Type used to communicate host actions.
Definition Action.h:325
HostDependence(Action &A, const ToolChain &TC, const char *BoundArch, const unsigned OffloadKinds)
Definition Action.h:339
const ToolChain * getToolChain() const
Definition Action.h:349
void doOnEachDependence(const OffloadActionWorkTy &Work) const
Execute the work specified in Work on each dependence.
Definition Action.cpp:279
Action * getSingleDeviceDependence(bool DoNotConsiderHostActions=false) const
Return the single device dependence of this action.
Definition Action.cpp:308
bool hasSingleDeviceDependence(bool DoNotConsiderHostActions=false) const
Return true if the action has a single device dependence.
Definition Action.cpp:300
Action * getHostDependence() const
Return the host dependence of this action.
Definition Action.cpp:294
void doOnEachDeviceDependence(const OffloadActionWorkTy &Work) const
Execute the work specified in Work on each device dependence.
Definition Action.cpp:257
bool hasHostDependence() const
Return true if the action has a host dependence.
Definition Action.cpp:292
static bool classof(const Action *A)
Definition Action.h:401
llvm::function_ref< void(Action *, const ToolChain *, const char *)> OffloadActionWorkTy
Definition Action.h:354
void doOnHostDependence(const OffloadActionWorkTy &Work) const
Execute the work specified in Work on the host dependence.
Definition Action.cpp:249
OffloadAction(const HostDependence &HDep)
Definition Action.cpp:196
static bool classof(const Action *A)
Definition Action.h:585
OffloadBundlingJobAction(ActionList &Inputs)
Definition Action.cpp:437
OffloadPackagerJobAction(ActionList &Inputs, types::ID Type)
Definition Action.cpp:447
static bool classof(const Action *A)
Definition Action.h:645
static bool classof(const Action *A)
Definition Action.h:634
void registerDependentActionInfo(const ToolChain *TC, StringRef BoundArch, OffloadKind Kind)
Register information about a dependent action.
Definition Action.h:624
ArrayRef< DependentActionInfo > getDependentActionsInfo() const
Return the information about all depending actions.
Definition Action.h:630
static bool classof(const Action *A)
Definition Action.h:438
PrecompileJobAction(ActionClass Kind, Action *Input, types::ID OutputType)
Definition Action.cpp:364
static bool classof(const Action *A)
Definition Action.h:424
PreprocessJobAction(Action *Input, types::ID OutputType)
Definition Action.cpp:356
StaticLibJobAction(ActionList &Inputs, types::ID Type)
Definition Action.cpp:459
static bool classof(const Action *A)
Definition Action.h:667
ToolChain - Access to tools for a single platform.
Definition ToolChain.h:92
VerifyDebugInfoJobAction(Action *Input, types::ID Type)
Definition Action.cpp:426
static bool classof(const Action *A)
Definition Action.h:562
VerifyJobAction(ActionClass Kind, Action *Input, types::ID Type)
Definition Action.cpp:417
static bool classof(const Action *A)
Definition Action.h:550
static bool classof(const Action *A)
Definition Action.h:573
VerifyPCHJobAction(Action *Input, types::ID Type)
Definition Action.cpp:432
SmallVector< Action *, 3 > ActionList
ActionList - Type used for lists of actions.
Definition Util.h:25
The JSON file list parser is used to communicate input to InstallAPI.
Diagnostic wrappers for TextAPI types for error reporting.
Definition Dominators.h:30
const OffloadKind DependentOffloadKind
The offload kind of the dependent action.
Definition Action.h:604
DependentActionInfo(const ToolChain *DependentToolChain, StringRef DependentBoundArch, const OffloadKind DependentOffloadKind)
Definition Action.h:606
StringRef DependentBoundArch
The bound architecture of the dependent action.
Definition Action.h:601
const ToolChain * DependentToolChain
The tool chain of the dependent action.
Definition Action.h:598