clang 8.0.0

Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
clang::driver::Action Class Reference

Action - Represent an abstract compilation step to perform. More...

`#include "clang/Driver/Action.h"`

Inheritance diagram for clang::driver::Action:
[legend]
Collaboration diagram for clang::driver::Action:
[legend]

## Public Types
enum | ActionClass { InputClass = 0, BindArchClass, OffloadClass, PreprocessJobClass, PrecompileJobClass, HeaderModulePrecompileJobClass, AnalyzeJobClass, MigrateJobClass, CompileJobClass, BackendJobClass, AssembleJobClass, LinkJobClass, LipoJobClass, DsymutilJobClass, VerifyDebugInfoJobClass, VerifyPCHJobClass, OffloadBundlingJobClass, OffloadUnbundlingJobClass, JobClassFirst = PreprocessJobClass, JobClassLast = OffloadUnbundlingJobClass }
enum | OffloadKind { OFK_None = 0x00, OFK_Host = 0x01, OFK_Cuda = 0x02, OFK_OpenMP = 0x04, OFK_HIP = 0x08 }
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. More...
bool | isCollapsingWithNextDependentActionLegal () const
| Return true if this function can be collapsed with others. More...
std::string | getOffloadingKindPrefix () const
| Return a string containing the offload kind of the action. More...
void | propagateDeviceOffloadInfo (OffloadKind OKind, const char *OArch)
| Set the device offload info of this action and propagate it to its dependences. More...
void | propagateHostOffloadInfo (unsigned OKinds, const char *OArch)
| Append the host offload info of this action and propagate it to its dependences. More...
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. More...
unsigned | getOffloadingHostActiveKinds () const
OffloadKind | getOffloadingDeviceKind () const
const char * | getOffloadingArch () const
bool | isHostOffloading (OffloadKind OKind) const
| Check if this action have any offload kinds. More...
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. More...
static StringRef | GetOffloadKindName (OffloadKind Kind)
| Return a string containing a offload kind name. More...

## 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. More...
OffloadKind | OffloadingDeviceKind = OFK_None
| Offloading kind of the device. More...
const char * | OffloadingArch = nullptr
| The Offloading architecture associated with this action. More...

## Detailed Description

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().

Definition at line 48 of file Action.h.

## Member Typedef Documentation

## ◆ input_const_iterator

using clang::driver::Action::input_const_iterator = ActionList::const_iterator

Definition at line 52 of file Action.h.

## ◆ input_const_range

using clang::driver::Action::input_const_range = llvm::iterator_range<input_const_iterator>

Definition at line 54 of file Action.h.

## ◆ input_iterator

using clang::driver::Action::input_iterator = ActionList::iterator

Definition at line 51 of file Action.h.

## ◆ input_range

using clang::driver::Action::input_range = llvm::iterator_range<input_iterator>

Definition at line 53 of file Action.h.

## ◆ size_type

using clang::driver::Action::size_type = ActionList::size_type

Definition at line 50 of file Action.h.

## Member Enumeration Documentation

## ◆ ActionClass

enum clang::driver::Action::ActionClass

Enumerator
InputClass |
BindArchClass |
OffloadClass |
PreprocessJobClass |
PrecompileJobClass |
HeaderModulePrecompileJobClass |
AnalyzeJobClass |
MigrateJobClass |
CompileJobClass |
BackendJobClass |
AssembleJobClass |
LinkJobClass |
LipoJobClass |
DsymutilJobClass |
VerifyDebugInfoJobClass |
VerifyPCHJobClass |
OffloadBundlingJobClass |
OffloadUnbundlingJobClass |
JobClassFirst |
JobClassLast |

Definition at line 56 of file Action.h.

## ◆ OffloadKind

enum clang::driver::Action::OffloadKind

Enumerator
OFK_None |
OFK_Host |
OFK_Cuda |
OFK_OpenMP |
OFK_HIP |

Definition at line 83 of file Action.h.

