clang 8.0.0

Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
clang::driver::OffloadAction Class Referencefinal

An offload action combines host or/and device actions according to the programming model implementation needs and propagates the offloading kind to its dependences. More...

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

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

## Classes
class | DeviceDependences
| Type used to communicate device actions. More...
class | HostDependence
| Type used to communicate host actions. More...

## Public Types
using | OffloadActionWorkTy = llvm::function_ref< void(Action *, const ToolChain *, const char *)>
Public Types inherited from clang::driver::Action
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
| OffloadAction (const HostDependence &HDep)
| OffloadAction (const DeviceDependences &DDeps, types::ID Ty)
| OffloadAction (const HostDependence &HDep, const DeviceDependences &DDeps)
void | doOnHostDependence (const OffloadActionWorkTy &Work) const
| Execute the work specified in Work on the host dependence. More...
void | doOnEachDeviceDependence (const OffloadActionWorkTy &Work) const
| Execute the work specified in Work on each device dependence. More...
void | doOnEachDependence (const OffloadActionWorkTy &Work) const
| Execute the work specified in Work on each dependence. More...
void | doOnEachDependence (bool IsHostDependence, const OffloadActionWorkTy &Work) const
| Execute the work specified in Work on each host or device dependence if IsHostDependenceto is true or false, respectively. More...
bool | hasHostDependence () const
| Return true if the action has a host dependence. More...
Action * | getHostDependence () const
| Return the host dependence of this action. More...
bool | hasSingleDeviceDependence (bool DoNotConsiderHostActions=false) const
| Return true if the action has a single device dependence. More...
Action * | getSingleDeviceDependence (bool DoNotConsiderHostActions=false) const
| Return the single device dependence of this action. More...
Public Member Functions inherited from clang::driver::Action
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 bool | classof (const Action *A)
Static Public Member Functions inherited from clang::driver::Action
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...

## Additional Inherited Members
Protected Member Functions inherited from clang::driver::Action
| 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 inherited from clang::driver::Action
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

An offload action combines host or/and device actions according to the programming model implementation needs and propagates the offloading kind to its dependences.

Definition at line 248 of file Action.h.

## Member Typedef Documentation

## ◆ OffloadActionWorkTy

using clang::driver::OffloadAction::OffloadActionWorkTy = llvm::function_ref<void(Action *, const ToolChain *, const char *)>

Definition at line 325 of file Action.h.

## Constructor & Destructor Documentation

## ◆ OffloadAction() [1/3]

OffloadAction::OffloadAction | ( | const HostDependence & | HDep | ) |

Definition at line 174 of file Action.cpp.

References clang::driver::Action::ActiveOffloadKindMask, clang::driver::OffloadAction::HostDependence::getAction(), clang::driver::OffloadAction::HostDependence::getBoundArch(), clang::driver::OffloadAction::HostDependence::getOffloadKinds(), clang::driver::Action::OffloadingArch, and clang::driver::Action::propagateHostOffloadInfo().

## ◆ OffloadAction() [2/3]

OffloadAction::OffloadAction | ( | const DeviceDependences & | DDeps,
|  | types::ID | Ty
| ) |  |

Definition at line 182 of file Action.cpp.

References clang::driver::OffloadAction::DeviceDependences::getBoundArchs(), clang::driver::Action::getInputs(), clang::driver::OffloadAction::DeviceDependences::getOffloadKinds(), clang::driver::Action::OffloadingArch, clang::driver::Action::OffloadingDeviceKind, and clang::driver::Action::size().

## ◆ OffloadAction() [3/3]

OffloadAction::OffloadAction | ( | const HostDependence & | HDep,
|  | const DeviceDependences & | DDeps
| ) |  |

Definition at line 201 of file Action.cpp.

References clang::driver::Action::ActiveOffloadKindMask, clang::driver::OffloadAction::HostDependence::getAction(), clang::driver::OffloadAction::DeviceDependences::getActions(), clang::driver::OffloadAction::HostDependence::getBoundArch(), clang::driver::OffloadAction::DeviceDependences::getBoundArchs(), clang::driver::Action::getInputs(), clang::driver::OffloadAction::DeviceDependences::getOffloadKinds(), clang::driver::OffloadAction::HostDependence::getOffloadKinds(), clang::driver::Action::OffloadingArch, and clang::driver::Action::propagateHostOffloadInfo().

## Member Function Documentation

## ◆ classof()

static bool clang::driver::OffloadAction::classof | ( | const Action * | A | ) |
| inline static

Definition at line 371 of file Action.h.

References clang::driver::Action::getKind().

## ◆ doOnEachDependence() [1/2]

void OffloadAction::doOnEachDependence | ( | const OffloadActionWorkTy & | Work | ) | const

Execute the work specified in Work on each dependence.

Definition at line 251 of file Action.cpp.

References doOnEachDeviceDependence(), and doOnHostDependence().

## ◆ doOnEachDependence() [2/2]

void OffloadAction::doOnEachDependence | ( | bool | IsHostDependence,
|  | const OffloadActionWorkTy & | Work
| ) |  | const

Execute the work specified in Work on each host or device dependence if IsHostDependenceto is true or false, respectively.

Definition at line 256 of file Action.cpp.

References doOnEachDeviceDependence(), and doOnHostDependence().

## ◆ doOnEachDeviceDependence()

void OffloadAction::doOnEachDeviceDependence | ( | const OffloadActionWorkTy & | Work | ) | const

Execute the work specified in Work on each device dependence.

Definition at line 229 of file Action.cpp.

References clang::driver::Action::getInputs(), and clang::driver::Action::size().

Referenced by doOnEachDependence().

## ◆ doOnHostDependence()

void OffloadAction::doOnHostDependence | ( | const OffloadActionWorkTy & | Work | ) | const

Execute the work specified in Work on the host dependence.

Definition at line 221 of file Action.cpp.

References clang::driver::Action::getInputs().

Referenced by doOnEachDependence().

## ◆ getHostDependence()

Action * OffloadAction::getHostDependence | ( |  | ) | const

Return the host dependence of this action.

This function is only expected to be called if the host dependence exists.

Definition at line 266 of file Action.cpp.

References clang::driver::Action::getInputs(), and hasHostDependence().

## ◆ getSingleDeviceDependence()

Action * OffloadAction::getSingleDeviceDependence | ( | bool | DoNotConsiderHostActions = `false` | ) | const

Return the single device dependence of this action.

This function is only expected to be called if a single device dependence exists. If DoNotConsiderHostActions is set, a host dependence is allowed.

Definition at line 280 of file Action.cpp.

References clang::driver::Action::getInputs(), and hasSingleDeviceDependence().

## ◆ hasHostDependence()

bool OffloadAction::hasHostDependence | ( |  | ) | const

Return true if the action has a host dependence.

Definition at line 264 of file Action.cpp.

Referenced by getHostDependence().

## ◆ hasSingleDeviceDependence()

bool OffloadAction::hasSingleDeviceDependence | ( | bool | DoNotConsiderHostActions = `false` | ) | const

Return true if the action has a single device dependence.

If DoNotConsiderHostActions is set, ignore the host dependence, if any, while accounting for the number of dependences.

Definition at line 272 of file Action.cpp.

References clang::driver::Action::getInputs().

Referenced by getSingleDeviceDependence().

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

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