9#ifndef LLVM_CLANG_DRIVER_ACTION_H
10#define LLVM_CLANG_DRIVER_ACTION_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"
115 bool CanBeCollapsedWithNextDependentAction =
true;
142 : Kind(Kind),
Type(
Type), Inputs(Inputs) {}
168 CanBeCollapsedWithNextDependentAction =
false;
173 return CanBeCollapsedWithNextDependentAction;
184 StringRef NormalizedTriple,
185 bool CreatePrefixForHost =
false);
232 const llvm::opt::Arg &Input;
234 virtual void anchor();
238 StringRef
Id = StringRef());
251 virtual void anchor();
271 LLVM_DECLARE_VIRTUAL_ANCHOR_FUNCTION();
309 unsigned OffloadKindMask);
316 return DeviceOffloadKinds;
330 const char *HostBoundArch =
nullptr;
333 unsigned HostOffloadKinds = 0u;
337 const unsigned OffloadKinds)
338 : HostAction(A), HostToolChain(TC), HostBoundArch(BoundArch),
339 HostOffloadKinds(OffloadKinds) {}
402 virtual void anchor();
416 void anchor()
override;
427 void anchor()
override;
441 void anchor()
override;
454 void anchor()
override;
465 void anchor()
override;
476 void anchor()
override;
487 void anchor()
override;
498 void anchor()
override;
509 void anchor()
override;
520 void anchor()
override;
531 void anchor()
override;
542 void anchor()
override;
554 void anchor()
override;
565 void anchor()
override;
576 void anchor()
override;
588 void anchor()
override;
623 DependentActionInfoArray.push_back({TC, BoundArch, Kind});
628 return DependentActionInfoArray;
637 void anchor()
override;
648 void anchor()
override;
659 void anchor()
override;
670 void anchor()
override;
681 void anchor()
override;
692 void anchor()
override;
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
The base class of the type hierarchy.
Action - Represent an abstract compilation step to perform.
void setHostOffloadInfo(unsigned OKinds, const char *OArch)
input_const_iterator input_begin() const
OffloadKind OffloadingDeviceKind
Offloading kind of the device.
Action(ActionClass Kind, types::ID Type)
const char * getOffloadingArch() const
bool isCollapsingWithNextDependentActionLegal() const
Return true if this function can be collapsed with others.
types::ID getType() const
void setCannotBeCollapsedWithNextDependentAction()
Mark this action as not legal to collapse.
std::string getOffloadingKindPrefix() const
Return a string containing the offload kind of the action.
ActionList::size_type size_type
void propagateDeviceOffloadInfo(OffloadKind OKind, const char *OArch, const ToolChain *OToolChain)
Set the device offload info of this action and propagate it to its dependences.
const ToolChain * getOffloadingToolChain() const
input_iterator input_end()
const ToolChain * OffloadingToolChain
The Offloading toolchain associated with this device action.
Action(ActionClass Kind, Action *Input, types::ID Type)
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...
Action(ActionClass Kind, Action *Input)
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...
const ActionList & getInputs() const
ActionClass getKind() const
ActionList::iterator input_iterator
static StringRef GetOffloadKindName(OffloadKind Kind)
Return a string containing a offload kind name.
input_const_range inputs() const
const char * getClassName() const
OffloadKind getOffloadingDeviceKind() const
input_const_iterator input_end() const
input_iterator input_begin()
void propagateHostOffloadInfo(unsigned OKinds, const char *OArch)
Append the host offload info of this action and propagate it to its dependences.
unsigned ActiveOffloadKindMask
Offload information.
Action(ActionClass Kind, const ActionList &Inputs, types::ID Type)
bool isHostOffloading(unsigned int OKind) const
Check if this action have any offload kinds.
bool isDeviceOffloading(OffloadKind OKind) const
ActionList::const_iterator input_const_iterator
const char * OffloadingArch
The Offloading architecture associated with this action.
llvm::iterator_range< input_iterator > input_range
@ OffloadUnbundlingJobClass
@ BinaryTranslatorJobClass
@ OffloadBundlingJobClass
@ VerifyDebugInfoJobClass
@ OffloadPackagerJobClass
llvm::iterator_range< input_const_iterator > input_const_range
unsigned getOffloadingHostActiveKinds() const
bool isOffloading(OffloadKind OKind) const
static bool classof(const Action *A)
static bool classof(const Action *A)
static bool classof(const Action *A)
static bool classof(const Action *A)
static bool classof(const Action *A)
static bool classof(const Action *A)
StringRef getArchName() const
static bool classof(const Action *A)
static bool classof(const Action *A)
static bool classof(const Action *A)
static bool classof(const Action *A)
static bool classof(const Action *A)
static bool classof(const Action *A)
static bool classof(const Action *A)
static bool classof(const Action *A)
Type used to communicate device actions.
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.
const BoundArchList & getBoundArchs() const
const OffloadKindList & getOffloadKinds() const
const ActionList & getActions() const
Get each of the individual arrays.
const ToolChainList & getToolChains() const
Type used to communicate host actions.
Action * getAction() const
HostDependence(Action &A, const ToolChain &TC, const char *BoundArch, const unsigned OffloadKinds)
const ToolChain * getToolChain() const
unsigned getOffloadKinds() const
const char * getBoundArch() const
An offload action combines host or/and device actions according to the programming model implementati...
void doOnEachDependence(const OffloadActionWorkTy &Work) const
Execute the work specified in Work on each dependence.
Action * getSingleDeviceDependence(bool DoNotConsiderHostActions=false) const
Return the single device dependence of this action.
bool hasSingleDeviceDependence(bool DoNotConsiderHostActions=false) const
Return true if the action has a single device dependence.
Action * getHostDependence() const
Return the host dependence of this action.
llvm::function_ref< void(Action *, const ToolChain *, const char *)> OffloadActionWorkTy
void doOnEachDeviceDependence(const OffloadActionWorkTy &Work) const
Execute the work specified in Work on each device dependence.
bool hasHostDependence() const
Return true if the action has a host dependence.
static bool classof(const Action *A)
void doOnHostDependence(const OffloadActionWorkTy &Work) const
Execute the work specified in Work on the host dependence.
static bool classof(const Action *A)
static bool classof(const Action *A)
static bool classof(const Action *A)
void registerDependentActionInfo(const ToolChain *TC, StringRef BoundArch, OffloadKind Kind)
Register information about a dependent action.
ArrayRef< DependentActionInfo > getDependentActionsInfo() const
Return the information about all depending actions.
static bool classof(const Action *A)
static bool classof(const Action *A)
static bool classof(const Action *A)
static bool classof(const Action *A)
static bool classof(const Action *A)
static bool classof(const Action *A)
The JSON file list parser is used to communicate input to InstallAPI.
Diagnostic wrappers for TextAPI types for error reporting.
Type that provides information about the actions that depend on this unbundling action.
const OffloadKind DependentOffloadKind
The offload kind of the dependent action.
DependentActionInfo(const ToolChain *DependentToolChain, StringRef DependentBoundArch, const OffloadKind DependentOffloadKind)
StringRef DependentBoundArch
The bound architecture of the dependent action.
const ToolChain * DependentToolChain
The tool chain of the dependent action.