9#ifndef LLVM_CLANG_DRIVER_ACTION_H
10#define LLVM_CLANG_DRIVER_ACTION_H
16#include "llvm/ADT/ArrayRef.h"
17#include "llvm/ADT/STLExtras.h"
18#include "llvm/ADT/SmallVector.h"
19#include "llvm/ADT/StringRef.h"
20#include "llvm/ADT/iterator_range.h"
119 bool CanBeCollapsedWithNextDependentAction =
true;
146 : Kind(Kind), Type(Type), Inputs(Inputs) {}
172 CanBeCollapsedWithNextDependentAction =
false;
177 return CanBeCollapsedWithNextDependentAction;
188 StringRef NormalizedTriple,
189 bool CreatePrefixForHost =
false);
236 const llvm::opt::Arg &Input;
238 virtual void anchor();
242 StringRef Id = StringRef());
246 void setId(StringRef _Id) { Id = _Id.str(); }
247 StringRef
getId()
const {
return Id; }
255 virtual void anchor();
275 LLVM_DECLARE_VIRTUAL_ANCHOR_FUNCTION();
312 unsigned OffloadKindMask);
319 return DeviceOffloadKinds;
336 unsigned HostOffloadKinds = 0u;
340 const unsigned OffloadKinds)
341 : HostAction(A), HostToolChain(TC), HostBoundArch(BA),
342 HostOffloadKinds(OffloadKinds) {}
405 virtual void anchor();
419 void anchor()
override;
430 void anchor()
override;
444 void anchor()
override;
457 void anchor()
override;
468 void anchor()
override;
479 void anchor()
override;
490 void anchor()
override;
501 void anchor()
override;
512 void anchor()
override;
523 void anchor()
override;
534 void anchor()
override;
545 void anchor()
override;
557 void anchor()
override;
568 void anchor()
override;
579 void anchor()
override;
591 void anchor()
override;
626 DependentActionInfoArray.push_back({TC, BA, Kind});
631 return DependentActionInfoArray;
640 void anchor()
override;
651 void anchor()
override;
662 void anchor()
override;
673 void anchor()
override;
684 void anchor()
override;
695 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.
input_const_iterator input_begin() const
OffloadKind OffloadingDeviceKind
Offloading kind of the device.
Action(ActionClass Kind, types::ID Type)
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
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...
BoundArch getOffloadingArch() const
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 propagateDeviceOffloadInfo(OffloadKind OKind, BoundArch OArch, const ToolChain *OToolChain)
Set the device 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.
void propagateHostOffloadInfo(unsigned OKinds, BoundArch OArch)
Append the host offload info of this action and propagate it to its dependences.
bool isDeviceOffloading(OffloadKind OKind) const
BoundArch OffloadingArch
The Offloading architecture associated with this action.
void setHostOffloadInfo(unsigned OKinds, BoundArch OArch)
ActionList::const_iterator input_const_iterator
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)
AnalyzeJobAction(Action *Input, types::ID OutputType)
AssembleJobAction(Action *Input, types::ID OutputType)
static bool classof(const Action *A)
static bool classof(const Action *A)
BackendJobAction(Action *Input, types::ID OutputType)
static bool classof(const Action *A)
BinaryAnalyzeJobAction(Action *Input, types::ID Type)
BinaryTranslatorJobAction(Action *Input, types::ID Type)
static bool classof(const Action *A)
static bool classof(const Action *A)
BindArchAction(Action *Input, BoundArch ArchName)
BoundArch getArch() const
static bool classof(const Action *A)
CompileJobAction(Action *Input, types::ID OutputType)
DsymutilJobAction(ActionList &Inputs, types::ID Type)
static bool classof(const Action *A)
static bool classof(const Action *A)
IfsMergeJobAction(ActionList &Inputs, types::ID Type)
static bool classof(const Action *A)
JobAction(ActionClass Kind, Action *Input, types::ID Type)
static bool classof(const Action *A)
LinkJobAction(ActionList &Inputs, types::ID Type)
static bool classof(const Action *A)
LinkerWrapperJobAction(ActionList &Inputs, types::ID Type)
static bool classof(const Action *A)
LipoJobAction(ActionList &Inputs, types::ID Type)
static bool classof(const Action *A)
ObjcopyJobAction(Action *Input, types::ID Type)
Type used to communicate device actions.
SmallVector< const ToolChain *, 3 > ToolChainList
SmallVector< BoundArch, 3 > BoundArchList
const BoundArchList & getBoundArchs() const
const OffloadKindList & getOffloadKinds() const
const ActionList & getActions() const
Get each of the individual arrays.
SmallVector< OffloadKind, 3 > OffloadKindList
void add(Action &A, const ToolChain &TC, BoundArch BA, OffloadKind OKind)
Add an action along with the associated toolchain, bound arch, and offload kind.
const ToolChainList & getToolChains() const
Type used to communicate host actions.
Action * getAction() const
BoundArch getBoundArch() const
HostDependence(Action &A, const ToolChain &TC, BoundArch BA, const unsigned OffloadKinds)
const ToolChain * getToolChain() const
unsigned getOffloadKinds() const
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.
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)
llvm::function_ref< void(Action *, const ToolChain *, BoundArch)> OffloadActionWorkTy
void doOnHostDependence(const OffloadActionWorkTy &Work) const
Execute the work specified in Work on the host dependence.
OffloadAction(const HostDependence &HDep)
static bool classof(const Action *A)
OffloadBundlingJobAction(ActionList &Inputs)
OffloadPackagerJobAction(ActionList &Inputs, types::ID Type)
static bool classof(const Action *A)
static bool classof(const Action *A)
OffloadUnbundlingJobAction(Action *Input)
void registerDependentActionInfo(const ToolChain *TC, BoundArch BA, 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)
PrecompileJobAction(ActionClass Kind, Action *Input, types::ID OutputType)
static bool classof(const Action *A)
PreprocessJobAction(Action *Input, types::ID OutputType)
StaticLibJobAction(ActionList &Inputs, types::ID Type)
static bool classof(const Action *A)
VerifyDebugInfoJobAction(Action *Input, types::ID Type)
static bool classof(const Action *A)
VerifyJobAction(ActionClass Kind, Action *Input, types::ID Type)
static bool classof(const Action *A)
static bool classof(const Action *A)
VerifyPCHJobAction(Action *Input, types::ID Type)
SmallVector< Action *, 3 > ActionList
ActionList - Type used for lists of actions.
The JSON file list parser is used to communicate input to InstallAPI.
Diagnostic wrappers for TextAPI types for error reporting.
Represents a bound architecture for offload / multiple architecture compilation.
const OffloadKind DependentOffloadKind
The offload kind of the dependent action.
BoundArch DependentBoundArch
The bound architecture of the dependent action.
DependentActionInfo(const ToolChain *DependentToolChain, BoundArch DependentBoundArch, const OffloadKind DependentOffloadKind)
const ToolChain * DependentToolChain
The tool chain of the dependent action.