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