clang
15.0.0git
|
#include "/home/buildbot/as-worker-4/publish-doxygen-docs/llvm-project/clang/lib/CodeGen/CGOpenMPRuntime.h"
Classes | |
class | DisableAutoDeclareTargetRAII |
Allows to disable automatic handling of functions used in target regions as those marked as omp declare target . More... | |
struct | DispatchRTInput |
struct with the values to be passed to the dispatch runtime function More... | |
struct | LastprivateConditionalData |
Maps the expression for the lastprivate variable to the global copy used to store new value because original variables are not mapped in inner parallel regions. More... | |
class | LastprivateConditionalRAII |
Manages list of lastprivate conditional decls for the specified directive. More... | |
class | NontemporalDeclsRAII |
Manages list of nontemporal decls for the specified directive. More... | |
struct | ReductionOptionsTy |
struct | StaticRTInput |
Struct with the values to be passed to the static runtime function. More... | |
class | TargetDataInfo |
Struct that keeps all the relevant information that should be kept throughout a 'target data' region. More... | |
class | UntiedTaskLocalDeclsRAII |
Manages list of nontemporal decls for the specified directive. More... | |
Public Member Functions | |
llvm::OpenMPIRBuilder & | getOMPBuilder () |
CGOpenMPRuntime (CodeGenModule &CGM) | |
virtual | ~CGOpenMPRuntime () |
virtual void | clear () |
void | emitIfClause (CodeGenFunction &CGF, const Expr *Cond, const RegionCodeGenTy &ThenGen, const RegionCodeGenTy &ElseGen) |
Emits code for OpenMP 'if' clause using specified CodeGen function. More... | |
std::string | getName (ArrayRef< StringRef > Parts) const |
Get the platform-specific name separator. More... | |
virtual void | emitUserDefinedReduction (CodeGenFunction *CGF, const OMPDeclareReductionDecl *D) |
Emit code for the specified user defined reduction construct. More... | |
virtual std::pair< llvm::Function *, llvm::Function * > | getUserDefinedReduction (const OMPDeclareReductionDecl *D) |
Get combiner/initializer for the specified user-defined reduction, if any. More... | |
void | emitUserDefinedMapper (const OMPDeclareMapperDecl *D, CodeGenFunction *CGF=nullptr) |
Emit the function for the user defined mapper construct. More... | |
llvm::Function * | getOrCreateUserDefinedMapperFunc (const OMPDeclareMapperDecl *D) |
Get the function for the specified user-defined mapper. More... | |
virtual llvm::Function * | emitParallelOutlinedFunction (const OMPExecutableDirective &D, const VarDecl *ThreadIDVar, OpenMPDirectiveKind InnermostKind, const RegionCodeGenTy &CodeGen) |
Emits outlined function for the specified OpenMP parallel directive D. More... | |
virtual llvm::Function * | emitTeamsOutlinedFunction (const OMPExecutableDirective &D, const VarDecl *ThreadIDVar, OpenMPDirectiveKind InnermostKind, const RegionCodeGenTy &CodeGen) |
Emits outlined function for the specified OpenMP teams directive D. More... | |
virtual llvm::Function * | emitTaskOutlinedFunction (const OMPExecutableDirective &D, const VarDecl *ThreadIDVar, const VarDecl *PartIDVar, const VarDecl *TaskTVar, OpenMPDirectiveKind InnermostKind, const RegionCodeGenTy &CodeGen, bool Tied, unsigned &NumberOfParts) |
Emits outlined function for the OpenMP task directive D. More... | |
virtual void | functionFinished (CodeGenFunction &CGF) |
Cleans up references to the objects in finished function. More... | |
virtual void | emitParallelCall (CodeGenFunction &CGF, SourceLocation Loc, llvm::Function *OutlinedFn, ArrayRef< llvm::Value * > CapturedVars, const Expr *IfCond, llvm::Value *NumThreads) |
Emits code for parallel or serial call of the OutlinedFn with variables captured in a record which address is stored in CapturedStruct. More... | |
virtual void | emitCriticalRegion (CodeGenFunction &CGF, StringRef CriticalName, const RegionCodeGenTy &CriticalOpGen, SourceLocation Loc, const Expr *Hint=nullptr) |
Emits a critical region. More... | |
virtual void | emitMasterRegion (CodeGenFunction &CGF, const RegionCodeGenTy &MasterOpGen, SourceLocation Loc) |
Emits a master region. More... | |
virtual void | emitMaskedRegion (CodeGenFunction &CGF, const RegionCodeGenTy &MaskedOpGen, SourceLocation Loc, const Expr *Filter=nullptr) |
Emits a masked region. More... | |
virtual void | emitTaskyieldCall (CodeGenFunction &CGF, SourceLocation Loc) |
Emits code for a taskyield directive. More... | |
virtual void | emitTaskgroupRegion (CodeGenFunction &CGF, const RegionCodeGenTy &TaskgroupOpGen, SourceLocation Loc) |
Emit a taskgroup region. More... | |
virtual void | emitSingleRegion (CodeGenFunction &CGF, const RegionCodeGenTy &SingleOpGen, SourceLocation Loc, ArrayRef< const Expr * > CopyprivateVars, ArrayRef< const Expr * > DestExprs, ArrayRef< const Expr * > SrcExprs, ArrayRef< const Expr * > AssignmentOps) |
Emits a single region. More... | |
virtual void | emitOrderedRegion (CodeGenFunction &CGF, const RegionCodeGenTy &OrderedOpGen, SourceLocation Loc, bool IsThreads) |
Emit an ordered region. More... | |
virtual void | emitBarrierCall (CodeGenFunction &CGF, SourceLocation Loc, OpenMPDirectiveKind Kind, bool EmitChecks=true, bool ForceSimpleCall=false) |
Emit an implicit/explicit barrier for OpenMP threads. More... | |
virtual bool | isStaticNonchunked (OpenMPScheduleClauseKind ScheduleKind, bool Chunked) const |
Check if the specified ScheduleKind is static non-chunked. More... | |
virtual bool | isStaticNonchunked (OpenMPDistScheduleClauseKind ScheduleKind, bool Chunked) const |
Check if the specified ScheduleKind is static non-chunked. More... | |
virtual bool | isStaticChunked (OpenMPScheduleClauseKind ScheduleKind, bool Chunked) const |
Check if the specified ScheduleKind is static chunked. More... | |
virtual bool | isStaticChunked (OpenMPDistScheduleClauseKind ScheduleKind, bool Chunked) const |
Check if the specified ScheduleKind is static non-chunked. More... | |
virtual bool | isDynamic (OpenMPScheduleClauseKind ScheduleKind) const |
Check if the specified ScheduleKind is dynamic. More... | |
virtual void | emitForDispatchInit (CodeGenFunction &CGF, SourceLocation Loc, const OpenMPScheduleTy &ScheduleKind, unsigned IVSize, bool IVSigned, bool Ordered, const DispatchRTInput &DispatchValues) |
Call the appropriate runtime routine to initialize it before start of loop. More... | |
virtual void | emitForStaticInit (CodeGenFunction &CGF, SourceLocation Loc, OpenMPDirectiveKind DKind, const OpenMPScheduleTy &ScheduleKind, const StaticRTInput &Values) |
Call the appropriate runtime routine to initialize it before start of loop. More... | |
virtual void | emitDistributeStaticInit (CodeGenFunction &CGF, SourceLocation Loc, OpenMPDistScheduleClauseKind SchedKind, const StaticRTInput &Values) |
virtual void | emitForOrderedIterationEnd (CodeGenFunction &CGF, SourceLocation Loc, unsigned IVSize, bool IVSigned) |
Call the appropriate runtime routine to notify that we finished iteration of the ordered loop with the dynamic scheduling. More... | |
virtual void | emitForStaticFinish (CodeGenFunction &CGF, SourceLocation Loc, OpenMPDirectiveKind DKind) |
Call the appropriate runtime routine to notify that we finished all the work with current loop. More... | |
virtual llvm::Value * | emitForNext (CodeGenFunction &CGF, SourceLocation Loc, unsigned IVSize, bool IVSigned, Address IL, Address LB, Address UB, Address ST) |
Call __kmpc_dispatch_next( ident_t *loc, kmp_int32 tid, kmp_int32 *p_lastiter, kmp_int[32|64] *p_lower, kmp_int[32|64] *p_upper, kmp_int[32|64] *p_stride);. More... | |
virtual void | emitNumThreadsClause (CodeGenFunction &CGF, llvm::Value *NumThreads, SourceLocation Loc) |
Emits call to void __kmpc_push_num_threads(ident_t *loc, kmp_int32 global_tid, kmp_int32 num_threads) to generate code for 'num_threads' clause. More... | |
virtual void | emitProcBindClause (CodeGenFunction &CGF, llvm::omp::ProcBindKind ProcBind, SourceLocation Loc) |
Emit call to void __kmpc_push_proc_bind(ident_t *loc, kmp_int32 global_tid, int proc_bind) to generate code for 'proc_bind' clause. More... | |
virtual Address | getAddrOfThreadPrivate (CodeGenFunction &CGF, const VarDecl *VD, Address VDAddr, SourceLocation Loc) |
Returns address of the threadprivate variable for the current thread. More... | |
virtual Address | getAddrOfDeclareTargetVar (const VarDecl *VD) |
Returns the address of the variable marked as declare target with link clause OR as declare target with to clause and unified memory. More... | |
virtual llvm::Function * | emitThreadPrivateVarDefinition (const VarDecl *VD, Address VDAddr, SourceLocation Loc, bool PerformInit, CodeGenFunction *CGF=nullptr) |
Emit a code for initialization of threadprivate variable. More... | |
virtual bool | emitDeclareTargetVarDefinition (const VarDecl *VD, llvm::GlobalVariable *Addr, bool PerformInit) |
Emit a code for initialization of declare target variable. More... | |
virtual Address | getAddrOfArtificialThreadPrivate (CodeGenFunction &CGF, QualType VarType, StringRef Name) |
Creates artificial threadprivate variable with name Name and type VarType . More... | |
virtual void | emitFlush (CodeGenFunction &CGF, ArrayRef< const Expr * > Vars, SourceLocation Loc, llvm::AtomicOrdering AO) |
Emit flush of the variables specified in 'omp flush' directive. More... | |
virtual void | emitTaskCall (CodeGenFunction &CGF, SourceLocation Loc, const OMPExecutableDirective &D, llvm::Function *TaskFunction, QualType SharedsTy, Address Shareds, const Expr *IfCond, const OMPTaskDataTy &Data) |
Emit task region for the task directive. More... | |
virtual void | emitTaskLoopCall (CodeGenFunction &CGF, SourceLocation Loc, const OMPLoopDirective &D, llvm::Function *TaskFunction, QualType SharedsTy, Address Shareds, const Expr *IfCond, const OMPTaskDataTy &Data) |
Emit task region for the taskloop directive. More... | |
virtual void | emitInlinedDirective (CodeGenFunction &CGF, OpenMPDirectiveKind InnermostKind, const RegionCodeGenTy &CodeGen, bool HasCancel=false) |
Emit code for the directive that does not require outlining. More... | |
llvm::Function * | emitReductionFunction (SourceLocation Loc, llvm::Type *ArgsElemType, ArrayRef< const Expr * > Privates, ArrayRef< const Expr * > LHSExprs, ArrayRef< const Expr * > RHSExprs, ArrayRef< const Expr * > ReductionOps) |
Emits reduction function. More... | |
void | emitSingleReductionCombiner (CodeGenFunction &CGF, const Expr *ReductionOp, const Expr *PrivateRef, const DeclRefExpr *LHS, const DeclRefExpr *RHS) |
Emits single reduction combiner. More... | |
virtual void | emitReduction (CodeGenFunction &CGF, SourceLocation Loc, ArrayRef< const Expr * > Privates, ArrayRef< const Expr * > LHSExprs, ArrayRef< const Expr * > RHSExprs, ArrayRef< const Expr * > ReductionOps, ReductionOptionsTy Options) |
Emit a code for reduction clause. More... | |
virtual llvm::Value * | emitTaskReductionInit (CodeGenFunction &CGF, SourceLocation Loc, ArrayRef< const Expr * > LHSExprs, ArrayRef< const Expr * > RHSExprs, const OMPTaskDataTy &Data) |
Emit a code for initialization of task reduction clause. More... | |
virtual void | emitTaskReductionFini (CodeGenFunction &CGF, SourceLocation Loc, bool IsWorksharingReduction) |
Emits the following code for reduction clause with task modifier: More... | |
virtual void | emitTaskReductionFixups (CodeGenFunction &CGF, SourceLocation Loc, ReductionCodeGen &RCG, unsigned N) |
Required to resolve existing problems in the runtime. More... | |
virtual Address | getTaskReductionItem (CodeGenFunction &CGF, SourceLocation Loc, llvm::Value *ReductionsPtr, LValue SharedLVal) |
Get the address of void * type of the privatue copy of the reduction item specified by the SharedLVal . More... | |
virtual void | emitTaskwaitCall (CodeGenFunction &CGF, SourceLocation Loc, const OMPTaskDataTy &Data) |
Emit code for 'taskwait' directive. More... | |
virtual void | emitCancellationPointCall (CodeGenFunction &CGF, SourceLocation Loc, OpenMPDirectiveKind CancelRegion) |
Emit code for 'cancellation point' construct. More... | |
virtual void | emitCancelCall (CodeGenFunction &CGF, SourceLocation Loc, const Expr *IfCond, OpenMPDirectiveKind CancelRegion) |
Emit code for 'cancel' construct. More... | |
virtual void | emitTargetOutlinedFunction (const OMPExecutableDirective &D, StringRef ParentName, llvm::Function *&OutlinedFn, llvm::Constant *&OutlinedFnID, bool IsOffloadEntry, const RegionCodeGenTy &CodeGen) |
Emit outilined function for 'target' directive. More... | |
virtual void | emitTargetCall (CodeGenFunction &CGF, const OMPExecutableDirective &D, llvm::Function *OutlinedFn, llvm::Value *OutlinedFnID, const Expr *IfCond, llvm::PointerIntPair< const Expr *, 2, OpenMPDeviceClauseModifier > Device, llvm::function_ref< llvm::Value *(CodeGenFunction &CGF, const OMPLoopDirective &D)> SizeEmitter) |
Emit the target offloading code associated with D. More... | |
virtual bool | emitTargetFunctions (GlobalDecl GD) |
Emit the target regions enclosed in GD function definition or the function itself in case it is a valid device function. More... | |
virtual bool | emitTargetGlobalVariable (GlobalDecl GD) |
Emit the global variable if it is a valid device global variable. More... | |
virtual void | registerTargetGlobalVariable (const VarDecl *VD, llvm::Constant *Addr) |
Checks if the provided global decl GD is a declare target variable and registers it when emitting code for the host. More... | |
virtual bool | emitTargetGlobal (GlobalDecl GD) |
Emit the global GD if it is meaningful for the target. More... | |
llvm::Function * | emitRequiresDirectiveRegFun () |
Creates and returns a registration function for when at least one requires directives was used in the current module. More... | |
void | createOffloadEntriesAndInfoMetadata () |
Creates all the offload entries in the current compilation unit along with the associated metadata. More... | |
virtual void | emitTeamsCall (CodeGenFunction &CGF, const OMPExecutableDirective &D, SourceLocation Loc, llvm::Function *OutlinedFn, ArrayRef< llvm::Value * > CapturedVars) |
Emits code for teams call of the OutlinedFn with variables captured in a record which address is stored in CapturedStruct. More... | |
virtual void | emitNumTeamsClause (CodeGenFunction &CGF, const Expr *NumTeams, const Expr *ThreadLimit, SourceLocation Loc) |
Emits call to void __kmpc_push_num_teams(ident_t *loc, kmp_int32 global_tid, kmp_int32 num_teams, kmp_int32 thread_limit) to generate code for num_teams clause. More... | |
virtual void | emitTargetDataCalls (CodeGenFunction &CGF, const OMPExecutableDirective &D, const Expr *IfCond, const Expr *Device, const RegionCodeGenTy &CodeGen, TargetDataInfo &Info) |
Emit the target data mapping code associated with D. More... | |
virtual void | emitTargetDataStandAloneCall (CodeGenFunction &CGF, const OMPExecutableDirective &D, const Expr *IfCond, const Expr *Device) |
Emit the data mapping/movement code associated with the directive D that should be of the form 'target [{enter|exit} data | update]'. More... | |
virtual void | emitDeclareSimdFunction (const FunctionDecl *FD, llvm::Function *Fn) |
Marks function Fn with properly mangled versions of vector functions. More... | |
virtual void | emitDoacrossInit (CodeGenFunction &CGF, const OMPLoopDirective &D, ArrayRef< Expr * > NumIterations) |
Emit initialization for doacross loop nesting support. More... | |
virtual void | emitDoacrossOrdered (CodeGenFunction &CGF, const OMPDependClause *C) |
Emit code for doacross ordered directive with 'depend' clause. More... | |
virtual const VarDecl * | translateParameter (const FieldDecl *FD, const VarDecl *NativeParam) const |
Translates the native parameter of outlined function if this is required for target. More... | |
virtual Address | getParameterAddress (CodeGenFunction &CGF, const VarDecl *NativeParam, const VarDecl *TargetParam) const |
Gets the address of the native argument basing on the address of the target-specific parameter. More... | |
virtual void | getDefaultDistScheduleAndChunk (CodeGenFunction &CGF, const OMPLoopDirective &S, OpenMPDistScheduleClauseKind &ScheduleKind, llvm::Value *&Chunk) const |
Choose default schedule type and chunk value for the dist_schedule clause. More... | |
virtual void | getDefaultScheduleAndChunk (CodeGenFunction &CGF, const OMPLoopDirective &S, OpenMPScheduleClauseKind &ScheduleKind, const Expr *&ChunkExpr) const |
Choose default schedule type and chunk value for the schedule clause. More... | |
virtual void | emitOutlinedFunctionCall (CodeGenFunction &CGF, SourceLocation Loc, llvm::FunctionCallee OutlinedFn, ArrayRef< llvm::Value * > Args=llvm::None) const |
Emits call of the outlined function with the provided arguments, translating these arguments to correct target-specific arguments. More... | |
virtual void | emitFunctionProlog (CodeGenFunction &CGF, const Decl *D) |
Emits OpenMP-specific function prolog. More... | |
virtual Address | getAddressOfLocalVariable (CodeGenFunction &CGF, const VarDecl *VD) |
Gets the OpenMP-specific address of the local variable. More... | |
bool | markAsGlobalTarget (GlobalDecl GD) |
Marks the declaration as already emitted for the device code and returns true, if it was marked already, and false, otherwise. More... | |
void | emitDeferredTargetDecls () const |
Emit deferred declare target variables marked for deferred emission. More... | |
virtual void | adjustTargetSpecificDataForLambdas (CodeGenFunction &CGF, const OMPExecutableDirective &D) const |
Adjust some parameters for the target-based directives, like addresses of the variables captured by reference in lambdas. More... | |
virtual void | processRequiresDirective (const OMPRequiresDecl *D) |
Perform check on requires decl to ensure that target architecture supports unified addressing. More... | |
llvm::AtomicOrdering | getDefaultMemoryOrdering () const |
Gets default memory ordering as specified in requires directive. More... | |
virtual bool | hasAllocateAttributeForGlobalVar (const VarDecl *VD, LangAS &AS) |
Checks if the variable has associated OMPAllocateDeclAttr attribute with the predefined allocator and translates it into the corresponding address space. More... | |
bool | hasRequiresUnifiedSharedMemory () const |
Return whether the unified_shared_memory has been specified. More... | |
bool | isNontemporalDecl (const ValueDecl *VD) const |
Checks if the VD variable is marked as nontemporal declaration in current context. More... | |
Address | emitLastprivateConditionalInit (CodeGenFunction &CGF, const VarDecl *VD) |
Create specialized alloca to handle lastprivate conditionals. More... | |
virtual void | checkAndEmitLastprivateConditional (CodeGenFunction &CGF, const Expr *LHS) |
Checks if the provided LVal is lastprivate conditional and emits the code to update the value of the original variable. More... | |
virtual void | checkAndEmitSharedLastprivateConditional (CodeGenFunction &CGF, const OMPExecutableDirective &D, const llvm::DenseSet< CanonicalDeclPtr< const VarDecl >> &IgnoredDecls) |
Checks if the lastprivate conditional was updated in inner region and writes the value. More... | |
virtual void | emitLastprivateConditionalFinalUpdate (CodeGenFunction &CGF, LValue PrivLVal, const VarDecl *VD, SourceLocation Loc) |
Gets the address of the global copy used for lastprivate conditional update, if any. More... | |
std::pair< llvm::Value *, Address > | emitDependClause (CodeGenFunction &CGF, ArrayRef< OMPTaskDataTy::DependData > Dependencies, SourceLocation Loc) |
Emits list of dependecies based on the provided data (array of dependence/expression pairs). More... | |
Address | emitDepobjDependClause (CodeGenFunction &CGF, const OMPTaskDataTy::DependData &Dependencies, SourceLocation Loc) |
Emits list of dependecies based on the provided data (array of dependence/expression pairs) for depobj construct. More... | |
void | emitDestroyClause (CodeGenFunction &CGF, LValue DepobjLVal, SourceLocation Loc) |
Emits the code to destroy the dependency object provided in depobj directive. More... | |
void | emitUpdateClause (CodeGenFunction &CGF, LValue DepobjLVal, OpenMPDependClauseKind NewDepKind, SourceLocation Loc) |
Updates the dependency kind in the specified depobj object. More... | |
void | emitUsesAllocatorsInit (CodeGenFunction &CGF, const Expr *Allocator, const Expr *AllocatorTraits) |
Initializes user defined allocators specified in the uses_allocators clauses. More... | |
void | emitUsesAllocatorsFini (CodeGenFunction &CGF, const Expr *Allocator) |
Destroys user defined allocators specified in the uses_allocators clause. More... | |
bool | isLocalVarInUntiedTask (CodeGenFunction &CGF, const VarDecl *VD) const |
Returns true if the variable is a local variable in untied task. More... | |
Static Public Member Functions | |
static const Stmt * | getSingleCompoundChild (ASTContext &Ctx, const Stmt *Body) |
Checks if the Body is the CompoundStmt and returns its child statement iff there is only one that is not evaluatable at the compile time. More... | |
Protected Member Functions | |
CGOpenMPRuntime (CodeGenModule &CGM, StringRef FirstSeparator, StringRef Separator) | |
Constructor allowing to redefine the name separator for the variables. More... | |
virtual void | createOffloadEntry (llvm::Constant *ID, llvm::Constant *Addr, uint64_t Size, int32_t Flags, llvm::GlobalValue::LinkageTypes Linkage) |
Creates offloading entry for the provided entry ID ID, address Addr, size Size, and flags Flags. More... | |
virtual void | emitTargetOutlinedFunctionHelper (const OMPExecutableDirective &D, StringRef ParentName, llvm::Function *&OutlinedFn, llvm::Constant *&OutlinedFnID, bool IsOffloadEntry, const RegionCodeGenTy &CodeGen) |
Helper to emit outlined function for 'target' directive. More... | |
llvm::Value * | emitUpdateLocation (CodeGenFunction &CGF, SourceLocation Loc, unsigned Flags=0) |
Emits object of ident_t type with info for source location. More... | |
const Expr * | getNumTeamsExprForTargetDirective (CodeGenFunction &CGF, const OMPExecutableDirective &D, int32_t &DefaultVal) |
Emit the number of teams for a target directive. More... | |
llvm::Value * | emitNumTeamsForTargetDirective (CodeGenFunction &CGF, const OMPExecutableDirective &D) |
const Expr * | getNumThreadsExprForTargetDirective (CodeGenFunction &CGF, const OMPExecutableDirective &D, int32_t &DefaultVal) |
Emit the number of threads for a target directive. More... | |
llvm::Value * | emitNumThreadsForTargetDirective (CodeGenFunction &CGF, const OMPExecutableDirective &D) |
llvm::Type * | getIdentTyPointerTy () |
Returns pointer to ident_t type. More... | |
llvm::Value * | getThreadID (CodeGenFunction &CGF, SourceLocation Loc) |
Gets thread id value for the current thread. More... | |
virtual StringRef | getOutlinedHelperName () const |
Get the function name of an outlined region. More... | |
void | emitCall (CodeGenFunction &CGF, SourceLocation Loc, llvm::FunctionCallee Callee, ArrayRef< llvm::Value * > Args=llvm::None) const |
Emits Callee function call with arguments Args with location Loc . More... | |
virtual Address | emitThreadIDAddress (CodeGenFunction &CGF, SourceLocation Loc) |
Emits address of the word in a memory where current thread id is stored. More... | |
void | setLocThreadIdInsertPt (CodeGenFunction &CGF, bool AtCurrentPoint=false) |
void | clearLocThreadIdInsertPt (CodeGenFunction &CGF) |
virtual bool | isDefaultLocationConstant () const |
Check if the default location must be constant. More... | |
virtual unsigned | getDefaultLocationReserved2Flags () const |
Returns additional flags that can be stored in reserved_2 field of the default location. More... | |
llvm::ArrayType * | getKmpCriticalNameTy () const |
Get the LLVM type for the critical name. More... | |
llvm::Value * | getCriticalRegionLock (StringRef CriticalName) |
Returns corresponding lock object for the specified critical region name. More... | |
Static Protected Member Functions | |
static unsigned | getDefaultFlagsForBarriers (OpenMPDirectiveKind Kind) |
Returns default flags for the barriers depending on the directive, for which this barier is going to be emitted. More... | |
Protected Attributes | |
CodeGenModule & | CGM |
StringRef | FirstSeparator |
StringRef | Separator |
llvm::OpenMPIRBuilder | OMPBuilder |
An OpenMP-IR-Builder instance. More... | |
Definition at line 228 of file CGOpenMPRuntime.h.
|
explicitprotected |
Constructor allowing to redefine the name separator for the variables.
Definition at line 1060 of file CGOpenMPRuntime.cpp.
References CGM, clang::CodeGen::CodeGenTypeCache::Int32Ty, and OMPBuilder.
|
inlineexplicit |
Definition at line 920 of file CGOpenMPRuntime.h.
|
inlinevirtual |
Definition at line 922 of file CGOpenMPRuntime.h.
|
virtual |
Adjust some parameters for the target-based directives, like addresses of the variables captured by reference in lambdas.
Reimplemented in clang::CodeGen::CGOpenMPRuntimeGPU.
Definition at line 10878 of file CGOpenMPRuntime.cpp.
References clang::OMPExecutableDirective::getDirectiveKind(), and clang::isOpenMPTargetExecutionDirective().
|
virtual |
Checks if the provided LVal
is lastprivate conditional and emits the code to update the value of the original variable.
Definition at line 12707 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::ConvertTypeForMem(), clang::CodeGen::CGBuilderTy::CreatePointerBitCastOrAddrSpaceCast(), clang::CodeGen::CodeGenFunction::CurFn, clang::CodeGen::Decl, clang::CodeGen::CodeGenFunction::EmitAtomicStore(), clang::CodeGen::CodeGenFunction::EmitLValue(), clang::CodeGen::CodeGenFunction::EmitLValueForField(), clang::CodeGen::RValue::get(), clang::CodeGen::LValue::getAddress(), clang::CodeGen::CodeGenFunction::getContext(), clang::Expr::getExprLoc(), clang::CodeGen::CodeGenFunction::getLangOpts(), clang::ASTContext::getPointerType(), clang::ValueDecl::getType(), and clang::CodeGen::CodeGenFunction::MakeAddrLValue().
Referenced by clang::CodeGen::CodeGenFunction::EmitBinaryOperatorLValue(), clang::CodeGen::CodeGenFunction::EmitComplexAssignmentLValue(), clang::CodeGen::CodeGenFunction::EmitComplexPrePostIncDec(), emitOMPAtomicCaptureExpr(), emitOMPAtomicReadExpr(), emitOMPAtomicUpdateExpr(), and emitOMPAtomicWriteExpr().
|
virtual |
Checks if the lastprivate conditional was updated in inner region and writes the value.
Definition at line 12751 of file CGOpenMPRuntime.cpp.
References clang::CapturedStmt::capturesVariable(), clang::CodeGen::CodeGenFunction::CurFn, clang::CodeGen::CGOpenMPRuntime::LastprivateConditionalData::Disabled, clang::CodeGen::CodeGenFunction::EmitLoadOfScalar(), clang::CodeGen::CodeGenFunction::EmitLValueForField(), clang::CodeGen::CodeGenFunction::getLangOpts(), and clang::getOpenMPCaptureRegions().
|
virtual |
Reimplemented in clang::CodeGen::CGOpenMPRuntimeGPU.
Definition at line 1071 of file CGOpenMPRuntime.cpp.
Referenced by clang::CodeGen::CGOpenMPRuntimeGPU::clear().
|
protected |
Definition at line 1348 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenFunction::CurFn.
Referenced by functionFinished().
void CGOpenMPRuntime::createOffloadEntriesAndInfoMetadata | ( | ) |
Creates all the offload entries in the current compilation unit along with the associated metadata.
Definition at line 3097 of file CGOpenMPRuntime.cpp.
References CGM, createOffloadEntry(), clang::DiagnosticsEngine::Error, clang::SourceManager::fileinfo_begin(), clang::SourceManager::fileinfo_end(), clang::CodeGen::CodeGenModule::getContext(), clang::DiagnosticsEngine::getCustomDiagID(), clang::CodeGen::CodeGenModule::getDiags(), clang::CodeGen::CodeGenModule::GetGlobalValue(), clang::CodeGen::CodeGenModule::getLangOpts(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::CodeGenModule::getOpenMPRuntime(), clang::ASTContext::getSourceManager(), hasRequiresUnifiedSharedMemory(), clang::CodeGen::CodeGenTypeCache::Int32Ty, Line, clang::DiagnosticsEngine::Report(), clang::SourceManager::translateFileLineCol(), and V.
|
protectedvirtual |
Creates offloading entry for the provided entry ID ID, address Addr, size Size, and flags Flags.
Definition at line 3091 of file CGOpenMPRuntime.cpp.
References OMPBuilder.
Referenced by createOffloadEntriesAndInfoMetadata().
|
virtual |
Emit an implicit/explicit barrier for OpenMP threads.
Kind | Directive for which this implicit barrier call must be generated. Must be OMPD_barrier for explicit barrier generation. |
EmitChecks | true if need to emit checks for cancellation barriers. |
ForceSimpleCall | true simple barrier call must be emitted, false if runtime class decides which one to emit (simple or with cancellation checks). |
Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime, and clang::CodeGen::CGOpenMPRuntimeGPU.
Definition at line 2536 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::CapturedStmtInfo, clang::CodeGen::CodeGenFunction::CGM, CGM, clang::CodeGen::CodeGenFunction::createBasicBlock(), clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), emitUpdateLocation(), getDefaultFlagsForBarriers(), clang::CodeGen::CodeGenModule::getLangOpts(), clang::CodeGen::CodeGenModule::getModule(), getThreadID(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), and OMPBuilder.
|
protected |
Emits Callee
function call with arguments Args
with location Loc
.
Definition at line 12122 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::ApplyDebugLocation::CreateDefaultArtificial(), clang::CodeGen::CodeGenFunction::EmitNounwindRuntimeCall(), clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), and clang::SourceLocation::isValid().
Referenced by emitOutlinedFunctionCall().
|
virtual |
Emit code for 'cancel' construct.
IfCond | Condition in the associated 'if' clause, if it was specified, nullptr otherwise. |
CancelRegion | Region kind for which the cancel must be emitted. |
Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.
Definition at line 6245 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenFunction::CapturedStmtInfo, CGM, emitUpdateLocation(), getCancellationKind(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::CodeGenModule::getOpenMPRuntime(), getThreadID(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), and OMPBuilder.
|
virtual |
Emit code for 'cancellation point' construct.
CancelRegion | Region kind for which the cancellation point must be emitted. |
Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.
Definition at line 6205 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::CapturedStmtInfo, CGM, clang::CodeGen::CodeGenFunction::createBasicBlock(), clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), emitUpdateLocation(), getCancellationKind(), clang::CodeGen::CodeGenModule::getModule(), getThreadID(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), and OMPBuilder.
|
virtual |
Emits a critical region.
CriticalName | Name of the critical region. |
CriticalOpGen | Generator for the statement associated with the given critical region. |
Hint | Value of the 'hint' clause (optional). |
Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime, and clang::CodeGen::CGOpenMPRuntimeGPU.
Definition at line 2199 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenFunction::Builder, CGM, emitInlinedDirective(), clang::CodeGen::CodeGenFunction::EmitScalarExpr(), emitUpdateLocation(), getCriticalRegionLock(), clang::CodeGen::CodeGenModule::getModule(), getThreadID(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), clang::CodeGen::CodeGenTypeCache::Int32Ty, OMPBuilder, and clang::CodeGen::RegionCodeGenTy::setAction().
Referenced by clang::CodeGen::CGOpenMPRuntimeGPU::emitCriticalRegion().
|
virtual |
Marks function Fn with properly mangled versions of vector functions.
FD | Function marked as 'declare simd'. |
Fn | LLVM function that must be marked with 'declare simd' attributes. |
Definition at line 11840 of file CGOpenMPRuntime.cpp.
References CGM, emitAArch64DeclareSimdFunction(), emitX86DeclareSimdFunction(), clang::Expr::EvaluateKnownConstInt(), clang::CodeGen::CodeGenModule::getContext(), clang::Expr::getExprLoc(), clang::Redeclarable< decl_type >::getMostRecentDecl(), clang::Redeclarable< decl_type >::getPreviousDecl(), clang::CharUnits::getQuantity(), clang::CodeGen::CodeGenModule::getTarget(), clang::CodeGen::CodeGenModule::getTriple(), clang::Expr::getType(), clang::ASTContext::getTypeSizeInChars(), clang::TargetInfo::hasFeature(), clang::Expr::IgnoreParenImpCasts(), P, clang::FunctionDecl::parameters(), clang::Expr::SE_AllowSideEffects, clang::Decl::specific_attrs(), and State.
|
virtual |
Emit a code for initialization of declare target variable.
VD | Declare target variable. |
Addr | Address of the global variable VD. |
PerformInit | true if initialization expression is not constant. |
Definition at line 1837 of file CGOpenMPRuntime.cpp.
References CGM, clang::DeclaratorDecl::getBeginLoc(), clang::VarDecl::getCanonicalDecl(), clang::CodeGen::CodeGenModule::getContext(), clang::VarDecl::getDefinition(), clang::CodeGen::CodeGenModule::getLangOpts(), clang::CodeGen::CodeGenModule::getMangledName(), getTargetEntryUniqueInfo(), clang::ValueDecl::getType(), Line, and clang::LangOptions::OMPTargetTriples.
void CGOpenMPRuntime::emitDeferredTargetDecls | ( | ) | const |
Emit deferred declare target variables marked for deferred emission.
Definition at line 10859 of file CGOpenMPRuntime.cpp.
std::pair< llvm::Value *, Address > CGOpenMPRuntime::emitDependClause | ( | CodeGenFunction & | CGF, |
ArrayRef< OMPTaskDataTy::DependData > | Dependencies, | ||
SourceLocation | Loc | ||
) |
Emits list of dependecies based on the provided data (array of dependence/expression pairs).
Definition at line 4716 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenFunction::Builder, CGM, clang::ImplicitParamDecl::Create(), clang::CodeGen::CGBuilderTy::CreateConstArrayGEP(), clang::CodeGen::CodeGenFunction::CreateMemTemp(), clang::CodeGen::CGBuilderTy::CreatePointerBitCastOrAddrSpaceCast(), clang::CodeGen::OMPTaskDataTy::DependData::DepExprs, clang::CodeGen::OMPTaskDataTy::DependData::DepKind, emitDependData(), clang::CodeGen::CodeGenFunction::EmitScalarExpr(), clang::CodeGen::CodeGenFunction::EmitStoreOfScalar(), clang::CodeGen::CodeGenFunction::EmitVarDecl(), End, clang::CodeGen::RValue::get(), clang::CodeGen::CodeGenFunction::GetAddrOfLocalVar(), clang::CodeGen::CodeGenModule::getContext(), getDependTypes(), clang::CodeGen::CodeGenTypeCache::Int32Ty, clang::CodeGen::CodeGenTypeCache::Int8Ty, clang::CodeGen::CodeGenTypeCache::IntPtrTy, clang::CodeGen::Address::invalid(), clang::CodeGen::OMPTaskDataTy::DependData::IteratorExpr, clang::CodeGen::CodeGenFunction::MakeAddrLValue(), clang::ArrayType::Normal, clang::ImplicitParamDecl::Other, clang::CodeGen::CodeGenTypeCache::SizeTy, V, clang::VK_PRValue, and clang::CodeGen::CodeGenTypeCache::VoidPtrTy.
Referenced by emitTaskCall(), and emitTaskwaitCall().
Address CGOpenMPRuntime::emitDepobjDependClause | ( | CodeGenFunction & | CGF, |
const OMPTaskDataTy::DependData & | Dependencies, | ||
SourceLocation | Loc | ||
) |
Emits list of dependecies based on the provided data (array of dependence/expression pairs) for depobj construct.
In this case, the variable is allocated in dynamically.
Definition at line 4840 of file CGOpenMPRuntime.cpp.
References clang::CharUnits::alignTo(), clang::CodeGen::CodeGenFunction::Builder, CGM, clang::CodeGen::OMPTaskDataTy::DependData::DepExprs, clang::CodeGen::CodeGenFunction::EmitScalarExpr(), clang::Type::getAsTagDecl(), clang::CodeGen::CodeGenModule::getContext(), getDependTypes(), clang::CodeGen::CodeGenModule::getSize(), getThreadID(), clang::CodeGen::CodeGenTypeCache::IntPtrTy, clang::CodeGen::Address::invalid(), clang::CodeGen::OMPTaskDataTy::DependData::IteratorExpr, clang::ArrayType::Normal, and clang::CodeGen::CodeGenTypeCache::SizeTy.
void CGOpenMPRuntime::emitDestroyClause | ( | CodeGenFunction & | CGF, |
LValue | DepobjLVal, | ||
SourceLocation | Loc | ||
) |
Emits the code to destroy the dependency object provided in depobj directive.
Definition at line 4925 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenFunction::Builder, CGM, clang::CodeGen::CodeGenFunction::ConvertTypeForMem(), clang::CodeGen::CGBuilderTy::CreateGEP(), clang::CodeGen::CGBuilderTy::CreatePointerBitCastOrAddrSpaceCast(), clang::CodeGen::CodeGenFunction::EmitLoadOfPointerLValue(), clang::CodeGen::LValue::getAddress(), clang::CodeGen::CodeGenModule::getContext(), getDependTypes(), clang::CodeGen::Address::getElementType(), clang::CodeGen::Address::getPointer(), getThreadID(), clang::CodeGen::CodeGenTypeCache::IntPtrTy, and clang::CodeGen::CodeGenTypeCache::VoidPtrTy.
|
virtual |
CGF | Reference to current CodeGenFunction. |
Loc | Clang source location. |
SchedKind | Schedule kind, specified by the 'dist_schedule' clause. |
Values | Input arguments for the construct. |
Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.
Definition at line 2802 of file CGOpenMPRuntime.cpp.
References CGM, clang::CodeGen::CGOpenMPRuntime::StaticRTInput::Chunk, emitForStaticInitCall(), emitUpdateLocation(), clang::CodeGen::CodeGenModule::getLangOpts(), getRuntimeSchedule(), getThreadID(), clang::CodeGen::CodeGenModule::getTriple(), clang::CodeGen::CGOpenMPRuntime::StaticRTInput::IVSigned, clang::CodeGen::CGOpenMPRuntime::StaticRTInput::IVSize, and clang::OMPC_SCHEDULE_MODIFIER_unknown.
|
virtual |
Emit initialization for doacross loop nesting support.
D | Loop-based construct used in doacross nesting construct. |
Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.
Definition at line 12018 of file CGOpenMPRuntime.cpp.
References addFieldToRecordDecl(), clang::CodeGen::CodeGenFunction::Builder, CGM, clang::RecordDecl::completeDefinition(), clang::CodeGen::CGBuilderTy::CreateConstArrayGEP(), clang::CodeGen::CodeGenFunction::CreateMemTemp(), clang::CodeGen::CGBuilderTy::CreatePointerBitCastOrAddrSpaceCast(), clang::CodeGen::CodeGenFunction::EHStack, clang::CodeGen::CodeGenFunction::EmitLValueForField(), clang::CodeGen::CodeGenFunction::EmitNullInitialization(), clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), clang::CodeGen::CodeGenFunction::EmitScalarConversion(), clang::CodeGen::CodeGenFunction::EmitScalarExpr(), clang::CodeGen::CodeGenFunction::EmitStoreOfScalar(), emitUpdateLocation(), clang::RecordDecl::field_begin(), clang::Type::getAsTagDecl(), clang::OMPExecutableDirective::getBeginLoc(), clang::CodeGen::CodeGenModule::getContext(), clang::OMPExecutableDirective::getEndLoc(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::Address::getPointer(), getThreadID(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), clang::CodeGen::CodeGenTypeCache::Int32Ty, clang::CodeGen::CodeGenTypeCache::Int64Ty, clang::QualType::isNull(), clang::CodeGen::CodeGenFunction::MakeAddrLValue(), clang::ArrayType::Normal, clang::CodeGen::NormalAndEHCleanup, OMPBuilder, clang::TagDecl::startDefinition(), and clang::CodeGen::CodeGenTypeCache::VoidPtrTy.
|
virtual |
Emit code for doacross ordered directive with 'depend' clause.
C | 'depend' clause with 'sink|source' dependency kind. |
Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.
Definition at line 12089 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenFunction::Builder, CGM, clang::CodeGen::CGBuilderTy::CreateConstArrayGEP(), clang::CodeGen::CodeGenFunction::CreateMemTemp(), clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), clang::CodeGen::CodeGenFunction::EmitScalarConversion(), clang::CodeGen::CodeGenFunction::EmitScalarExpr(), clang::CodeGen::CodeGenFunction::EmitStoreOfScalar(), emitUpdateLocation(), clang::ASTContext::getConstantArrayType(), clang::CodeGen::CodeGenModule::getContext(), clang::Expr::getExprLoc(), clang::ASTContext::getIntTypeForBitwidth(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::Address::getPointer(), getThreadID(), clang::Expr::getType(), clang::ArrayType::Normal, and OMPBuilder.
|
virtual |
Emit flush of the variables specified in 'omp flush' directive.
Vars | List of variables to flush. |
Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.
Definition at line 2914 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::CGM, CGM, clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), emitUpdateLocation(), clang::CodeGen::CodeGenModule::getLangOpts(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), and OMPBuilder.
Referenced by emitOMPAtomicCaptureExpr(), emitOMPAtomicReadExpr(), emitOMPAtomicUpdateExpr(), and emitOMPAtomicWriteExpr().
|
virtual |
Call the appropriate runtime routine to initialize it before start of loop.
This is used for non static scheduled types and when the ordered clause is present on the loop construct. Depending on the loop schedule, it is necessary to call some runtime routine before start of the OpenMP loop to get the loop upper / lower bounds LB and UB and stride ST.
CGF | Reference to current CodeGenFunction. |
Loc | Clang source location. |
ScheduleKind | Schedule kind, specified by the 'schedule' clause. |
IVSize | Size of the iteration variable in bits. |
IVSigned | Sign of the iteration variable. |
Ordered | true if loop is ordered, false otherwise. |
DispatchValues | struct containing llvm values for lower bound, upper bound, and chunk expression. For the default (nullptr) value, the chunk 1 will be used. |
Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.
Definition at line 2699 of file CGOpenMPRuntime.cpp.
References addMonoNonMonoModifier(), clang::CodeGen::CodeGenFunction::Builder, CGM, clang::CodeGen::CGOpenMPRuntime::DispatchRTInput::Chunk, clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), emitUpdateLocation(), getRuntimeSchedule(), getThreadID(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), clang::CodeGen::CGOpenMPRuntime::DispatchRTInput::LB, clang::OpenMPScheduleTy::M1, clang::OpenMPScheduleTy::M2, clang::OpenMPScheduleTy::Schedule, and clang::CodeGen::CGOpenMPRuntime::DispatchRTInput::UB.
|
virtual |
Call __kmpc_dispatch_next( ident_t *loc, kmp_int32 tid, kmp_int32 *p_lastiter, kmp_int[32|64] *p_lower, kmp_int[32|64] *p_upper, kmp_int[32|64] *p_stride);.
IVSize | Size of the iteration variable in bits. |
IVSigned | Sign of the iteration variable. |
IL | Address of the output variable in which the flag of the last iteration is returned. |
LB | Address of the output variable in which the lower iteration number is returned. |
UB | Address of the output variable in which the upper iteration number is returned. |
ST | Address of the output variable in which the stride value is returned. |
Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.
Definition at line 2861 of file CGOpenMPRuntime.cpp.
References clang::ASTContext::BoolTy, clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), clang::CodeGen::CodeGenFunction::EmitScalarConversion(), emitUpdateLocation(), clang::CodeGen::CodeGenFunction::getContext(), clang::ASTContext::getIntTypeForBitwidth(), clang::CodeGen::Address::getPointer(), and getThreadID().
|
virtual |
Call the appropriate runtime routine to notify that we finished iteration of the ordered loop with the dynamic scheduling.
CGF | Reference to current CodeGenFunction. |
Loc | Clang source location. |
IVSize | Size of the iteration variable in bits. |
IVSigned | Sign of the iteration variable. |
Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.
Definition at line 2850 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), emitUpdateLocation(), getThreadID(), and clang::CodeGen::CodeGenFunction::HaveInsertPoint().
|
virtual |
Call the appropriate runtime routine to notify that we finished all the work with current loop.
CGF | Reference to current CodeGenFunction. |
Loc | Clang source location. |
DKind | Kind of the directive for which the static finish is emitted. |
Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.
Definition at line 2823 of file CGOpenMPRuntime.cpp.
References CGM, clang::CodeGen::ApplyDebugLocation::CreateDefaultArtificial(), clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), emitUpdateLocation(), clang::CodeGen::CodeGenModule::getLangOpts(), clang::CodeGen::CodeGenModule::getModule(), getThreadID(), clang::CodeGen::CodeGenModule::getTriple(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), clang::isOpenMPDistributeDirective(), clang::isOpenMPLoopDirective(), and OMPBuilder.
|
virtual |
Call the appropriate runtime routine to initialize it before start of loop.
This is used only in case of static schedule, when the user did not specify a ordered clause on the loop construct. Depending on the loop schedule, it is necessary to call some runtime routine before start of the OpenMP loop to get the loop upper / lower bounds LB and UB and stride ST.
CGF | Reference to current CodeGenFunction. |
Loc | Clang source location. |
DKind | Kind of the directive. |
ScheduleKind | Schedule kind, specified by the 'schedule' clause. |
Values | Input arguments for the construct. |
Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.
Definition at line 2781 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CGOpenMPRuntime::StaticRTInput::Chunk, clang::CodeGen::ApplyDebugLocation::CreateDefaultArtificial(), emitForStaticInitCall(), emitUpdateLocation(), getRuntimeSchedule(), getThreadID(), clang::isOpenMPLoopDirective(), clang::isOpenMPWorksharingDirective(), clang::CodeGen::CGOpenMPRuntime::StaticRTInput::IVSigned, clang::CodeGen::CGOpenMPRuntime::StaticRTInput::IVSize, clang::OpenMPScheduleTy::M1, clang::OpenMPScheduleTy::M2, clang::CodeGen::CGOpenMPRuntime::StaticRTInput::Ordered, and clang::OpenMPScheduleTy::Schedule.
|
virtual |
Emits OpenMP-specific function prolog.
Required for device constructs.
Reimplemented in clang::CodeGen::CGOpenMPRuntimeGPU.
Definition at line 12143 of file CGOpenMPRuntime.cpp.
Referenced by clang::CodeGen::CodeGenFunction::StartFunction().
void CGOpenMPRuntime::emitIfClause | ( | CodeGenFunction & | CGF, |
const Expr * | Cond, | ||
const RegionCodeGenTy & | ThenGen, | ||
const RegionCodeGenTy & | ElseGen | ||
) |
Emits code for OpenMP 'if' clause using specified CodeGen function.
Here is the logic: if (Cond) { ThenGen(); } else { ElseGen(); }
Definition at line 2000 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenFunction::ConstantFoldsToSimpleInteger(), clang::CodeGen::CodeGenFunction::createBasicBlock(), clang::CodeGen::ApplyDebugLocation::CreateEmpty(), clang::CodeGen::CodeGenFunction::EmitBlock(), clang::CodeGen::CodeGenFunction::EmitBranch(), clang::CodeGen::CodeGenFunction::EmitBranchOnBoolExpr(), and clang::Stmt::getSourceRange().
Referenced by emitParallelCall(), emitTargetDataCalls(), emitTargetDataStandAloneCall(), and emitTaskCall().
|
virtual |
Emit code for the directive that does not require outlining.
InnermostKind | Kind of innermost directive (for simple directives it is a directive itself, for combined - its innermost directive). |
CodeGen | Code generation sequence for the D directive. |
HasCancel | true if region has inner cancel directive, false otherwise. |
Definition at line 6167 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenFunction::CapturedStmtInfo, clang::CodeGen::CodeGenFunction::CGCapturedStmtInfo::EmitBody(), and clang::CodeGen::CodeGenFunction::HaveInsertPoint().
Referenced by emitCriticalRegion(), emitMaskedRegion(), emitMasterRegion(), emitOrderedRegion(), clang::CodeGen::CodeGenFunction::EmitSimpleOMPExecutableDirective(), emitSingleRegion(), emitTargetDataStandAloneCall(), and emitTaskgroupRegion().
|
virtual |
Gets the address of the global copy used for lastprivate conditional update, if any.
PrivLVal | LValue for the private copy. |
VD | Original lastprivate declaration. |
Definition at line 12801 of file CGOpenMPRuntime.cpp.
References CGM, clang::CodeGen::CodeGenFunction::EmitLoadOfScalar(), clang::CodeGen::CodeGenFunction::EmitStoreOfScalar(), clang::CodeGen::LValue::getAlignment(), clang::CodeGen::CodeGenFunction::getLangOpts(), clang::CodeGen::CodeGenModule::getModule(), clang::QualType::getNonReferenceType(), clang::CodeGen::LValue::getType(), and clang::CodeGen::CodeGenFunction::MakeAddrLValue().
Address CGOpenMPRuntime::emitLastprivateConditionalInit | ( | CodeGenFunction & | CGF, |
const VarDecl * | VD | ||
) |
Create specialized alloca to handle lastprivate conditionals.
Definition at line 12515 of file CGOpenMPRuntime.cpp.
References addFieldToRecordDecl(), CGM, clang::RecordDecl::completeDefinition(), clang::CodeGen::CodeGenFunction::ConvertTypeForMem(), clang::CodeGen::CodeGenFunction::CreateMemTemp(), clang::CodeGen::CodeGenFunction::CurFn, clang::CodeGen::Decl, clang::CodeGen::CodeGenFunction::EmitLValueForField(), clang::CodeGen::CodeGenFunction::EmitStoreOfScalar(), clang::CodeGen::LValue::getAddress(), clang::CodeGen::CodeGenModule::getContext(), clang::NamedDecl::getName(), clang::QualType::getNonReferenceType(), clang::ValueDecl::getType(), clang::CodeGen::CodeGenFunction::MakeAddrLValue(), and clang::TagDecl::startDefinition().
|
virtual |
Emits a masked region.
MaskedOpGen | Generator for the statement associated with the given masked region. |
Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.
Definition at line 2252 of file CGOpenMPRuntime.cpp.
References CGM, emitInlinedDirective(), clang::CodeGen::CodeGenFunction::EmitScalarExpr(), emitUpdateLocation(), clang::tooling::Filter, clang::CodeGen::CodeGenModule::getModule(), getThreadID(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), clang::CodeGen::CodeGenTypeCache::Int32Ty, OMPBuilder, and clang::CodeGen::RegionCodeGenTy::setAction().
|
virtual |
Emits a master region.
MasterOpGen | Generator for the statement associated with the given master region. |
Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.
Definition at line 2229 of file CGOpenMPRuntime.cpp.
References CGM, emitInlinedDirective(), emitUpdateLocation(), clang::CodeGen::CodeGenModule::getModule(), getThreadID(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), OMPBuilder, and clang::CodeGen::RegionCodeGenTy::setAction().
|
virtual |
Emits call to void __kmpc_push_num_teams(ident_t *loc, kmp_int32 global_tid, kmp_int32 num_teams, kmp_int32 thread_limit) to generate code for num_teams clause.
NumTeams | An integer expression of teams. |
ThreadLimit | An integer expression of threads. |
Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime, and clang::CodeGen::CGOpenMPRuntimeGPU.
Definition at line 11041 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::CGM, CGM, clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), clang::CodeGen::CodeGenFunction::EmitScalarExpr(), emitUpdateLocation(), clang::CodeGen::CodeGenModule::getModule(), getThreadID(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), clang::CodeGen::CodeGenTypeCache::Int32Ty, and OMPBuilder.
|
protected |
Definition at line 6672 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::EmitScalarExpr(), clang::OMPExecutableDirective::getDirectiveKind(), clang::OMPExecutableDirective::getInnermostCapturedStmt(), clang::CodeGen::CodeGenFunction::getLangOpts(), getNumTeamsExprForTargetDirective(), and clang::CodeGen::CodeGenTypeCache::Int32Ty.
|
virtual |
Emits call to void __kmpc_push_num_threads(ident_t *loc, kmp_int32 global_tid, kmp_int32 num_threads) to generate code for 'num_threads' clause.
NumThreads | An integer value of threads. |
Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime, and clang::CodeGen::CGOpenMPRuntimeGPU.
Definition at line 2885 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenFunction::Builder, CGM, clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), emitUpdateLocation(), clang::CodeGen::CodeGenModule::getModule(), getThreadID(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), clang::CodeGen::CodeGenTypeCache::Int32Ty, and OMPBuilder.
|
protected |
Definition at line 6928 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::EmitAutoVarAlloca(), clang::CodeGen::CodeGenFunction::EmitAutoVarCleanups(), clang::CodeGen::CodeGenFunction::EmitScalarExpr(), clang::CodeGen::CodeGenFunction::EmitVarDecl(), clang::Expr::EvaluateAsBooleanCondition(), clang::CodeGen::CodeGenFunction::EvaluateExprAsBool(), clang::CapturedStmt::getCapturedStmt(), clang::OMPExecutableDirective::getClausesOfKind(), clang::OMPIfClause::getCondition(), clang::CodeGen::CodeGenFunction::getContext(), clang::OMPExecutableDirective::getDirectiveKind(), clang::OMPExecutableDirective::getInnermostCapturedStmt(), clang::CodeGen::CodeGenFunction::getLangOpts(), getNumThreads(), clang::OMPExecutableDirective::getSingleClause(), getSingleCompoundChild(), clang::OMPExecutableDirective::hasClausesOfKind(), clang::CodeGen::CodeGenTypeCache::Int32Ty, clang::isOpenMPDistributeDirective(), clang::isOpenMPSimdDirective(), clang::isOpenMPTargetExecutionDirective(), and clang::isOpenMPTeamsDirective().
|
virtual |
Emit an ordered region.
OrderedOpGen | Generator for the statement associated with the given ordered region. |
Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.
Definition at line 2479 of file CGOpenMPRuntime.cpp.
References CGM, emitInlinedDirective(), emitUpdateLocation(), clang::CodeGen::CodeGenModule::getModule(), getThreadID(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), OMPBuilder, and clang::CodeGen::RegionCodeGenTy::setAction().
|
virtual |
Emits call of the outlined function with the provided arguments, translating these arguments to correct target-specific arguments.
Reimplemented in clang::CodeGen::CGOpenMPRuntimeGPU.
Definition at line 12137 of file CGOpenMPRuntime.cpp.
References emitCall().
Referenced by emitGlobalToListReduceFunction(), emitListToGlobalReduceFunction(), clang::CodeGen::CGOpenMPRuntimeGPU::emitOutlinedFunctionCall(), emitParallelCall(), and emitShuffleAndReduceFunction().
|
virtual |
Emits code for parallel or serial call of the OutlinedFn with variables captured in a record which address is stored in CapturedStruct.
OutlinedFn | Outlined function to be run in parallel threads. Type of this function is void(*)(kmp_int32 *, kmp_int32, struct context_vars*). |
CapturedVars | A pointer to the record with the references to variables used in OutlinedFn function. |
IfCond | Condition in the associated 'if' clause, if it was specified, nullptr otherwise. |
NumThreads | The value corresponding to the num_threads clause, if any, or nullptr. |
Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime, and clang::CodeGen::CGOpenMPRuntimeGPU.
Definition at line 2039 of file CGOpenMPRuntime.cpp.
References CGM, emitIfClause(), emitOutlinedFunctionCall(), emitThreadIDAddress(), emitUpdateLocation(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::CodeGenModule::getOpenMPRuntime(), clang::CodeGen::Address::getPointer(), getThreadID(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), and OMPBuilder.
|
virtual |
Emits outlined function for the specified OpenMP parallel directive D.
This outlined function has type void(*)(kmp_int32 ThreadID, kmp_int32 BoundID, struct context_vars).
D | OpenMP directive. |
ThreadIDVar | Variable for thread id in the current OpenMP region. |
InnermostKind | Kind of innermost directive (for simple directives it is a directive itself, for combined - its innermost directive). |
CodeGen | Code generation sequence for the D directive. |
Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime, and clang::CodeGen::CGOpenMPRuntimeGPU.
Definition at line 1269 of file CGOpenMPRuntime.cpp.
References CGM, emitParallelOrTeamsOutlinedFunction(), clang::OMPExecutableDirective::getCapturedStmt(), and getOutlinedHelperName().
Referenced by clang::CodeGen::CGOpenMPRuntimeGPU::emitParallelOutlinedFunction().
|
virtual |
Emit call to void __kmpc_push_proc_bind(ident_t *loc, kmp_int32 global_tid, int proc_bind) to generate code for 'proc_bind' clause.
Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime, and clang::CodeGen::CGOpenMPRuntimeGPU.
Definition at line 2899 of file CGOpenMPRuntime.cpp.
References CGM, clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), emitUpdateLocation(), clang::CodeGen::CodeGenModule::getModule(), getThreadID(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), clang::CodeGen::CodeGenTypeCache::IntTy, and OMPBuilder.
Referenced by clang::CodeGen::CGOpenMPRuntimeGPU::emitProcBindClause().
|
virtual |
Emit a code for reduction clause.
Next code should be emitted for reduction:
Privates | List of private copies for original reduction arguments. |
LHSExprs | List of LHS in ReductionOps reduction operations. |
RHSExprs | List of RHS in ReductionOps reduction operations. |
ReductionOps | List of reduction operations in form 'LHS binop RHS' or 'operator binop(LHS, RHS)'. |
Options | List of options for reduction codegen: WithNowait true if parent directive has also nowait clause, false otherwise. SimpleReduction Emit reduction operation only. Used for omp simd directive on the host. ReductionKind The kind of reduction to perform. |
Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime, and clang::CodeGen::CGOpenMPRuntimeGPU.
Definition at line 5417 of file CGOpenMPRuntime.cpp.
llvm::Function * CGOpenMPRuntime::emitReductionFunction | ( | SourceLocation | Loc, |
llvm::Type * | ArgsElemType, | ||
ArrayRef< const Expr * > | Privates, | ||
ArrayRef< const Expr * > | LHSExprs, | ||
ArrayRef< const Expr * > | RHSExprs, | ||
ArrayRef< const Expr * > | ReductionOps | ||
) |
Emits reduction function.
ArgsElemType | Array type containing pointers to reduction variables. |
Privates | List of private copies for original reduction arguments. |
LHSExprs | List of LHS in ReductionOps reduction operations. |
RHSExprs | List of RHS in ReductionOps reduction operations. |
ReductionOps | List of reduction operations in form 'LHS binop RHS' or 'operator binop(LHS, RHS)'. |
Definition at line 5307 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenTypes::arrangeBuiltinFunctionDeclaration(), CGM, clang::CodeGen::CodeGenModule::getContext(), clang::CodeGen::CodeGenModule::getTypes(), clang::ImplicitParamDecl::Other, and string().
llvm::Function * CGOpenMPRuntime::emitRequiresDirectiveRegFun | ( | ) |
Creates and returns a registration function for when at least one requires directives was used in the current module.
Definition at line 10974 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenTypes::arrangeNullaryFunction(), CGM, clang::CodeGen::CodeGenModule::CreateGlobalInitOrCleanUpFunction(), clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), clang::CodeGen::CodeGenFunction::FinishFunction(), clang::CodeGen::CodeGenModule::getContext(), clang::CodeGen::CodeGenTypes::GetFunctionType(), clang::CodeGen::CodeGenModule::getLangOpts(), clang::CodeGen::CodeGenModule::getModule(), getName(), clang::CodeGen::CodeGenModule::getTypes(), clang::CodeGen::CodeGenTypeCache::Int64Ty, OMPBuilder, clang::LangOptions::OMPTargetTriples, clang::CodeGen::CodeGenFunction::StartFunction(), and string().
void CGOpenMPRuntime::emitSingleReductionCombiner | ( | CodeGenFunction & | CGF, |
const Expr * | ReductionOp, | ||
const Expr * | PrivateRef, | ||
const DeclRefExpr * | LHS, | ||
const DeclRefExpr * | RHS | ||
) |
Emits single reduction combiner.
Definition at line 5397 of file CGOpenMPRuntime.cpp.
References EmitOMPAggregateReduction(), emitReductionCombiner(), clang::DeclRefExpr::getDecl(), clang::Expr::getType(), and clang::Type::isArrayType().
|
virtual |
Emits a single region.
SingleOpGen | Generator for the statement associated with the given single region. |
Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.
Definition at line 2392 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenFunction::Builder, CGM, clang::CodeGen::CodeGenFunction::ConvertTypeForMem(), clang::CodeGen::CGBuilderTy::CreateConstArrayGEP(), clang::CodeGen::CGBuilderTy::CreateLoad(), clang::CodeGen::CodeGenFunction::CreateMemTemp(), clang::CodeGen::CGBuilderTy::CreatePointerBitCastOrAddrSpaceCast(), clang::CodeGen::CGBuilderTy::CreateStore(), emitCopyprivateCopyFunction(), emitInlinedDirective(), clang::CodeGen::CodeGenFunction::EmitLValue(), clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), emitUpdateLocation(), clang::CodeGen::CodeGenModule::getContext(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::Address::getPointer(), clang::CodeGen::LValue::getPointer(), getThreadID(), clang::CodeGen::CodeGenFunction::getTypeSize(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), clang::CodeGen::CodeGenTypeCache::Int8Ty, clang::CodeGen::Address::invalid(), clang::CodeGen::Address::isValid(), clang::ArrayType::Normal, OMPBuilder, clang::CodeGen::RegionCodeGenTy::setAction(), and clang::CodeGen::CodeGenTypeCache::VoidPtrTy.
|
virtual |
Emit the target offloading code associated with D.
The emitted code attempts offloading the execution to the device, an the event of a failure it executes the host version outlined in OutlinedFn.
D | Directive to emit. |
OutlinedFn | Host version of the code to be offloaded. |
OutlinedFnID | ID of host version of the code to be offloaded. |
IfCond | Expression evaluated in if clause associated with the target directive, or null if no if clause is used. |
Device | Expression evaluated in device clause associated with the target directive, or null if no device clause is used and device modifier. |
SizeEmitter | Callback to emit number of iterations for loop-based directives. |
Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.
Definition at line 10207 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CGOpenMPRuntime::TargetDataInfo::BasePointersArray, clang::CapturedStmt::Capture::capturesThis(), clang::CapturedStmt::Capture::capturesVariable(), clang::CapturedStmt::Capture::capturesVariableArrayType(), emitOffloadingArrays(), emitOffloadingArraysArgument(), clang::OMPExecutableDirective::getCapturedStmt(), clang::CapturedStmt::Capture::getCapturedVar(), clang::ValueDecl::getType(), clang::OMPExecutableDirective::hasClausesOfKind(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), clang::CodeGen::CGOpenMPRuntime::TargetDataInfo::MapNamesArray, clang::CodeGen::CGOpenMPRuntime::TargetDataInfo::MappersArray, clang::CodeGen::CGOpenMPRuntime::TargetDataInfo::MapTypesArray, clang::CodeGen::CGOpenMPRuntime::TargetDataInfo::NumberOfPtrs, clang::OMPC_DEVICE_unknown, clang::CodeGen::CGOpenMPRuntime::TargetDataInfo::PointersArray, and clang::CodeGen::CGOpenMPRuntime::TargetDataInfo::SizesArray.
|
virtual |
Emit the target data mapping code associated with D.
D | Directive to emit. |
IfCond | Expression evaluated in if clause associated with the target directive, or null if no device clause is used. |
Device | Expression evaluated in device clause associated with the target directive, or null if no device clause is used. |
Info | A record used to store information that needs to be preserved until the region is closed. |
Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.
Definition at line 11070 of file CGOpenMPRuntime.cpp.
References CGM, emitIfClause(), emitOffloadingArrays(), emitOffloadingArraysArgument(), emitUpdateLocation(), clang::OMPExecutableDirective::getBeginLoc(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), and OMPBuilder.
|
virtual |
Emit the data mapping/movement code associated with the directive D that should be of the form 'target [{enter|exit} data | update]'.
D | Directive to emit. |
IfCond | Expression evaluated in if clause associated with the target directive, or null if no if clause is used. |
Device | Expression evaluated in device clause associated with the target directive, or null if no device clause is used. |
Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.
Definition at line 11224 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CGOpenMPRuntime::TargetDataInfo::BasePointersArray, CGM, emitIfClause(), emitInlinedDirective(), emitOffloadingArrays(), emitOffloadingArraysArgument(), emitUpdateLocation(), clang::OMPExecutableDirective::getBeginLoc(), clang::OMPExecutableDirective::getDirectiveKind(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::CodeGenTypeCache::getPointerAlign(), clang::OMPExecutableDirective::hasClausesOfKind(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), clang::CodeGen::CGOpenMPRuntime::TargetDataInfo::MapNamesArray, clang::CodeGen::CGOpenMPRuntime::TargetDataInfo::MappersArray, clang::CodeGen::CGOpenMPRuntime::TargetDataInfo::MapTypesArray, clang::CodeGen::CGOpenMPRuntime::TargetDataInfo::NumberOfPtrs, OMPBuilder, clang::CodeGen::CGOpenMPRuntime::TargetDataInfo::PointersArray, and clang::CodeGen::CGOpenMPRuntime::TargetDataInfo::SizesArray.
|
virtual |
Emit the target regions enclosed in GD function definition or the function itself in case it is a valid device function.
Returns true if GD was dealt with successfully.
GD | Function to scan. |
Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.
Definition at line 10705 of file CGOpenMPRuntime.cpp.
References clang::GlobalDecl::getDecl(), and isAssumedToBeNotEmitted().
|
virtual |
Emit the global GD if it is meaningful for the target.
Returns if it was emitted successfully.
GD | Global to scan. |
Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.
Definition at line 10851 of file CGOpenMPRuntime.cpp.
References clang::GlobalDecl::getDecl().
|
virtual |
Emit the global variable if it is a valid device global variable.
Returns true if GD was dealt with successfully.
GD | Variable declaration to emit. |
Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.
Definition at line 10731 of file CGOpenMPRuntime.cpp.
References clang::Ctor_Complete, clang::CXXRecordDecl::ctors(), clang::Dtor_Complete, clang::Type::getAsCXXRecordDecl(), clang::Type::getBaseElementTypeUnsafe(), clang::GlobalDecl::getDecl(), clang::CXXRecordDecl::getDestructor(), and isAssumedToBeNotEmitted().
|
virtual |
Emit outilined function for 'target' directive.
D | Directive to emit. |
ParentName | Name of the function that encloses the target region. |
OutlinedFn | Outlined function value to be defined by this call. |
OutlinedFnID | Outlined function ID value to be defined by this call. |
IsOffloadEntry | True if the outlined function is an offload entry. |
CodeGen | Code generation sequence for the D directive. An outlined function may not be an entry if, e.g. the if clause always evaluates to false. |
Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.
Definition at line 6319 of file CGOpenMPRuntime.cpp.
References clang::OMPUsesAllocatorsClause::Data::Allocator, clang::OMPUsesAllocatorsClause::Data::AllocatorTraits, emitTargetOutlinedFunctionHelper(), clang::OMPExecutableDirective::getClausesOfKind(), and clang::CodeGen::RegionCodeGenTy::setAction().
|
protectedvirtual |
Helper to emit outlined function for 'target' directive.
D | Directive to emit. |
ParentName | Name of the function that encloses the target region. |
OutlinedFn | Outlined function value to be defined by this call. |
OutlinedFnID | Outlined function ID value to be defined by this call. |
IsOffloadEntry | True if the outlined function is an offload entry. |
CodeGen | Lambda codegen specific to an accelerator device. An outlined function may not be an entry if, e.g. the if clause always evaluates to false. |
Definition at line 6391 of file CGOpenMPRuntime.cpp.
References CGM, clang::CodeGen::CodeGenFunction::GenerateOpenMPCapturedStmtFunction(), clang::OMPExecutableDirective::getBeginLoc(), clang::OMPExecutableDirective::getCapturedStmt(), clang::CodeGen::CodeGenModule::getContext(), clang::CodeGen::CodeGenModule::getLangOpts(), getTargetEntryUniqueInfo(), clang::CodeGen::CodeGenModule::getTriple(), clang::CodeGen::CodeGenTypeCache::Int8PtrTy, Line, and string().
Referenced by emitTargetOutlinedFunction().
|
virtual |
Emit task region for the task directive.
The task region is emitted in several steps:
D | Current task directive. |
TaskFunction | An LLVM function with type void (*)(i32 /*gtid*/, i32 /*part_id*/, captured_struct /__context*/); |
SharedsTy | A type which contains references the shared variables. |
Shareds | Context with the list of shared variables from the TaskFunction . |
IfCond | Not a nullptr if 'if' clause was specified, nullptr otherwise. |
Data | Additional data for task generation like tiednsee, final state, list of privates etc. |
Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.
Definition at line 4999 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenFunction::Builder, CGM, clang::CodeGen::OMPTaskDataTy::Dependences, emitDependClause(), emitIfClause(), emitUpdateLocation(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::Address::getPointer(), getThreadID(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), clang::CodeGen::Address::invalid(), OMPBuilder, clang::CodeGen::RegionCodeGenTy::setAction(), clang::CodeGen::OMPTaskDataTy::Tied, and clang::CodeGen::CodeGenTypeCache::VoidPtrTy.
|
virtual |
Emit a taskgroup region.
TaskgroupOpGen | Generator for the statement associated with the given taskgroup region. |
Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.
Definition at line 2301 of file CGOpenMPRuntime.cpp.
References CGM, emitInlinedDirective(), emitUpdateLocation(), clang::CodeGen::CodeGenModule::getModule(), getThreadID(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), OMPBuilder, and clang::CodeGen::RegionCodeGenTy::setAction().
|
virtual |
Emit task region for the taskloop directive.
The taskloop region is emitted in several steps:
D | Current task directive. |
TaskFunction | An LLVM function with type void (*)(i32 /*gtid*/, i32 /*part_id*/, captured_struct /__context*/); |
SharedsTy | A type which contains references the shared variables. |
Shareds | Context with the list of shared variables from the TaskFunction . |
IfCond | Not a nullptr if 'if' clause was specified, nullptr otherwise. |
Data | Additional data for task generation like tiednsee, final state, list of privates etc. |
Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.
Definition at line 5117 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenFunction::Builder, CGM, clang::CodeGen::CGBuilderTy::CreatePointerBitCastOrAddrSpaceCast(), clang::CodeGen::CodeGenFunction::EmitAnyExprToMem(), clang::CodeGen::CodeGenFunction::EmitLoadOfScalar(), clang::CodeGen::CodeGenFunction::EmitLValueForField(), clang::CodeGen::CodeGenFunction::EmitNullInitialization(), clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), clang::CodeGen::CodeGenFunction::EmitStoreOfScalar(), emitUpdateLocation(), clang::CodeGen::CodeGenFunction::EvaluateExprAsBool(), clang::CodeGen::LValue::getAddress(), clang::CodeGen::CodeGenFunction::getContext(), clang::OMPLoopDirective::getLowerBoundVariable(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::LValue::getPointer(), clang::CodeGen::LValue::getQuals(), clang::OMPLoopDirective::getStrideVariable(), getThreadID(), clang::OMPLoopDirective::getUpperBoundVariable(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), clang::CodeGen::CodeGenTypeCache::Int64Ty, clang::CodeGen::CodeGenTypeCache::IntTy, OMPBuilder, clang::CodeGen::OMPTaskDataTy::Reductions, clang::CodeGen::OMPTaskDataTy::Schedule, clang::CodeGen::CodeGenTypeCache::VoidPtrTy, and clang::ASTContext::VoidPtrTy.
|
virtual |
Emits outlined function for the OpenMP task directive D.
This outlined function has type void(*)(kmp_int32 ThreadID, struct task_t* TaskT).
D | OpenMP directive. |
ThreadIDVar | Variable for thread id in the current OpenMP region. |
PartIDVar | Variable for partition id in the current OpenMP untied task region. |
TaskTVar | Variable for task_t argument. |
InnermostKind | Kind of innermost directive (for simple directives it is a directive itself, for combined - its innermost directive). |
CodeGen | Code generation sequence for the D directive. |
Tied | true if task is generated for tied task, false otherwise. |
NumberOfParts | Number of parts in untied task. Ignored for tied tasks. |
Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.
Definition at line 1285 of file CGOpenMPRuntime.cpp.
References clang::Type::castAs(), CGM, emitUpdateLocation(), clang::CodeGen::CodeGenFunction::GenerateCapturedStmtFunction(), clang::OMPExecutableDirective::getBeginLoc(), clang::OMPExecutableDirective::getCapturedStmt(), clang::OMPExecutableDirective::getDirectiveKind(), clang::CodeGen::CodeGenModule::getModule(), getThreadID(), clang::ValueDecl::getType(), clang::isOpenMPTaskLoopDirective(), clang::Type::isPointerType(), OMPBuilder, and clang::CodeGen::RegionCodeGenTy::setAction().
|
virtual |
Emits the following code for reduction clause with task modifier:
Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.
Definition at line 6061 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenFunction::Builder, CGM, clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), emitUpdateLocation(), clang::CodeGen::CodeGenModule::getModule(), getThreadID(), clang::CodeGen::CodeGenTypeCache::IntTy, and OMPBuilder.
|
virtual |
Required to resolve existing problems in the runtime.
Emits threadprivate variables to store the size of the VLAs/array sections for initializer/combiner/finalizer functions.
RCG | Allows to reuse an existing data for the reductions. |
N | Reduction item for which fixups must be emitted. |
Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.
Definition at line 6079 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenFunction::Builder, CGM, clang::CodeGen::CGBuilderTy::CreateStore(), generateUniqueName(), getAddrOfArtificialThreadPrivate(), clang::CodeGen::CodeGenModule::getContext(), clang::CodeGen::ReductionCodeGen::getRefExpr(), clang::CodeGen::ReductionCodeGen::getSizes(), clang::ASTContext::getSizeType(), and clang::CodeGen::CodeGenTypeCache::SizeTy.
|
virtual |
Emit a code for initialization of task reduction clause.
Next code should be emitted for reduction:
For reduction clause with task modifier it emits the next call:
LHSExprs | List of LHS in Data.ReductionOps reduction operations. |
RHSExprs | List of RHS in Data.ReductionOps reduction operations. |
Data | Additional data for task generation like tiedness, final state, list of privates, reductions etc. |
Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.
Definition at line 5932 of file CGOpenMPRuntime.cpp.
References addFieldToRecordDecl(), clang::CodeGen::CodeGenFunction::Builder, CGM, clang::RecordDecl::completeDefinition(), clang::CodeGen::CodeGenFunction::CreateMemTemp(), clang::CodeGen::CGBuilderTy::CreatePointerBitCastOrAddrSpaceCast(), clang::CodeGen::ReductionCodeGen::emitAggregateType(), clang::CodeGen::CodeGenFunction::EmitCastToVoidPtr(), clang::CodeGen::CodeGenFunction::EmitCheckedInBoundsGEP(), clang::CodeGen::CodeGenFunction::EmitLValueForField(), clang::CodeGen::CodeGenFunction::EmitNullInitialization(), emitReduceCombFunction(), emitReduceFiniFunction(), emitReduceInitFunction(), clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), clang::CodeGen::ReductionCodeGen::emitSharedOrigLValue(), clang::CodeGen::CodeGenFunction::EmitStoreOfScalar(), emitUpdateLocation(), clang::CodeGen::LValue::getAddress(), clang::CodeGen::CodeGenModule::getContext(), clang::CodeGen::Address::getElementType(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::ReductionCodeGen::getOrigLValue(), clang::CodeGen::Address::getPointer(), clang::CodeGen::LValue::getPointer(), clang::CodeGen::ReductionCodeGen::getSharedLValue(), clang::CodeGen::ReductionCodeGen::getSizes(), getThreadID(), clang::CodeGen::LValue::getType(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), clang::CodeGen::CodeGenTypeCache::Int32Ty, clang::CodeGen::CodeGenTypeCache::IntTy, clang::CodeGen::OMPTaskDataTy::IsReductionWithTaskMod, clang::CodeGen::OMPTaskDataTy::IsWorksharingReduction, clang::CodeGen::CodeGenFunction::MakeNaturalAlignAddrLValue(), clang::ArrayType::Normal, OMPBuilder, clang::CodeGen::OMPTaskDataTy::ReductionCopies, clang::CodeGen::OMPTaskDataTy::ReductionOps, clang::CodeGen::OMPTaskDataTy::ReductionOrigs, clang::CodeGen::OMPTaskDataTy::ReductionVars, clang::CodeGen::CodeGenTypeCache::SizeTy, clang::TagDecl::startDefinition(), and clang::CodeGen::CodeGenTypeCache::VoidPtrTy.
|
virtual |
Emit code for 'taskwait' directive.
Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.
Definition at line 6116 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::CapturedStmtInfo, clang::CodeGen::CodeGenFunction::CGM, CGM, clang::CodeGen::OMPTaskDataTy::Dependences, emitDependClause(), clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), emitUpdateLocation(), clang::CodeGen::CodeGenModule::getLangOpts(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::Address::getPointer(), getThreadID(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), clang::CodeGen::Address::invalid(), OMPBuilder, and clang::CodeGen::CodeGenTypeCache::VoidPtrTy.
|
virtual |
Emits code for a taskyield directive.
Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.
Definition at line 2281 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::CapturedStmtInfo, clang::CodeGen::CodeGenFunction::CGM, CGM, clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), emitUpdateLocation(), clang::CodeGen::CodeGenModule::getLangOpts(), clang::CodeGen::CodeGenModule::getModule(), getThreadID(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), clang::CodeGen::CodeGenTypeCache::IntTy, and OMPBuilder.
|
virtual |
Emits code for teams call of the OutlinedFn with variables captured in a record which address is stored in CapturedStruct.
OutlinedFn | Outlined function to be run by team masters. Type of this function is void(*)(kmp_int32 *, kmp_int32, struct context_vars*). |
CapturedVars | A pointer to the record with the references to variables used in OutlinedFn function. |
Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime, and clang::CodeGen::CGOpenMPRuntimeGPU.
Definition at line 11016 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenFunction::Builder, CGM, clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), emitUpdateLocation(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), and OMPBuilder.
|
virtual |
Emits outlined function for the specified OpenMP teams directive D.
This outlined function has type void(*)(kmp_int32 ThreadID, kmp_int32 BoundID, struct context_vars).
D | OpenMP directive. |
ThreadIDVar | Variable for thread id in the current OpenMP region. |
InnermostKind | Kind of innermost directive (for simple directives it is a directive itself, for combined - its innermost directive). |
CodeGen | Code generation sequence for the D directive. |
Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime, and clang::CodeGen::CGOpenMPRuntimeGPU.
Definition at line 1277 of file CGOpenMPRuntime.cpp.
References CGM, emitParallelOrTeamsOutlinedFunction(), clang::OMPExecutableDirective::getCapturedStmt(), and getOutlinedHelperName().
Referenced by clang::CodeGen::CGOpenMPRuntimeGPU::emitTeamsOutlinedFunction().
|
protectedvirtual |
Emits address of the word in a memory where current thread id is stored.
Definition at line 2117 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenFunction::CapturedStmtInfo, clang::CodeGen::CodeGenFunction::CreateMemTemp(), clang::CodeGen::CodeGenFunction::EmitStoreOfScalar(), clang::CodeGen::CodeGenFunction::getContext(), clang::ASTContext::getIntTypeForBitwidth(), getThreadID(), and clang::CodeGen::CodeGenFunction::MakeAddrLValue().
Referenced by emitParallelCall(), and clang::CodeGen::CGOpenMPRuntimeGPU::emitTeamsCall().
|
virtual |
Emit a code for initialization of threadprivate variable.
It emits a call to runtime library which adds initial value to the newly created threadprivate variable (if it is not constant) and registers destructor for the variable (if any).
VD | Threadprivate variable. |
VDAddr | Address of the global variable VD. |
Loc | Location of threadprivate declaration. |
PerformInit | true if initialization expression is not constant. |
Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.
Definition at line 1716 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenTypes::arrangeBuiltinFunctionDeclaration(), CGM, clang::VarDecl::getAnyInitializer(), clang::CodeGen::CodeGenModule::getContext(), clang::VarDecl::getDefinition(), clang::CodeGen::CodeGenTypes::GetFunctionType(), clang::CodeGen::CodeGenModule::getLangOpts(), clang::CodeGen::CodeGenModule::getMangledName(), clang::ASTContext::getTargetInfo(), clang::ValueDecl::getType(), clang::CodeGen::CodeGenModule::getTypes(), clang::TargetInfo::isTLSSupported(), clang::ImplicitParamDecl::Other, string(), and clang::ASTContext::VoidPtrTy.
Referenced by clang::CodeGen::CodeGenFunction::EmitCXXGlobalVarDeclInit().
void CGOpenMPRuntime::emitUpdateClause | ( | CodeGenFunction & | CGF, |
LValue | DepobjLVal, | ||
OpenMPDependClauseKind | NewDepKind, | ||
SourceLocation | Loc | ||
) |
Updates the dependency kind in the specified depobj object.
DepobjLVal | LValue for the main depobj object. |
NewDepKind | New dependency kind. |
Definition at line 4952 of file CGOpenMPRuntime.cpp.
References CGM, clang::CodeGen::CodeGenFunction::ConvertTypeForMem(), clang::Type::getAsTagDecl(), clang::CodeGen::CodeGenModule::getContext(), and getDependTypes().
|
protected |
Emits object of ident_t type with info for source location.
Flags | Flags for OpenMP location. |
Definition at line 1370 of file CGOpenMPRuntime.cpp.
References CGM, clang::CodeGen::CodeGenFunction::CurFuncDecl, clang::CodeGen::CodeGenModule::getCodeGenOpts(), clang::PresumedLoc::getColumn(), clang::CodeGen::CodeGenFunction::getContext(), getDefaultLocationReserved2Flags(), clang::PresumedLoc::getFilename(), clang::PresumedLoc::getLine(), clang::SourceManager::getPresumedLoc(), clang::ASTContext::getSourceManager(), clang::SourceLocation::isInvalid(), Line, clang::codegenoptions::NoDebugInfo, OMPBuilder, and string().
Referenced by clang::CodeGen::CGOpenMPRuntimeGPU::emitBarrierCall(), emitBarrierCall(), emitCancelCall(), emitCancellationPointCall(), emitCriticalRegion(), emitDistributeStaticInit(), emitDoacrossInit(), emitDoacrossOrdered(), emitFlush(), emitForDispatchInit(), emitForNext(), emitForOrderedIterationEnd(), emitForStaticFinish(), emitForStaticInit(), emitMaskedRegion(), emitMasterRegion(), emitNumTeamsClause(), emitNumThreadsClause(), emitOrderedRegion(), clang::CodeGen::CGOpenMPRuntimeGPU::emitParallelCall(), emitParallelCall(), emitProcBindClause(), emitSingleRegion(), emitTargetDataCalls(), emitTargetDataStandAloneCall(), emitTaskCall(), emitTaskgroupRegion(), emitTaskLoopCall(), emitTaskOutlinedFunction(), emitTaskReductionFini(), emitTaskReductionInit(), emitTaskwaitCall(), emitTaskyieldCall(), emitTeamsCall(), getAddrOfThreadPrivate(), and getThreadID().
void CGOpenMPRuntime::emitUserDefinedMapper | ( | const OMPDeclareMapperDecl * | D, |
CodeGenFunction * | CGF = nullptr |
||
) |
Emit the function for the user defined mapper construct.
Emit the user-defined mapper function.
The code generation follows the pattern in the example below.
Definition at line 9854 of file CGOpenMPRuntime.cpp.
References clang::Decl::getLocation(), clang::OMPDeclareMapperDecl::getMapperVarRef(), clang::ValueDecl::getType(), and clang::ImplicitParamDecl::Other.
Referenced by clang::CodeGen::CodeGenModule::EmitOMPDeclareMapper().
|
virtual |
Emit code for the specified user defined reduction construct.
Definition at line 1152 of file CGOpenMPRuntime.cpp.
References clang::OMPDeclareReductionDecl::CallInit, CGM, clang::CodeGen::CodeGenFunction::CurFn, emitCombinerOrInitializer(), clang::OMPDeclareReductionDecl::getCombiner(), clang::OMPDeclareReductionDecl::getCombinerIn(), clang::OMPDeclareReductionDecl::getCombinerOut(), clang::OMPDeclareReductionDecl::getInitializer(), clang::OMPDeclareReductionDecl::getInitializerKind(), clang::OMPDeclareReductionDecl::getInitOrig(), clang::OMPDeclareReductionDecl::getInitPriv(), clang::ValueDecl::getType(), and clang::Initializer.
Referenced by clang::CodeGen::CodeGenModule::EmitOMPDeclareReduction(), and getUserDefinedReduction().
void CGOpenMPRuntime::emitUsesAllocatorsFini | ( | CodeGenFunction & | CGF, |
const Expr * | Allocator | ||
) |
Destroys user defined allocators specified in the uses_allocators clause.
Definition at line 6375 of file CGOpenMPRuntime.cpp.
void CGOpenMPRuntime::emitUsesAllocatorsInit | ( | CodeGenFunction & | CGF, |
const Expr * | Allocator, | ||
const Expr * | AllocatorTraits | ||
) |
Initializes user defined allocators specified in the uses_allocators clauses.
Definition at line 6340 of file CGOpenMPRuntime.cpp.
|
virtual |
Cleans up references to the objects in finished function.
Reimplemented in clang::CodeGen::CGOpenMPRuntimeGPU.
Definition at line 1463 of file CGOpenMPRuntime.cpp.
References clearLocThreadIdInsertPt(), and clang::CodeGen::CodeGenFunction::CurFn.
Referenced by clang::CodeGen::CGOpenMPRuntimeGPU::functionFinished(), and clang::CodeGen::CodeGenFunction::~CodeGenFunction().
|
virtual |
Gets the OpenMP-specific address of the local variable.
Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime, and clang::CodeGen::CGOpenMPRuntimeGPU.
Definition at line 12196 of file CGOpenMPRuntime.cpp.
References clang::CharUnits::alignTo(), clang::CodeGen::CodeGenFunction::Builder, CGM, clang::CodeGen::CodeGenFunction::CurFn, clang::CharUnits::fromQuantity(), clang::Decl::getAttr(), clang::DeclaratorDecl::getBeginLoc(), clang::VarDecl::getCanonicalDecl(), clang::CodeGen::CodeGenModule::getContext(), clang::ASTContext::getDeclAlign(), clang::CodeGen::CodeGenModule::getSize(), getThreadID(), clang::ValueDecl::getType(), clang::CodeGen::CodeGenFunction::getTypeSize(), clang::ASTContext::getTypeSizeInChars(), clang::Decl::hasAttr(), clang::CodeGen::Address::invalid(), isAllocatableDecl(), and clang::Type::isVariablyModifiedType().
Referenced by clang::CodeGen::CodeGenFunction::EmitAutoVarAlloca(), and clang::CodeGen::CodeGenFunction::EmitParmDecl().
|
virtual |
Creates artificial threadprivate variable with name Name
and type VarType
.
VarType | Type of the artificial threadprivate variable. |
Name | Name of the artificial threadprivate variable. |
Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.
Definition at line 1968 of file CGOpenMPRuntime.cpp.
Referenced by emitTaskReductionFixups().
Returns the address of the variable marked as declare target with link clause OR as declare target with to clause and unified memory.
Definition at line 1625 of file CGOpenMPRuntime.cpp.
References CGM, clang::CodeGen::CodeGenTypes::ConvertTypeForMem(), clang::CodeGen::CodeGenModule::GetAddrOfGlobal(), clang::DeclaratorDecl::getBeginLoc(), clang::VarDecl::getCanonicalDecl(), clang::CodeGen::CodeGenModule::getContext(), clang::ASTContext::getDeclAlign(), clang::CodeGen::CodeGenModule::getLangOpts(), clang::CodeGen::CodeGenModule::getMangledName(), clang::CodeGen::CodeGenModule::getModule(), clang::ASTContext::getPointerType(), getTargetEntryUniqueInfo(), clang::ValueDecl::getType(), clang::CodeGen::CodeGenModule::getTypes(), clang::CodeGen::Address::invalid(), clang::NamedDecl::isExternallyVisible(), Line, and registerTargetGlobalVariable().
Referenced by emitDeclTargetVarDeclLValue(), and clang::CodeGen::CodeGenModule::EmitGlobal().
|
virtual |
Returns address of the threadprivate variable for the current thread.
VD | Threadprivate variable. |
VDAddr | Address of the global variable VD. |
Loc | Location of the reference to threadprivate var. |
Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.
Definition at line 1674 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenFunction::Builder, CGM, clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), emitUpdateLocation(), clang::CodeGen::Address::getAlignment(), clang::CodeGen::CodeGenModule::getContext(), clang::CodeGen::Address::getElementType(), clang::CodeGen::CodeGenModule::getLangOpts(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::Address::getPointer(), clang::CodeGen::CodeGenModule::getSize(), clang::ASTContext::getTargetInfo(), clang::CodeGen::CodeGenModule::GetTargetTypeStoreSize(), getThreadID(), clang::CodeGen::CodeGenTypeCache::Int8PtrTy, clang::CodeGen::CodeGenTypeCache::Int8Ty, clang::TargetInfo::isTLSSupported(), and OMPBuilder.
Referenced by EmitThreadPrivateVarDeclLValue().
|
protected |
Returns corresponding lock object for the specified critical region name.
If the lock object does not exist it is created, otherwise the reference to the existing copy is returned.
CriticalName | Name of the critical region. |
Definition at line 2154 of file CGOpenMPRuntime.cpp.
References string().
Referenced by emitCriticalRegion().
|
inlinevirtual |
Choose default schedule type and chunk value for the dist_schedule clause.
Reimplemented in clang::CodeGen::CGOpenMPRuntimeGPU.
Definition at line 1782 of file CGOpenMPRuntime.h.
|
staticprotected |
Returns default flags for the barriers depending on the directive, for which this barier is going to be emitted.
Definition at line 2503 of file CGOpenMPRuntime.cpp.
Referenced by clang::CodeGen::CGOpenMPRuntimeGPU::emitBarrierCall(), and emitBarrierCall().
|
inlineprotectedvirtual |
Returns additional flags that can be stored in reserved_2 field of the default location.
Reimplemented in clang::CodeGen::CGOpenMPRuntimeGPU.
Definition at line 406 of file CGOpenMPRuntime.h.
Referenced by emitUpdateLocation().
llvm::AtomicOrdering CGOpenMPRuntime::getDefaultMemoryOrdering | ( | ) | const |
Gets default memory ordering as specified in requires directive.
Definition at line 10907 of file CGOpenMPRuntime.cpp.
|
virtual |
Choose default schedule type and chunk value for the schedule clause.
Reimplemented in clang::CodeGen::CGOpenMPRuntimeGPU.
Definition at line 2518 of file CGOpenMPRuntime.cpp.
|
protected |
Returns pointer to ident_t type.
Definition at line 1484 of file CGOpenMPRuntime.cpp.
References OMPBuilder.
|
inlineprotected |
Get the LLVM type for the critical name.
Definition at line 413 of file CGOpenMPRuntime.h.
std::string CGOpenMPRuntime::getName | ( | ArrayRef< StringRef > | Parts | ) | const |
Get the platform-specific name separator.
Definition at line 1086 of file CGOpenMPRuntime.cpp.
References FirstSeparator, Separator, and string().
Referenced by emitRequiresDirectiveRegFun().
|
protected |
Emit the number of teams for a target directive.
Inspect the num_teams clause associated with a teams construct combined or closely nested with the target directive.
Emit a team of size one for directives such as 'target parallel' that have no associated teams construct.
Otherwise, return nullptr.
Definition at line 6543 of file CGOpenMPRuntime.cpp.
References clang::CapturedStmt::getCapturedStmt(), clang::CodeGen::CodeGenFunction::getContext(), clang::OMPExecutableDirective::getDirectiveKind(), clang::OMPExecutableDirective::getInnermostCapturedStmt(), clang::Expr::getIntegerConstantExpr(), clang::OMPExecutableDirective::getSingleClause(), getSingleCompoundChild(), clang::OMPExecutableDirective::hasClausesOfKind(), clang::Stmt::IgnoreContainers(), clang::Expr::isIntegerConstantExpr(), clang::isOpenMPParallelDirective(), clang::isOpenMPSimdDirective(), clang::isOpenMPTargetExecutionDirective(), and clang::isOpenMPTeamsDirective().
Referenced by emitNumTeamsForTargetDirective().
|
protected |
Emit the number of threads for a target directive.
Inspect the thread_limit clause associated with a teams construct combined or closely nested with the target directive.
Emit the num_threads clause for directives such as 'target parallel' that have no associated teams construct.
Otherwise, return nullptr.
Definition at line 6806 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenFunction::getContext(), clang::OMPExecutableDirective::getDirectiveKind(), clang::OMPExecutableDirective::getSingleClause(), clang::OMPExecutableDirective::hasClausesOfKind(), and clang::isOpenMPTargetExecutionDirective().
|
inline |
Definition at line 305 of file CGOpenMPRuntime.h.
References OMPBuilder.
Referenced by clang::CodeGen::CGOpenMPRuntimeGPU::CGOpenMPRuntimeGPU(), createRuntimeShuffleFunction(), emitOMPAtomicCompareExpr(), emitParallelOrTeamsOutlinedFunction(), clang::CodeGen::CodeGenFunction::OMPBuilderCBHelpers::getAddressOfLocalVariable(), clang::CodeGen::CodeGenFunction::OMPBuilderCBHelpers::getAddrOfThreadPrivate(), and clang::CodeGen::CodeGenFunction::~CodeGenFunction().
llvm::Function * CGOpenMPRuntime::getOrCreateUserDefinedMapperFunc | ( | const OMPDeclareMapperDecl * | D | ) |
Get the function for the specified user-defined mapper.
If it does not exist, create one.
Definition at line 10170 of file CGOpenMPRuntime.cpp.
|
inlineprotectedvirtual |
Get the function name of an outlined region.
Reimplemented in clang::CodeGen::CGOpenMPRuntimeGPU.
Definition at line 385 of file CGOpenMPRuntime.h.
Referenced by emitParallelOutlinedFunction(), and emitTeamsOutlinedFunction().
|
virtual |
Gets the address of the native argument basing on the address of the target-specific parameter.
NativeParam | Parameter itself. |
TargetParam | Corresponding target-specific parameter. |
Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime, and clang::CodeGen::CGOpenMPRuntimeGPU.
Definition at line 12149 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenFunction::GetAddrOfLocalVar().
Referenced by emitOutlinedFunctionPrologue().
|
static |
Checks if the Body
is the CompoundStmt and returns its child statement iff there is only one that is not evaluatable at the compile time.
Definition at line 6501 of file CGOpenMPRuntime.cpp.
References clang::Stmt::IgnoreContainers().
Referenced by emitNumThreadsForTargetDirective(), getNumTeamsExprForTargetDirective(), getNumThreads(), hasNestedLightweightDirective(), and hasNestedSPMDDirective().
|
virtual |
Get the address of void *
type of the privatue copy of the reduction item specified by the SharedLVal
.
ReductionsPtr | Pointer to the reduction data returned by the emitTaskReductionInit function. |
SharedLVal | Address of the original reduction item. |
Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.
Definition at line 6096 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenFunction::Builder, CGM, clang::CodeGen::CGBuilderTy::CreatePointerBitCastOrAddrSpaceCast(), clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), clang::CodeGen::LValue::getAlignment(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::LValue::getPointer(), getThreadID(), clang::CodeGen::CodeGenTypeCache::Int8Ty, clang::CodeGen::CodeGenTypeCache::IntTy, OMPBuilder, and clang::CodeGen::CodeGenTypeCache::VoidPtrTy.
|
protected |
Gets thread id value for the current thread.
Definition at line 1394 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenFunction::AllocaInsertPt, clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::CapturedStmtInfo, CGM, clang::CodeGen::CodeGenFunction::CurFn, clang::CodeGen::CodeGenFunction::EHStack, clang::CodeGen::CodeGenFunction::EmitLoadOfScalar(), emitUpdateLocation(), getIdentStringFromSourceLocation(), clang::CodeGen::CodeGenModule::getLangOpts(), clang::CodeGen::CodeGenFunction::getLangOpts(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::LValue::getPointer(), clang::CodeGen::CodeGenTypeCache::getRuntimeCC(), OMPBuilder, clang::CodeGen::EHScopeStack::requiresLandingPad(), and setLocThreadIdInsertPt().
Referenced by clang::CodeGen::CGOpenMPRuntimeGPU::emitBarrierCall(), emitBarrierCall(), emitCancelCall(), emitCancellationPointCall(), emitCriticalRegion(), emitDepobjDependClause(), emitDestroyClause(), emitDistributeStaticInit(), emitDoacrossInit(), emitDoacrossOrdered(), emitForDispatchInit(), emitForNext(), emitForOrderedIterationEnd(), emitForStaticFinish(), emitForStaticInit(), emitMaskedRegion(), emitMasterRegion(), emitNumTeamsClause(), emitNumThreadsClause(), emitOrderedRegion(), clang::CodeGen::CGOpenMPRuntimeGPU::emitParallelCall(), emitParallelCall(), emitProcBindClause(), emitSingleRegion(), emitTaskCall(), emitTaskgroupRegion(), emitTaskLoopCall(), emitTaskOutlinedFunction(), emitTaskReductionFini(), emitTaskReductionInit(), emitTaskwaitCall(), emitTaskyieldCall(), emitThreadIDAddress(), getAddressOfLocalVariable(), getAddrOfThreadPrivate(), and getTaskReductionItem().
|
virtual |
Get combiner/initializer for the specified user-defined reduction, if any.
Definition at line 1179 of file CGOpenMPRuntime.cpp.
References emitUserDefinedReduction().
Referenced by emitInitWithReductionInitializer(), and emitReductionCombiner().
Checks if the variable has associated OMPAllocateDeclAttr attribute with the predefined allocator and translates it into the corresponding address space.
Reimplemented in clang::CodeGen::CGOpenMPRuntimeGPU.
Definition at line 10911 of file CGOpenMPRuntime.cpp.
References clang::Default, clang::Decl::getAttr(), and clang::Decl::hasAttr().
bool CGOpenMPRuntime::hasRequiresUnifiedSharedMemory | ( | ) | const |
Return whether the unified_shared_memory has been specified.
Definition at line 10936 of file CGOpenMPRuntime.cpp.
Referenced by createOffloadEntriesAndInfoMetadata(), emitDeclTargetVarDeclLValue(), and clang::CodeGen::CodeGenModule::EmitGlobal().
|
inlineprotectedvirtual |
Check if the default location must be constant.
Default is false to support OMPT/OMPD.
Reimplemented in clang::CodeGen::CGOpenMPRuntimeGPU.
Definition at line 402 of file CGOpenMPRuntime.h.
|
virtual |
Check if the specified ScheduleKind is dynamic.
This kind of worksharing directive is emitted without outer loop.
ScheduleKind | Schedule Kind specified in the 'schedule' clause. |
Definition at line 2641 of file CGOpenMPRuntime.cpp.
References getRuntimeSchedule().
bool CGOpenMPRuntime::isLocalVarInUntiedTask | ( | CodeGenFunction & | CGF, |
const VarDecl * | VD | ||
) | const |
Returns true if the variable is a local variable in untied task.
Definition at line 12297 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenFunction::CurFn.
Checks if the VD
variable is marked as nontemporal declaration in current context.
Definition at line 12355 of file CGOpenMPRuntime.cpp.
References CGM, clang::CodeGen::CodeGenModule::getLangOpts(), and clang::CodeGen::CodeGenModule::getOpenMPRuntime().
Referenced by clang::CodeGen::CodeGenFunction::EmitDeclRefLValue(), and clang::CodeGen::CodeGenFunction::EmitMemberExpr().
|
virtual |
Check if the specified ScheduleKind is static non-chunked.
ScheduleKind | Schedule kind specified in the 'dist_schedule' clause. |
Chunked | True if chunk is specified in the clause. |
Definition at line 2635 of file CGOpenMPRuntime.cpp.
References getRuntimeSchedule().
|
virtual |
Check if the specified ScheduleKind is static chunked.
ScheduleKind | Schedule kind specified in the 'schedule' clause. |
Chunked | True if chunk is specified in the clause. |
Definition at line 2628 of file CGOpenMPRuntime.cpp.
References getRuntimeSchedule().
|
virtual |
Check if the specified ScheduleKind is static non-chunked.
This kind of distribute directive is emitted without outer loop.
ScheduleKind | Schedule kind specified in the 'dist_schedule' clause. |
Chunked | True if chunk is specified in the clause. |
Definition at line 2622 of file CGOpenMPRuntime.cpp.
References getRuntimeSchedule().
|
virtual |
Check if the specified ScheduleKind is static non-chunked.
This kind of worksharing directive is emitted without outer loop.
ScheduleKind | Schedule kind specified in the 'schedule' clause. |
Chunked | True if chunk is specified in the clause. |
Definition at line 2615 of file CGOpenMPRuntime.cpp.
References getRuntimeSchedule().
bool CGOpenMPRuntime::markAsGlobalTarget | ( | GlobalDecl | GD | ) |
Marks the declaration as already emitted for the device code and returns true, if it was marked already, and false, otherwise.
Definition at line 10954 of file CGOpenMPRuntime.cpp.
References CGM, clang::GlobalDecl::getDecl(), clang::CodeGen::CodeGenModule::GetGlobalValue(), clang::CodeGen::CodeGenModule::getLangOpts(), and clang::CodeGen::CodeGenModule::getMangledName().
|
virtual |
Perform check on requires decl to ensure that target architecture supports unified addressing.
Reimplemented in clang::CodeGen::CGOpenMPRuntimeGPU.
Definition at line 10884 of file CGOpenMPRuntime.cpp.
References clang::OMPRequiresDecl::clauselists(), and clang::OMPC_ATOMIC_DEFAULT_MEM_ORDER_unknown.
Referenced by clang::CodeGen::CodeGenModule::EmitOMPRequiresDecl().
|
virtual |
Checks if the provided global decl GD is a declare target variable and registers it when emitting code for the host.
Definition at line 10769 of file CGOpenMPRuntime.cpp.
References clang::VarDecl::DeclarationOnly, getName(), clang::ValueDecl::getType(), clang::VarDecl::hasDefinition(), clang::InternalLinkage, clang::NamedDecl::isExternallyVisible(), clang::CharUnits::isZero(), string(), and clang::CharUnits::Zero().
Referenced by getAddrOfDeclareTargetVar().
|
protected |
Definition at line 1332 of file CGOpenMPRuntime.cpp.
References clang::CodeGen::CodeGenFunction::AllocaInsertPt, clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::CurFn, and clang::CodeGen::CodeGenTypeCache::Int32Ty.
Referenced by getThreadID().
|
inlinevirtual |
Translates the native parameter of outlined function if this is required for target.
FD | Field decl from captured record for the parameter. |
NativeParam | Parameter itself. |
Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime, and clang::CodeGen::CGOpenMPRuntimeGPU.
Definition at line 1767 of file CGOpenMPRuntime.h.
Referenced by emitOutlinedFunctionPrologue().
|
protected |
Definition at line 308 of file CGOpenMPRuntime.h.
Referenced by CGOpenMPRuntime(), clang::CodeGen::CGOpenMPRuntimeGPU::CGOpenMPRuntimeGPU(), clang::CodeGen::CGOpenMPRuntimeGPU::clear(), createOffloadEntriesAndInfoMetadata(), emitAArch64DeclareSimdFunction(), clang::CodeGen::CGOpenMPRuntimeGPU::emitBarrierCall(), emitBarrierCall(), emitCancelCall(), emitCancellationPointCall(), clang::CodeGen::CGOpenMPRuntimeGPU::emitCriticalRegion(), emitCriticalRegion(), emitDeclareSimdFunction(), emitDeclareTargetVarDefinition(), emitDependClause(), emitDepobjDependClause(), emitDestroyClause(), emitDistributeStaticInit(), emitDoacrossInit(), emitDoacrossOrdered(), emitFlush(), emitForDispatchInit(), emitForStaticFinish(), clang::CodeGen::CGOpenMPRuntimeGPU::emitFunctionProlog(), emitLastprivateConditionalFinalUpdate(), emitLastprivateConditionalInit(), emitMaskedRegion(), emitMasterRegion(), emitNumTeamsClause(), emitNumThreadsClause(), emitOrderedRegion(), clang::CodeGen::CGOpenMPRuntimeGPU::emitParallelCall(), emitParallelCall(), emitParallelOutlinedFunction(), emitProcBindClause(), emitReductionFunction(), emitRequiresDirectiveRegFun(), emitSingleRegion(), emitTargetDataCalls(), emitTargetDataStandAloneCall(), emitTargetOutlinedFunctionHelper(), emitTaskCall(), emitTaskgroupRegion(), emitTaskLoopCall(), emitTaskOutlinedFunction(), emitTaskReductionFini(), emitTaskReductionFixups(), emitTaskReductionInit(), emitTaskwaitCall(), emitTaskyieldCall(), emitTeamsCall(), clang::CodeGen::CGOpenMPRuntimeGPU::emitTeamsOutlinedFunction(), emitTeamsOutlinedFunction(), emitThreadPrivateVarDefinition(), emitUpdateClause(), emitUpdateLocation(), emitUserDefinedReduction(), clang::CodeGen::CGOpenMPRuntimeGPU::getAddressOfLocalVariable(), getAddressOfLocalVariable(), getAddrOfDeclareTargetVar(), getAddrOfThreadPrivate(), clang::CodeGen::CGOpenMPRuntimeGPU::getGPUThreadID(), clang::CodeGen::CGOpenMPRuntimeGPU::getGPUWarpSize(), getTaskReductionItem(), getThreadID(), isNontemporalDecl(), markAsGlobalTarget(), clang::CodeGen::CGOpenMPRuntimeGPU::processRequiresDirective(), clang::CodeGen::CGOpenMPRuntimeGPU::translateParameter(), clang::CodeGen::CGOpenMPRuntime::DisableAutoDeclareTargetRAII::~DisableAutoDeclareTargetRAII(), clang::CodeGen::CGOpenMPRuntime::LastprivateConditionalRAII::~LastprivateConditionalRAII(), clang::CodeGen::CGOpenMPRuntime::NontemporalDeclsRAII::~NontemporalDeclsRAII(), and clang::CodeGen::CGOpenMPRuntime::UntiedTaskLocalDeclsRAII::~UntiedTaskLocalDeclsRAII().
|
protected |
Definition at line 309 of file CGOpenMPRuntime.h.
Referenced by getName().
|
protected |
An OpenMP-IR-Builder instance.
Definition at line 312 of file CGOpenMPRuntime.h.
Referenced by CGOpenMPRuntime(), clang::CodeGen::CGOpenMPRuntimeGPU::CGOpenMPRuntimeGPU(), createOffloadEntry(), clang::CodeGen::CGOpenMPRuntimeGPU::emitBarrierCall(), emitBarrierCall(), emitCancelCall(), emitCancellationPointCall(), clang::CodeGen::CGOpenMPRuntimeGPU::emitCriticalRegion(), emitCriticalRegion(), emitDoacrossInit(), emitDoacrossOrdered(), emitFlush(), emitForStaticFinish(), emitMaskedRegion(), emitMasterRegion(), emitNumTeamsClause(), emitNumThreadsClause(), emitOrderedRegion(), clang::CodeGen::CGOpenMPRuntimeGPU::emitParallelCall(), emitParallelCall(), emitProcBindClause(), emitRequiresDirectiveRegFun(), emitSingleRegion(), emitTargetDataCalls(), emitTargetDataStandAloneCall(), emitTaskCall(), emitTaskgroupRegion(), emitTaskLoopCall(), emitTaskOutlinedFunction(), emitTaskReductionFini(), emitTaskReductionInit(), emitTaskwaitCall(), emitTaskyieldCall(), emitTeamsCall(), emitUpdateLocation(), getAddrOfThreadPrivate(), clang::CodeGen::CGOpenMPRuntimeGPU::getGPUThreadID(), clang::CodeGen::CGOpenMPRuntimeGPU::getGPUWarpSize(), getIdentTyPointerTy(), getOMPBuilder(), getTaskReductionItem(), and getThreadID().
|
protected |
Definition at line 309 of file CGOpenMPRuntime.h.
Referenced by getName().