clang  3.9.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 <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, AnalyzeJobClass, MigrateJobClass, CompileJobClass,
  BackendJobClass, AssembleJobClass, LinkJobClass, LipoJobClass,
  DsymutilJobClass, VerifyDebugInfoJobClass, VerifyPCHJobClass, JobClassFirst = PreprocessJobClass,
  JobClassLast = VerifyPCHJobClass
}
 
enum  OffloadKind { OFK_None = 0x00, OFK_Host = 0x01, OFK_Cuda = 0x02 }
 
typedef ActionList::size_type size_type
 
typedef ActionList::iterator input_iterator
 
typedef ActionList::const_iterator input_const_iterator
 
typedef llvm::iterator_range
< input_iterator
input_range
 
typedef llvm::iterator_range
< input_const_iterator
input_const_range
 

Public Member Functions

virtual ~Action ()
 
const char * getClassName () const
 
ActionClass getKind () const
 
types::ID getType () const
 
ActionListgetInputs ()
 
const ActionListgetInputs () 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
 
std::string getOffloadingKindPrefix () const
 Return a string containing the offload kind of the action. More...
 
std::string getOffloadingFileNamePrefix (llvm::StringRef NormalizedTriple) const
 Return a string that can be used as prefix in order to generate unique files for each offloading kind. 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)
 

Protected Member Functions

 Action (ActionClass Kind, types::ID Type)
 
 Action (ActionClass Kind, Action *Input, types::ID Type)
 
 Type (Type)
 
 Inputs (Inputs)
 

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...
 
 Type
 

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

Member Typedef Documentation

typedef ActionList::const_iterator clang::driver::Action::input_const_iterator

Definition at line 49 of file Action.h.

Definition at line 51 of file Action.h.

typedef ActionList::iterator clang::driver::Action::input_iterator

Definition at line 48 of file Action.h.

typedef llvm::iterator_range<input_iterator> clang::driver::Action::input_range

Definition at line 50 of file Action.h.

typedef ActionList::size_type clang::driver::Action::size_type

Definition at line 47 of file Action.h.

Member Enumeration Documentation

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

Definition at line 53 of file Action.h.

Enumerator
OFK_None 
OFK_Host 
OFK_Cuda 

Definition at line 77 of file Action.h.

Constructor & Destructor Documentation

clang::driver::Action::Action ( ActionClass  Kind,
types::ID  Type 
)
inlineprotected

Definition at line 109 of file Action.h.

clang::driver::Action::Action ( ActionClass  Kind,
Action Input,
types::ID  Type 
)
inlineprotected

Definition at line 110 of file Action.h.

Action::~Action ( )
virtual

Definition at line 19 of file Action.cpp.

Member Function Documentation

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

Definition at line 21 of file Action.cpp.

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

Definition at line 120 of file Action.h.

References getKind().

Referenced by PrintActions1().

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

Definition at line 126 of file Action.h.

ActionClass clang::driver::Action::getKind ( ) const
inline
const char* clang::driver::Action::getOffloadingArch ( ) const
inline
OffloadKind clang::driver::Action::getOffloadingDeviceKind ( ) const
inline

Definition at line 159 of file Action.h.

References OffloadingDeviceKind.

Referenced by propagateOffloadInfo().

std::string Action::getOffloadingFileNamePrefix ( llvm::StringRef  NormalizedTriple) const

Return a string that can be used as prefix in order to generate unique files for each offloading kind.

Definition at line 107 of file Action.cpp.

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

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

Definition at line 156 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 81 of file Action.cpp.

Referenced by PrintActions1().

types::ID clang::driver::Action::getType ( ) const
inline
input_iterator clang::driver::Action::input_begin ( )
inline

Definition at line 130 of file Action.h.

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

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

Definition at line 133 of file Action.h.

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

Definition at line 131 of file Action.h.

Referenced by inputs().

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

Definition at line 134 of file Action.h.

clang::driver::Action::Inputs ( Inputs  )
inlineprotected

Definition at line 115 of file Action.h.

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

Definition at line 132 of file Action.h.

References input_begin(), and input_end().

Referenced by ContainsCompileAction(), and ContainsCompileOrAssembleAction().

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

Definition at line 135 of file Action.h.

References input_begin(), and input_end().

bool clang::driver::Action::isDeviceOffloading ( OffloadKind  OKind) const
inline
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 164 of file Action.h.

References ActiveOffloadKindMask.

Referenced by addExtraOffloadCXXStdlibIncludeArgs(), addExtraOffloadSpecificIncludeArgs(), and isOffloading().

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

Definition at line 170 of file Action.h.

References isDeviceOffloading(), and isHostOffloading().

Referenced by clang::driver::tools::Clang::ConstructJob().

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

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

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

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

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

size_type clang::driver::Action::size ( ) const
inline
clang::driver::Action::Type ( Type  )
protected

Member Data Documentation

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

Referenced by getOffloadingHostActiveKinds(), isHostOffloading(), and clang::driver::OffloadAction::OffloadAction().

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

The Offloading architecture associated with this action.

Definition at line 107 of file Action.h.

Referenced by getOffloadingArch(), and clang::driver::OffloadAction::OffloadAction().

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

Offloading kind of the device.

Definition at line 105 of file Action.h.

Referenced by getOffloadingDeviceKind(), isDeviceOffloading(), and clang::driver::OffloadAction::OffloadAction().

clang::driver::Action::Type
protected
Initial value:
{}
: Action(Kind, ActionList({Input}), Input->getType()) {}
Action(ActionClass Kind, const ActionList &Inputs, types::ID Type)
: Kind(Kind)

Definition at line 111 of file Action.h.


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