10 #ifndef LLVM_CLANG_DRIVER_ACTION_H
11 #define LLVM_CLANG_DRIVER_ACTION_H
16 #include "llvm/ADT/STLExtras.h"
17 #include "llvm/ADT/SmallVector.h"
102 bool CanBeCollapsedWithNextDependentAction =
true;
124 : Kind(Kind), Type(Type), Inputs(Inputs) {}
150 CanBeCollapsedWithNextDependentAction =
false;
154 return CanBeCollapsedWithNextDependentAction;
164 llvm::StringRef NormalizedTriple,
165 bool CreatePrefixForHost =
false);
199 virtual void anchor();
200 const llvm::opt::Arg &Input;
213 virtual void anchor();
232 virtual void anchor();
269 return DeviceOffloadKinds;
281 const char *HostBoundArch =
nullptr;
283 unsigned HostOffloadKinds = 0u;
287 const unsigned OffloadKinds)
288 : HostAction(A), HostToolChain(TC), HostBoundArch(BoundArch),
289 HostOffloadKinds(OffloadKinds){};
300 typedef llvm::function_ref<void(Action *, const ToolChain *, const char *)>
351 virtual void anchor();
364 void anchor()
override;
374 void anchor()
override;
384 void anchor()
override;
394 void anchor()
override;
404 void anchor()
override;
414 void anchor()
override;
424 void anchor()
override;
434 void anchor()
override;
444 void anchor()
override;
454 void anchor()
override;
464 void anchor()
override;
474 void anchor()
override;
483 void anchor()
override;
492 void anchor()
override;
504 void anchor()
override;
519 : DependentToolChain(DependentToolChain),
520 DependentBoundArch(DependentBoundArch),
521 DependentOffloadKind(DependentOffloadKind){};
536 DependentActionInfoArray.push_back({TC, BoundArch, Kind});
541 return DependentActionInfoArray;
const ActionList & getActions() const
Get each of the individual arrays.
AssembleJobAction(Action *Input, types::ID OutputType)
OffloadAction(const HostDependence &HDep)
Type that provides information about the actions that depend on this unbundling action.
PrecompileJobAction(Action *Input, types::ID OutputType)
BackendJobAction(Action *Input, types::ID OutputType)
static bool classof(const Action *A)
Action(ActionClass Kind, Action *Input, types::ID Type)
ArrayRef< DependentActionInfo > getDependentActionsInfo() const
Return the information about all depending actions.
const char * getBoundArch() const
llvm::iterator_range< input_iterator > input_range
MigrateJobAction(Action *Input, types::ID OutputType)
bool hasSingleDeviceDependence(bool DoNotConsiderHostActions=false) const
Return true if the action has a single device dependence.
DependentActionInfo(const ToolChain *DependentToolChain, StringRef DependentBoundArch, const OffloadKind DependentOffloadKind)
The base class of the type hierarchy.
static bool classof(const Action *A)
unsigned getOffloadKinds() const
LinkJobAction(ActionList &Inputs, types::ID Type)
Action(ActionClass Kind, types::ID Type)
Type used to communicate device actions.
llvm::function_ref< void(Action *, const ToolChain *, const char *)> OffloadActionWorkTy
types::ID getType() const
void registerDependentActionInfo(const ToolChain *TC, StringRef BoundArch, OffloadKind Kind)
Register information about a dependent action.
VerifyJobAction(ActionClass Kind, Action *Input, types::ID Type)
StringRef DependentBoundArch
The bound architecture of the dependent action.
VerifyDebugInfoJobAction(Action *Input, types::ID Type)
input_const_iterator input_begin() const
CompileJobAction(Action *Input, types::ID OutputType)
JobAction(ActionClass Kind, Action *Input, types::ID Type)
Action * getAction() const
OffloadKind OffloadingDeviceKind
Offloading kind of the device.
OffloadKind getOffloadingDeviceKind() const
LipoJobAction(ActionList &Inputs, types::ID Type)
static bool classof(const Action *A)
Type used to communicate host actions.
ActionClass getKind() const
unsigned getOffloadingHostActiveKinds() const
Action - Represent an abstract compilation step to perform.
static bool classof(const Action *A)
bool isCollapsingWithNextDependentActionLegal() const
Return true if this function can be collapsed with others.
std::string getOffloadingKindPrefix() const
Return a string containing the offload kind of the action.
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...
static std::string GetOffloadingFileNamePrefix(OffloadKind Kind, llvm::StringRef NormalizedTriple, bool CreatePrefixForHost=false)
Return a string that can be used as prefix in order to generate unique files for each offloading kind...
void doOnHostDependence(const OffloadActionWorkTy &Work) const
Execute the work specified in Work on the host dependence.
static bool classof(const Action *A)
ActionList::size_type size_type
DsymutilJobAction(ActionList &Inputs, types::ID Type)
PreprocessJobAction(Action *Input, types::ID OutputType)
static bool classof(const Action *A)
input_iterator input_begin()
SmallVector< const char *, 3 > BoundArchList
input_iterator input_end()
void propagateDeviceOffloadInfo(OffloadKind OKind, const char *OArch)
Set the device offload info of this action and propagate it to its dependences.
void add(Action &A, const ToolChain &TC, const char *BoundArch, OffloadKind OKind)
Add a action along with the associated toolchain, bound arch, and offload kind.
const ToolChain * DependentToolChain
The tool chain of the dependent action.
SmallVector< const ToolChain *, 3 > ToolChainList
static bool classof(const Action *A)
static bool classof(const Action *A)
unsigned ActiveOffloadKindMask
Offload information.
void doOnEachDeviceDependence(const OffloadActionWorkTy &Work) const
Execute the work specified in Work on each device dependence.
const OffloadKindList & getOffloadKinds() const
static bool classof(const Action *A)
VerifyPCHJobAction(Action *Input, types::ID Type)
static StringRef GetOffloadKindName(OffloadKind Kind)
Return a string containing a offload kind name.
const char * getOffloadingArch() const
static bool classof(const Action *A)
bool isHostOffloading(OffloadKind OKind) const
Check if this action have any offload kinds.
static bool classof(const Action *A)
const ActionList & getInputs() const
void setCannotBeCollapsedWithNextDependentAction()
Mark this action as not legal to collapse.
HostDependence(Action &A, const ToolChain &TC, const char *BoundArch, const unsigned OffloadKinds)
const char * OffloadingArch
The Offloading architecture associated with this action.
BindArchAction(Action *Input, StringRef ArchName)
const ToolChain * getToolChain() const
void doOnEachDependence(const OffloadActionWorkTy &Work) const
Execute the work specified in Work on each dependence.
OffloadUnbundlingJobAction(Action *Input)
static bool classof(const Action *A)
const ToolChainList & getToolChains() const
AnalyzeJobAction(Action *Input, types::ID OutputType)
An offload action combines host or/and device actions according to the programming model implementati...
SmallVector< Action *, 3 > ActionList
ActionList - Type used for lists of actions.
OffloadBundlingJobAction(ActionList &Inputs)
Action * getHostDependence() const
Return the host dependence of this action.
static bool classof(const Action *A)
input_const_range inputs() const
const char * getClassName() const
const BoundArchList & getBoundArchs() const
bool isOffloading(OffloadKind OKind) const
llvm::iterator_range< input_const_iterator > input_const_range
SmallVector< OffloadKind, 3 > OffloadKindList
Action * getSingleDeviceDependence(bool DoNotConsiderHostActions=false) const
Return the single device dependence of this action.
const OffloadKind DependentOffloadKind
The offload kind of the dependent action.
ActionList::const_iterator input_const_iterator
bool hasHostDependence() const
Return true if the action has a host dependence.
ActionList::iterator input_iterator
StringRef getArchName() const
bool isDeviceOffloading(OffloadKind OKind) const
void propagateHostOffloadInfo(unsigned OKinds, const char *OArch)
Append the host offload info of this action and propagate it to its dependences.
static bool classof(const Action *A)
input_const_iterator input_end() 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)