## Constructor & Destructor Documentation

## ◆ Action() [1/4]

clang::driver::Action::Action | ( | ActionClass | Kind,
|  | types::ID | Type
| ) |  |
| inline protected

Definition at line 127 of file Action.h.

## ◆ Action() [2/4]

clang::driver::Action::Action | ( | ActionClass | Kind,
|  | Action * | Input,
|  | types::ID | Type
| ) |  |
| inline protected

Definition at line 128 of file Action.h.

## ◆ Action() [3/4]

clang::driver::Action::Action | ( | ActionClass | Kind,
|  | Action * | Input
| ) |  |
| inline protected

Definition at line 130 of file Action.h.

## ◆ Action() [4/4]

clang::driver::Action::Action | ( | ActionClass | Kind,
|  | const ActionList & | Inputs,
|  | types::ID | Type
| ) |  |
| inline protected

Definition at line 132 of file Action.h.

## ◆ ~Action()

Action::~Action | ( |  | ) |
| virtual default

## Member Function Documentation

## ◆ getClassName() [1/2]

const char * Action::getClassName | ( | ActionClass | AC | ) |
| static

Definition at line 21 of file Action.cpp.

## ◆ getClassName() [2/2]

const char* clang::driver::Action::getClassName | ( |  | ) | const
| inline

Definition at line 138 of file Action.h.

References getKind().

Referenced by PrintActions1().

## ◆ getInputs() [1/2]

ActionList& clang::driver::Action::getInputs | ( |  | ) |
| inline

Definition at line 143 of file Action.h.

Referenced by clang::driver::Driver::BuildInputs(), clang::driver::Driver::BuildJobs(), clang::driver::Driver::BuildJobsForAction(), clang::driver::tools::darwin::Assembler::ConstructJob(), clang::driver::tools::ClangAs::ConstructJob(), clang::driver::tools::OffloadBundler::ConstructJob(), clang::driver::OffloadAction::doOnEachDeviceDependence(), clang::driver::OffloadAction::doOnHostDependence(), clang::driver::OffloadAction::getHostDependence(), clang::driver::OffloadAction::getSingleDeviceDependence(), clang::driver::OffloadAction::hasSingleDeviceDependence(), clang::driver::OffloadAction::OffloadAction(), and PrintActions1().

## ◆ getInputs() [2/2]

const ActionList& clang::driver::Action::getInputs | ( |  | ) | const
| inline

Definition at line 144 of file Action.h.

## ◆ getKind()

ActionClass clang::driver::Action::getKind | ( |  | ) | const
| inline

Definition at line 140 of file Action.h.

Referenced by clang::driver::InputAction::classof(), clang::driver::BindArchAction::classof(), clang::driver::OffloadAction::classof(), clang::driver::JobAction::classof(), clang::driver::PreprocessJobAction::classof(), clang::driver::PrecompileJobAction::classof(), clang::driver::HeaderModulePrecompileJobAction::classof(), clang::driver::AnalyzeJobAction::classof(), clang::driver::MigrateJobAction::classof(), clang::driver::CompileJobAction::classof(), clang::driver::BackendJobAction::classof(), clang::driver::AssembleJobAction::classof(), clang::driver::LinkJobAction::classof(), clang::driver::LipoJobAction::classof(), clang::driver::DsymutilJobAction::classof(), clang::driver::VerifyJobAction::classof(), clang::driver::VerifyDebugInfoJobAction::classof(), clang::driver::VerifyPCHJobAction::classof(), clang::driver::OffloadBundlingJobAction::classof(), clang::driver::OffloadUnbundlingJobAction::classof(), clang::driver::tools::SHAVE::Compiler::ConstructJob(), clang::driver::tools::darwin::Assembler::ConstructJob(), clang::driver::tools::ClangAs::ConstructJob(), clang::tooling::CompilationDatabase::getAllCompileCommands(), PrintActions1(), RelocationModelName(), clang::driver::toolchains::MyriadToolChain::SelectTool(), and clang::driver::ToolChain::SelectTool().

