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"
113 bool CanBeCollapsedWithNextDependentAction =
true;
140 : Kind(Kind),
Type(
Type), Inputs(Inputs) {}
166 CanBeCollapsedWithNextDependentAction =
false;
171 return CanBeCollapsedWithNextDependentAction;
182 StringRef NormalizedTriple,
183 bool CreatePrefixForHost =
false);
230 const llvm::opt::Arg &Input;
232 virtual void anchor();
236 StringRef
Id = StringRef());
249 virtual void anchor();
269 virtual void anchor();
307 unsigned OffloadKindMask);
314 return DeviceOffloadKinds;
328 const char *HostBoundArch =
nullptr;
331 unsigned HostOffloadKinds = 0u;
335 const unsigned OffloadKinds)
336 : HostAction(A), HostToolChain(TC), HostBoundArch(BoundArch),
337 HostOffloadKinds(OffloadKinds) {}
400 virtual void anchor();
414 void anchor()
override;
425 void anchor()
override;
439 void anchor()
override;
452 void anchor()
override;
463 void anchor()
override;
474 void anchor()
override;
485 void anchor()
override;
496 void anchor()
override;
507 void anchor()
override;
518 void anchor()
override;
529 void anchor()
override;
540 void anchor()
override;
551 void anchor()
override;
563 void anchor()
override;
574 void anchor()
override;
585 void anchor()
override;
597 void anchor()
override;
632 DependentActionInfoArray.push_back({TC, BoundArch, Kind});
637 return DependentActionInfoArray;
646 void anchor()
override;
657 void anchor()
override;
668 void anchor()
override;
679 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
@ 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)
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.