clang 22.0.0git
|
Action - Represent an abstract compilation step to perform. More...
#include "clang/Driver/Action.h"
Public Types | |
enum | ActionClass { InputClass = 0 , BindArchClass , OffloadClass , PreprocessJobClass , PrecompileJobClass , ExtractAPIJobClass , AnalyzeJobClass , CompileJobClass , BackendJobClass , AssembleJobClass , LinkJobClass , IfsMergeJobClass , LipoJobClass , DsymutilJobClass , VerifyDebugInfoJobClass , VerifyPCHJobClass , OffloadBundlingJobClass , OffloadUnbundlingJobClass , OffloadPackagerJobClass , LinkerWrapperJobClass , StaticLibJobClass , BinaryAnalyzeJobClass , BinaryTranslatorJobClass , ObjcopyJobClass , JobClassFirst = PreprocessJobClass , JobClassLast = ObjcopyJobClass } |
enum | OffloadKind { OFK_None = 0x00 , OFK_Host = 0x01 , OFK_Cuda = 0x02 , OFK_OpenMP = 0x04 , OFK_HIP = 0x08 , OFK_SYCL = 0x10 } |
using | size_type = ActionList::size_type |
using | input_iterator = ActionList::iterator |
using | input_const_iterator = ActionList::const_iterator |
using | input_range = llvm::iterator_range<input_iterator> |
using | input_const_range = llvm::iterator_range<input_const_iterator> |
Public Member Functions | |
virtual | ~Action () |
const char * | getClassName () const |
ActionClass | getKind () const |
types::ID | getType () const |
ActionList & | getInputs () |
const ActionList & | getInputs () const |
size_type | size () const |
input_iterator | input_begin () |
input_iterator | input_end () |
input_range | inputs () |
input_const_iterator | input_begin () const |
input_const_iterator | input_end () const |
input_const_range | inputs () const |
void | setCannotBeCollapsedWithNextDependentAction () |
Mark this action as not legal to collapse. | |
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 | propagateDeviceOffloadInfo (OffloadKind OKind, const char *OArch, const ToolChain *OToolChain) |
Set the device offload info of this action and propagate it to its dependences. | |
void | propagateHostOffloadInfo (unsigned OKinds, const char *OArch) |
Append the host offload info of this action and propagate it to its dependences. | |
void | setHostOffloadInfo (unsigned OKinds, const char *OArch) |
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 dependences. | |
unsigned | getOffloadingHostActiveKinds () const |
OffloadKind | getOffloadingDeviceKind () const |
const char * | getOffloadingArch () const |
const ToolChain * | getOffloadingToolChain () const |
bool | isHostOffloading (unsigned int OKind) const |
Check if this action have any offload kinds. | |
bool | isDeviceOffloading (OffloadKind OKind) const |
bool | isOffloading (OffloadKind OKind) const |
Static Public Member Functions | |
static const char * | getClassName (ActionClass AC) |
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. | |
static StringRef | GetOffloadKindName (OffloadKind Kind) |
Return a string containing a offload kind name. |
Protected Member Functions | |
Action (ActionClass Kind, types::ID Type) | |
Action (ActionClass Kind, Action *Input, types::ID Type) | |
Action (ActionClass Kind, Action *Input) | |
Action (ActionClass Kind, const ActionList &Inputs, types::ID Type) |
Protected Attributes | |
unsigned | ActiveOffloadKindMask = 0u |
Offload information. | |
OffloadKind | OffloadingDeviceKind = OFK_None |
Offloading kind of the device. | |
const char * | OffloadingArch = nullptr |
The Offloading architecture associated with this action. | |
const ToolChain * | OffloadingToolChain = nullptr |
The Offloading toolchain associated with this device action. |
Action - Represent an abstract compilation step to perform.
An action represents an edge in the compilation graph; typically it is a job to transform an input using some tool.
The current driver is hard wired to expect actions which produce a single primary output, at least in terms of controlling the compilation. Actions can produce auxiliary files, but can only produce a single output to feed into subsequent actions.
Actions are usually owned by a Compilation, which creates new actions via MakeAction().
using clang::driver::Action::input_const_iterator = ActionList::const_iterator |
using clang::driver::Action::input_const_range = llvm::iterator_range<input_const_iterator> |
using clang::driver::Action::input_iterator = ActionList::iterator |
using clang::driver::Action::input_range = llvm::iterator_range<input_iterator> |
using clang::driver::Action::size_type = ActionList::size_type |
|
inlineprotected |
Definition at line 136 of file Action.h.
References Action().
Referenced by Action(), Action(), Action(), clang::driver::OffloadAction::DeviceDependences::add(), clang::driver::OffloadAction::DeviceDependences::add(), clang::driver::BindArchAction::BindArchAction(), clang::driver::BindArchAction::classof(), clang::driver::InputAction::classof(), clang::driver::JobAction::classof(), clang::driver::OffloadAction::classof(), clang::driver::OffloadAction::HostDependence::getAction(), clang::driver::OffloadAction::getHostDependence(), clang::driver::OffloadAction::HostDependence::HostDependence(), clang::driver::OffloadAction::HostDependence::HostDependence(), clang::driver::InputAction::InputAction(), clang::driver::JobAction::JobAction(), clang::driver::JobAction::JobAction(), clang::driver::OffloadAction::OffloadAction(), clang::driver::OffloadAction::OffloadAction(), clang::driver::OffloadAction::OffloadAction(), and propagateOffloadInfo().
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
virtualdefault |
|
inline |
Definition at line 147 of file Action.h.
References getClassName(), and getKind().
Referenced by getClassName().
|
static |
Definition at line 20 of file Action.cpp.
References AnalyzeJobClass, AssembleJobClass, BackendJobClass, BinaryAnalyzeJobClass, BinaryTranslatorJobClass, BindArchClass, CompileJobClass, DsymutilJobClass, ExtractAPIJobClass, IfsMergeJobClass, InputClass, LinkerWrapperJobClass, LinkJobClass, LipoJobClass, ObjcopyJobClass, OffloadBundlingJobClass, OffloadClass, OffloadPackagerJobClass, OffloadUnbundlingJobClass, PrecompileJobClass, PreprocessJobClass, StaticLibJobClass, VerifyDebugInfoJobClass, and VerifyPCHJobClass.
|
inline |
Definition at line 152 of file Action.h.
Referenced by clang::driver::ExtractAPIJobAction::addHeaderInput(), clang::driver::Driver::BuildJobs(), clang::driver::Driver::BuildOffloadingActions(), clang::driver::tools::Clang::ConstructJob(), clang::driver::tools::darwin::Assembler::ConstructJob(), clang::driver::tools::OffloadBundler::ConstructJob(), clang::driver::OffloadAction::doOnEachDeviceDependence(), clang::driver::OffloadAction::doOnHostDependence(), clang::driver::OffloadAction::getHostDependence(), clang::driver::OffloadAction::getSingleDeviceDependence(), HasPreprocessOutput(), clang::driver::OffloadAction::hasSingleDeviceDependence(), and clang::driver::OffloadAction::OffloadAction().
|
inline |
|
inline |
Definition at line 149 of file Action.h.
Referenced by clang::driver::Driver::BuildInputs(), clang::driver::Driver::BuildJobs(), clang::driver::AnalyzeJobAction::classof(), clang::driver::AssembleJobAction::classof(), clang::driver::BackendJobAction::classof(), clang::driver::BinaryAnalyzeJobAction::classof(), clang::driver::BinaryTranslatorJobAction::classof(), clang::driver::BindArchAction::classof(), clang::driver::CompileJobAction::classof(), clang::driver::DsymutilJobAction::classof(), clang::driver::ExtractAPIJobAction::classof(), clang::driver::IfsMergeJobAction::classof(), clang::driver::InputAction::classof(), clang::driver::JobAction::classof(), clang::driver::LinkerWrapperJobAction::classof(), clang::driver::LinkJobAction::classof(), clang::driver::LipoJobAction::classof(), clang::driver::ObjcopyJobAction::classof(), clang::driver::OffloadAction::classof(), clang::driver::OffloadBundlingJobAction::classof(), clang::driver::OffloadPackagerJobAction::classof(), clang::driver::OffloadUnbundlingJobAction::classof(), clang::driver::PrecompileJobAction::classof(), clang::driver::PreprocessJobAction::classof(), clang::driver::StaticLibJobAction::classof(), clang::driver::VerifyDebugInfoJobAction::classof(), clang::driver::VerifyJobAction::classof(), clang::driver::VerifyPCHJobAction::classof(), clang::driver::tools::Clang::ConstructJob(), clang::driver::tools::darwin::Assembler::ConstructJob(), getClassName(), clang::driver::Driver::GetNamedOutputPath(), clang::driver::ToolChain::SelectTool(), and clang::driver::toolchains::SPIRVToolChain::SelectTool().
|
inline |
Definition at line 213 of file Action.h.
References OffloadingArch.
Referenced by clang::driver::tools::NVPTX::Assembler::ConstructJob(), clang::driver::tools::OffloadBundler::ConstructJob(), clang::driver::tools::OffloadPackager::ConstructJob(), clang::driver::toolchains::AMDGPUToolChain::getDefaultDenormalModeForType(), propagateOffloadInfo(), and renderRemarksOptions().
|
inline |
Definition at line 212 of file Action.h.
References OffloadingDeviceKind.
Referenced by clang::driver::tools::Clang::ConstructJob(), clang::driver::tools::OffloadBundler::ConstructJob(), clang::driver::tools::OffloadPackager::ConstructJob(), clang::driver::toolchains::AMDGPUToolChain::getDefaultDenormalModeForType(), clang::driver::toolchains::CudaToolChain::getDefaultDenormalModeForType(), clang::driver::Driver::GetNamedOutputPath(), GetSDLFromOffloadArchive(), propagateOffloadInfo(), and renderRemarksOptions().
|
static |
Return a string that can be used as prefix in order to generate unique files for each offloading kind.
By default, no prefix is used for non-device kinds, except if CreatePrefixForHost is set.
Definition at line 148 of file Action.cpp.
References GetOffloadKindName(), OFK_Host, and OFK_None.
Referenced by renderRemarksOptions().
|
inline |
Definition at line 208 of file Action.h.
References ActiveOffloadKindMask.
Referenced by propagateOffloadInfo().
std::string Action::getOffloadingKindPrefix | ( | ) | const |
Return a string containing the offload kind of the action.
Definition at line 105 of file Action.cpp.
References ActiveOffloadKindMask, OffloadingDeviceKind, OFK_Cuda, OFK_HIP, OFK_Host, OFK_None, OFK_OpenMP, and OFK_SYCL.
|
inline |
Definition at line 214 of file Action.h.
References OffloadingToolChain.
Referenced by clang::driver::Driver::BuildOffloadingActions(), clang::driver::tools::OffloadPackager::ConstructJob(), clang::driver::Driver::ConstructPhaseAction(), clang::driver::Driver::GetNamedOutputPath(), and propagateOffloadInfo().
|
static |
Return a string containing a offload kind name.
Return a string with the offload kind name.
If that is not defined, we assume 'host'.
Definition at line 164 of file Action.cpp.
References OFK_Cuda, OFK_HIP, OFK_Host, OFK_None, OFK_OpenMP, and OFK_SYCL.
Referenced by clang::driver::tools::OffloadBundler::ConstructJob(), clang::driver::tools::OffloadPackager::ConstructJob(), clang::driver::tools::OffloadBundler::ConstructJobMultipleOutputs(), clang::driver::Driver::CreateOffloadingDeviceToolChains(), GetOffloadingFileNamePrefix(), GetSDLFromOffloadArchive(), getSystemOffloadArchs(), and GetTriplePlusArchString().
|
inline |
Definition at line 150 of file Action.h.
Referenced by clang::driver::Driver::BuildJobs(), clang::driver::Driver::BuildOffloadingActions(), clang::driver::tools::AMDGCN::Linker::ConstructJob(), clang::driver::tools::Clang::ConstructJob(), clang::driver::tools::ClangAs::ConstructJob(), clang::driver::tools::darwin::Assembler::ConstructJob(), clang::driver::tools::Flang::ConstructJob(), clang::driver::tools::HIPSPV::Linker::ConstructJob(), clang::driver::tools::LinkerWrapper::ConstructJob(), clang::driver::Driver::ConstructPhaseAction(), GetModuleOutputPath(), clang::driver::Driver::GetNamedOutputPath(), clang::driver::OffloadBundlingJobAction::OffloadBundlingJobAction(), clang::driver::OffloadUnbundlingJobAction::OffloadUnbundlingJobAction(), and clang::driver::tools::gcc::Compiler::RenderExtraToolArgs().
|
inline |
Definition at line 157 of file Action.h.
Referenced by inputs(), inputs(), clang::driver::Driver::ShouldUseClangCompiler(), and clang::driver::Driver::ShouldUseFlangCompiler().
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 159 of file Action.h.
References input_begin(), and input_end().
Referenced by ActionFailed(), and ContainsCompileOrAssembleAction().
|
inline |
Definition at line 162 of file Action.h.
References input_begin(), and input_end().
|
inline |
|
inline |
Definition at line 223 of file Action.h.
References OffloadingDeviceKind.
Referenced by clang::driver::tools::Clang::ConstructJob(), clang::driver::tools::Flang::ConstructJob(), clang::driver::tools::NVPTX::Assembler::ConstructJob(), forAllAssociatedToolChains(), isOffloading(), RenderFloatingPointOptions(), renderRemarksOptions(), and ShouldEnableAutolink().
Check if this action have any offload kinds.
Note that host offload kinds are only set if the action is a dependence to a host offload action.
Definition at line 220 of file Action.h.
References ActiveOffloadKindMask.
Referenced by clang::driver::tools::addOpenMPHostOffloadingArgs(), clang::driver::tools::Clang::ConstructJob(), clang::driver::tools::gnutools::Linker::ConstructJob(), forAllAssociatedToolChains(), and isOffloading().
|
inline |
Definition at line 226 of file Action.h.
References isDeviceOffloading(), and isHostOffloading().
Referenced by ActionFailed(), clang::driver::tools::Clang::ConstructJob(), clang::driver::tools::NVPTX::Assembler::ConstructJob(), and RenderFloatingPointOptions().
void Action::propagateDeviceOffloadInfo | ( | OffloadKind | OKind, |
const char * | OArch, | ||
const ToolChain * | OToolChain ) |
Set the device offload info of this action and propagate it to its dependences.
Definition at line 62 of file Action.cpp.
References ActiveOffloadKindMask, OffloadClass, OffloadingArch, OffloadingDeviceKind, OffloadingToolChain, OffloadUnbundlingJobClass, and OFK_None.
Referenced by clang::driver::Driver::BuildOffloadingActions(), and propagateOffloadInfo().
void Action::propagateHostOffloadInfo | ( | unsigned | OKinds, |
const char * | OArch ) |
Append the host offload info of this action and propagate it to its dependences.
Definition at line 82 of file Action.cpp.
References ActiveOffloadKindMask, OffloadClass, OffloadingArch, OffloadingDeviceKind, and OFK_None.
Referenced by clang::driver::Driver::BuildOffloadingActions(), clang::driver::OffloadAction::OffloadAction(), clang::driver::OffloadAction::OffloadAction(), and propagateOffloadInfo().
void Action::propagateOffloadInfo | ( | const Action * | A | ) |
Set the offload info of this action to be the same as the provided action, and propagate it to its dependences.
Definition at line 96 of file Action.cpp.
References Action(), getOffloadingArch(), getOffloadingDeviceKind(), getOffloadingHostActiveKinds(), getOffloadingToolChain(), propagateDeviceOffloadInfo(), and propagateHostOffloadInfo().
|
inline |
Mark this action as not legal to collapse.
Definition at line 167 of file Action.h.
Referenced by clang::driver::Driver::BuildOffloadingActions().
|
inline |
Definition at line 199 of file Action.h.
References ActiveOffloadKindMask, and OffloadingArch.
|
inline |
|
protected |
Offload information.
The host offloading kind - a combination of kinds encoded in a mask. Multiple programming models may be supported simultaneously by the same host.
Definition at line 125 of file Action.h.
Referenced by getOffloadingHostActiveKinds(), getOffloadingKindPrefix(), isHostOffloading(), clang::driver::OffloadAction::OffloadAction(), clang::driver::OffloadAction::OffloadAction(), propagateDeviceOffloadInfo(), propagateHostOffloadInfo(), and setHostOffloadInfo().
|
protected |
The Offloading architecture associated with this action.
Definition at line 131 of file Action.h.
Referenced by getOffloadingArch(), clang::driver::OffloadAction::OffloadAction(), clang::driver::OffloadAction::OffloadAction(), clang::driver::OffloadAction::OffloadAction(), propagateDeviceOffloadInfo(), propagateHostOffloadInfo(), and setHostOffloadInfo().
|
protected |
Offloading kind of the device.
Definition at line 128 of file Action.h.
Referenced by getOffloadingDeviceKind(), getOffloadingKindPrefix(), isDeviceOffloading(), clang::driver::OffloadAction::OffloadAction(), propagateDeviceOffloadInfo(), and propagateHostOffloadInfo().
The Offloading toolchain associated with this device action.
Definition at line 134 of file Action.h.
Referenced by getOffloadingToolChain(), and propagateDeviceOffloadInfo().