## ◆ getOffloadingArch()

const char* clang::driver::Action::getOffloadingArch | ( |  | ) | const
| inline

Definition at line 198 of file Action.h.

Referenced by clang::driver::tools::AMDGCN::Linker::ConstructJob(), clang::driver::tools::NVPTX::Assembler::ConstructJob(), clang::driver::tools::Clang::ConstructJob(), clang::driver::tools::OffloadBundler::ConstructJob(), and propagateOffloadInfo().

## ◆ getOffloadingDeviceKind()

OffloadKind clang::driver::Action::getOffloadingDeviceKind | ( |  | ) | const
| inline

Definition at line 197 of file Action.h.

Referenced by clang::driver::Driver::BuildJobs(), clang::driver::Driver::BuildJobsForAction(), clang::driver::tools::Clang::ConstructJob(), clang::driver::tools::OffloadBundler::ConstructJob(), and propagateOffloadInfo().

## ◆ GetOffloadingFileNamePrefix()

std::string Action::GetOffloadingFileNamePrefix | ( | OffloadKind | Kind,
|  | StringRef | NormalizedTriple,
|  | bool | CreatePrefixForHost = `false`
| ) |  |
| 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 128 of file Action.cpp.

Referenced by clang::driver::Driver::BuildJobsForAction(), and clang::driver::tools::Clang::ConstructJob().

## ◆ getOffloadingHostActiveKinds()

unsigned clang::driver::Action::getOffloadingHostActiveKinds | ( |  | ) | const
| inline

Definition at line 193 of file Action.h.

Referenced by clang::driver::Driver::BuildJobsForAction(), and propagateOffloadInfo().

## ◆ getOffloadingKindPrefix()

std::string Action::getOffloadingKindPrefix | ( |  | ) | const

Return a string containing the offload kind of the action.

Definition at line 89 of file Action.cpp.

Referenced by PrintActions1().

## ◆ GetOffloadKindName()

StringRef Action::GetOffloadKindName | ( | OffloadKind | Kind | ) |
| 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 144 of file Action.cpp.

Referenced by clang::driver::tools::OffloadBundler::ConstructJob(), clang::driver::tools::OffloadBundler::ConstructJobMultipleOutputs(), and GetTriplePlusArchString().

## ◆ getType()

types::ID clang::driver::Action::getType | ( |  | ) | const
| inline

Definition at line 141 of file Action.h.

Referenced by clang::driver::Driver::BuildInputs(), clang::driver::Driver::BuildJobsForAction(), clang::driver::tools::AMDGCN::Linker::ConstructJob(), clang::driver::tools::darwin::Assembler::ConstructJob(), clang::driver::tools::Clang::ConstructJob(), clang::driver::tools::ClangAs::ConstructJob(), clang::driver::Driver::ConstructPhaseAction(), clang::driver::Driver::GetNamedOutputPath(), and clang::driver::tools::gcc::Compiler::RenderExtraToolArgs().

## ◆ input_begin() [1/2]

input_iterator clang::driver::Action::input_begin | ( |  | ) |
| inline

Definition at line 148 of file Action.h.

Referenced by clang::driver::Driver::ShouldUseClangCompiler().

## ◆ input_begin() [2/2]

input_const_iterator clang::driver::Action::input_begin | ( |  | ) | const
| inline

Definition at line 151 of file Action.h.

## ◆ input_end() [1/2]

input_iterator clang::driver::Action::input_end | ( |  | ) |
| inline

Definition at line 149 of file Action.h.

## ◆ input_end() [2/2]

input_const_iterator clang::driver::Action::input_end | ( |  | ) | const
| inline

Definition at line 152 of file Action.h.

## ◆ inputs() [1/2]

input_range clang::driver::Action::inputs | ( |  | ) |
| inline

Definition at line 150 of file Action.h.

