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"
118 bool CanBeCollapsedWithNextDependentAction =
true;
145 : Kind(Kind), Type(Type), Inputs(Inputs) {}
171 CanBeCollapsedWithNextDependentAction =
false;
176 return CanBeCollapsedWithNextDependentAction;
187 StringRef NormalizedTriple,
188 bool CreatePrefixForHost =
false);
235 const llvm::opt::Arg &Input;
237 virtual void anchor();
241 StringRef Id = StringRef());
245 void setId(StringRef _Id) { Id = _Id.str(); }
246 StringRef
getId()
const {
return Id; }
254 virtual void anchor();
274 LLVM_DECLARE_VIRTUAL_ANCHOR_FUNCTION();
311 unsigned OffloadKindMask);
318 return DeviceOffloadKinds;
335 unsigned HostOffloadKinds = 0u;
339 const unsigned OffloadKinds)
340 : HostAction(A), HostToolChain(TC), HostBoundArch(BA),
341 HostOffloadKinds(OffloadKinds) {}
404 virtual void anchor();
418 void anchor()
override;
429 void anchor()
override;
443 void anchor()
override;
456 void anchor()
override;
467 void anchor()
override;
478 void anchor()
override;
489 void anchor()
override;
500 void anchor()
override;
511 void anchor()
override;
522 void anchor()
override;
533 void anchor()
override;
544 void anchor()
override;
556 void anchor()
override;
567 void anchor()
override;
578 void anchor()
override;
590 void anchor()
override;
601 void anchor()
override;
612 void anchor()
override;
623 void anchor()
override;
634 void anchor()
override;
645 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
@ 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(ActionList &Inputs, 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)
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.
Top level wrappers for InstallAPI frontend operations.
Diagnostic wrappers for TextAPI types for error reporting.
Represents a bound architecture for offload / multiple architecture compilation.