Referenced by ActionFailed(), ContainsCompileAction(), ContainsCompileOrAssembleAction(), and clang::tooling::CompilationDatabase::getAllCompileCommands().

## ◆ inputs() [2/2]

input_const_range clang::driver::Action::inputs | ( |  | ) | const
| inline

Definition at line 153 of file Action.h.

## ◆ isCollapsingWithNextDependentActionLegal()

bool clang::driver::Action::isCollapsingWithNextDependentActionLegal | ( |  | ) | const
| inline

Return true if this function can be collapsed with others.

Definition at line 163 of file Action.h.

Referenced by clang::driver::Driver::BuildJobs().

## ◆ isDeviceOffloading()

bool clang::driver::Action::isDeviceOffloading | ( | OffloadKind | OKind | ) | const
| inline

Definition at line 205 of file Action.h.

Referenced by clang::driver::tools::NVPTX::Assembler::ConstructJob(), clang::driver::tools::Clang::ConstructJob(), and forAllAssociatedToolChains().

## ◆ isHostOffloading()

bool clang::driver::Action::isHostOffloading | ( | OffloadKind | OKind | ) | const
| inline

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 202 of file Action.h.

Referenced by AddLibgcc(), clang::driver::tools::gnutools::Linker::ConstructJob(), clang::driver::tools::Clang::ConstructJob(), clang::driver::tools::NVPTX::OpenMPLinker::ConstructJob(), and forAllAssociatedToolChains().

## ◆ isOffloading()

bool clang::driver::Action::isOffloading | ( | OffloadKind | OKind | ) | const
| inline

Definition at line 208 of file Action.h.

Referenced by ActionFailed(), clang::driver::tools::NVPTX::Assembler::ConstructJob(), clang::driver::tools::Clang::ConstructJob(), and RelocationModelName().

## ◆ propagateDeviceOffloadInfo()

void Action::propagateDeviceOffloadInfo | ( | OffloadKind | OKind,
|  | const char * | OArch
| ) |  |

Set the device offload info of this action and propagate it to its dependences.

Definition at line 49 of file Action.cpp.

## ◆ propagateHostOffloadInfo()

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 67 of file Action.cpp.

Referenced by clang::driver::Driver::BuildInputs(), and clang::driver::OffloadAction::OffloadAction().

## ◆ 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 81 of file Action.cpp.

References getOffloadingArch(), getOffloadingDeviceKind(), and getOffloadingHostActiveKinds().

## ◆ setCannotBeCollapsedWithNextDependentAction()

void clang::driver::Action::setCannotBeCollapsedWithNextDependentAction | ( |  | ) |
| inline

Mark this action as not legal to collapse.

Definition at line 158 of file Action.h.

Referenced by clang::driver::Driver::BuildInputs().

## ◆ size()

size_type clang::driver::Action::size | ( |  | ) | const
| inline

Definition at line 146 of file Action.h.

Referenced by clang::driver::OffloadAction::doOnEachDeviceDependence(), clang::driver::OffloadAction::OffloadAction(), and clang::driver::Driver::ShouldUseClangCompiler().

## Member Data Documentation

## ◆ ActiveOffloadKindMask

unsigned clang::driver::Action::ActiveOffloadKindMask = 0u
| 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 119 of file Action.h.

Referenced by clang::driver::OffloadAction::OffloadAction().

## ◆ OffloadingArch

const char* clang::driver::Action::OffloadingArch = nullptr
| protected

The Offloading architecture associated with this action.

Definition at line 125 of file Action.h.

Referenced by clang::driver::OffloadAction::OffloadAction().

## ◆ OffloadingDeviceKind

OffloadKind clang::driver::Action::OffloadingDeviceKind = OFK_None
| protected

Offloading kind of the device.

Definition at line 122 of file Action.h.

Referenced by clang::driver::OffloadAction::OffloadAction().

The documentation for this class was generated from the following files:

- include/clang/Driver/Action.h
- lib/Driver/Action.cpp