clang  14.0.0git
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
clang::CodeGen::CGOpenMPRuntime Class Reference

#include "/home/buildbot/as-worker-4/publish-doxygen-docs/llvm-project/clang/lib/CodeGen/CGOpenMPRuntime.h"

Inheritance diagram for clang::CodeGen::CGOpenMPRuntime:
Inheritance graph
[legend]
Collaboration diagram for clang::CodeGen::CGOpenMPRuntime:
Collaboration graph
[legend]

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)
 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::ValueemitForNext (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 *ArgsType, 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::ValueemitTaskReductionInit (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)
 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 VarDecltranslateParameter (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 *, AddressemitDependClause (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 StmtgetSingleCompoundChild (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::ValueemitUpdateLocation (CodeGenFunction &CGF, SourceLocation Loc, unsigned Flags=0)
 Emits object of ident_t type with info for source location. More...
 
const ExprgetNumTeamsExprForTargetDirective (CodeGenFunction &CGF, const OMPExecutableDirective &D, int32_t &DefaultVal)
 Emit the number of teams for a target directive. More...
 
llvm::ValueemitNumTeamsForTargetDirective (CodeGenFunction &CGF, const OMPExecutableDirective &D)
 
const ExprgetNumThreadsExprForTargetDirective (CodeGenFunction &CGF, const OMPExecutableDirective &D, int32_t &DefaultVal)
 Emit the number of threads for a target directive. More...
 
llvm::ValueemitNumThreadsForTargetDirective (CodeGenFunction &CGF, const OMPExecutableDirective &D)
 
llvm::Type * getIdentTyPointerTy ()
 Returns pointer to ident_t type. More...
 
llvm::ValuegetThreadID (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::ValuegetCriticalRegionLock (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

CodeGenModuleCGM
 
StringRef FirstSeparator
 
StringRef Separator
 
llvm::OpenMPIRBuilder OMPBuilder
 An OpenMP-IR-Builder instance. More...
 

Detailed Description

Definition at line 225 of file CGOpenMPRuntime.h.

Constructor & Destructor Documentation

◆ CGOpenMPRuntime() [1/2]

CGOpenMPRuntime::CGOpenMPRuntime ( CodeGenModule CGM,
StringRef  FirstSeparator,
StringRef  Separator 
)
explicitprotected

Constructor allowing to redefine the name separator for the variables.

Definition at line 1079 of file CGOpenMPRuntime.cpp.

References CGM, clang::CodeGen::CodeGenTypeCache::Int32Ty, and OMPBuilder.

◆ CGOpenMPRuntime() [2/2]

clang::CodeGen::CGOpenMPRuntime::CGOpenMPRuntime ( CodeGenModule CGM)
inlineexplicit

Definition at line 921 of file CGOpenMPRuntime.h.

◆ ~CGOpenMPRuntime()

virtual clang::CodeGen::CGOpenMPRuntime::~CGOpenMPRuntime ( )
inlinevirtual

Definition at line 923 of file CGOpenMPRuntime.h.

Member Function Documentation

◆ adjustTargetSpecificDataForLambdas()

void CGOpenMPRuntime::adjustTargetSpecificDataForLambdas ( CodeGenFunction CGF,
const OMPExecutableDirective D 
) const
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 10959 of file CGOpenMPRuntime.cpp.

References clang::OMPExecutableDirective::getDirectiveKind(), and clang::isOpenMPTargetExecutionDirective().

◆ checkAndEmitLastprivateConditional()

void CGOpenMPRuntime::checkAndEmitLastprivateConditional ( CodeGenFunction CGF,
const Expr LHS 
)
virtual

◆ checkAndEmitSharedLastprivateConditional()

void CGOpenMPRuntime::checkAndEmitSharedLastprivateConditional ( CodeGenFunction CGF,
const OMPExecutableDirective D,
const llvm::DenseSet< CanonicalDeclPtr< const VarDecl >> &  IgnoredDecls 
)
virtual

Checks if the lastprivate conditional was updated in inner region and writes the value.

lastprivate(conditional: a)
...
<type> a;bool Fired = false;
#pragma omp ... shared(a)
{
lp_a = ...;
Fired = true;
}
if (Fired) {
#pragma omp critical(a)
if (last_iv_a <= iv) {
last_iv_a = iv;
global_a = lp_a;
}
Fired = false;
}

Definition at line 12767 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().

◆ clear()

void CGOpenMPRuntime::clear ( )
virtual

◆ clearLocThreadIdInsertPt()

void CGOpenMPRuntime::clearLocThreadIdInsertPt ( CodeGenFunction CGF)
protected

Definition at line 1414 of file CGOpenMPRuntime.cpp.

References clang::CodeGen::CodeGenFunction::CurFn.

Referenced by functionFinished().

◆ createOffloadEntriesAndInfoMetadata()

void CGOpenMPRuntime::createOffloadEntriesAndInfoMetadata ( )

◆ createOffloadEntry()

void CGOpenMPRuntime::createOffloadEntry ( llvm::Constant *  ID,
llvm::Constant *  Addr,
uint64_t  Size,
int32_t  Flags,
llvm::GlobalValue::LinkageTypes  Linkage 
)
protectedvirtual

Creates offloading entry for the provided entry ID ID, address Addr, size Size, and flags Flags.

Definition at line 3133 of file CGOpenMPRuntime.cpp.

Referenced by createOffloadEntriesAndInfoMetadata().

◆ emitBarrierCall()

void CGOpenMPRuntime::emitBarrierCall ( CodeGenFunction CGF,
SourceLocation  Loc,
OpenMPDirectiveKind  Kind,
bool  EmitChecks = true,
bool  ForceSimpleCall = false 
)
virtual

Emit an implicit/explicit barrier for OpenMP threads.

Parameters
KindDirective for which this implicit barrier call must be generated. Must be OMPD_barrier for explicit barrier generation.
EmitCheckstrue if need to emit checks for cancellation barriers.
ForceSimpleCalltrue 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 2578 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.

◆ emitCall()

void CGOpenMPRuntime::emitCall ( CodeGenFunction CGF,
SourceLocation  Loc,
llvm::FunctionCallee  Callee,
ArrayRef< llvm::Value * >  Args = llvm::None 
) const
protected

◆ emitCancelCall()

void CGOpenMPRuntime::emitCancelCall ( CodeGenFunction CGF,
SourceLocation  Loc,
const Expr IfCond,
OpenMPDirectiveKind  CancelRegion 
)
virtual

Emit code for 'cancel' construct.

Parameters
IfCondCondition in the associated 'if' clause, if it was specified, nullptr otherwise.
CancelRegionRegion kind for which the cancel must be emitted.

Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.

Definition at line 6366 of file CGOpenMPRuntime.cpp.

References clang::CodeGen::CodeGenFunction::CapturedStmtInfo, CGM, emitUpdateLocation(), getCancellationKind(), clang::CodeGen::CodeGenModule::getOpenMPRuntime(), getThreadID(), and clang::CodeGen::CodeGenFunction::HaveInsertPoint().

◆ emitCancellationPointCall()

void CGOpenMPRuntime::emitCancellationPointCall ( CodeGenFunction CGF,
SourceLocation  Loc,
OpenMPDirectiveKind  CancelRegion 
)
virtual

◆ emitCriticalRegion()

void CGOpenMPRuntime::emitCriticalRegion ( CodeGenFunction CGF,
StringRef  CriticalName,
const RegionCodeGenTy CriticalOpGen,
SourceLocation  Loc,
const Expr Hint = nullptr 
)
virtual

◆ emitDeclareSimdFunction()

void CGOpenMPRuntime::emitDeclareSimdFunction ( const FunctionDecl FD,
llvm::Function *  Fn 
)
virtual

◆ emitDeclareTargetVarDefinition()

bool CGOpenMPRuntime::emitDeclareTargetVarDefinition ( const VarDecl VD,
llvm::GlobalVariable *  Addr,
bool  PerformInit 
)
virtual

Emit a code for initialization of declare target variable.

Parameters
VDDeclare target variable.
AddrAddress of the global variable VD.
PerformInittrue if initialization expression is not constant.

Definition at line 1899 of file CGOpenMPRuntime.cpp.

References clang::CodeGen::CodeGenModule::addUsedGlobal(), clang::CodeGen::CodeGenTypes::arrangeNullaryFunction(), CGM, clang::CodeGen::ApplyDebugLocation::CreateArtificial(), clang::CodeGen::ApplyDebugLocation::CreateEmpty(), clang::CodeGen::CodeGenModule::CreateGlobalInitOrCleanUpFunction(), clang::QualType::DK_none, clang::CodeGen::CodeGenFunction::EmitAnyExprToMem(), clang::CodeGen::CodeGenFunction::emitDestroy(), clang::CodeGen::CodeGenFunction::FinishFunction(), clang::VarDecl::getAnyInitializer(), clang::DeclaratorDecl::getBeginLoc(), clang::VarDecl::getCanonicalDecl(), clang::CodeGen::CodeGenModule::getContext(), clang::ASTContext::getDeclAlign(), clang::VarDecl::getDefinition(), clang::CodeGen::CodeGenFunction::getDestroyer(), clang::CodeGen::CodeGenTypes::GetFunctionType(), clang::CodeGen::CodeGenModule::getLangOpts(), clang::CodeGen::CodeGenModule::getMangledName(), clang::CodeGen::CodeGenModule::getModule(), clang::NamedDecl::getName(), getTargetEntryUniqueInfo(), clang::ValueDecl::getType(), clang::CodeGen::CodeGenModule::getTypes(), clang::CodeGen::CodeGenTypeCache::Int8PtrTy, clang::CodeGen::CodeGenTypeCache::Int8Ty, clang::QualType::isDestructedType(), Line, clang::CodeGen::CodeGenFunction::needsEHCleanup(), clang::LangOptions::OMPTargetTriples, clang::CodeGen::CodeGenFunction::StartFunction(), and clang::ASTContext::VoidTy.

◆ emitDeferredTargetDecls()

void CGOpenMPRuntime::emitDeferredTargetDecls ( ) const

Emit deferred declare target variables marked for deferred emission.

Definition at line 10940 of file CGOpenMPRuntime.cpp.

References CGM, clang::CodeGen::CodeGenModule::EmitGlobal(), getAddrOfDeclareTargetVar(), and clang::CodeGen::CodeGenModule::getOpenMPRuntime().

◆ emitDependClause()

std::pair< llvm::Value *, Address > CGOpenMPRuntime::emitDependClause ( CodeGenFunction CGF,
ArrayRef< OMPTaskDataTy::DependData Dependencies,
SourceLocation  Loc 
)

◆ emitDepobjDependClause()

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.

Returns
Pointer to the first element of the array casted to VoidPtr type.

Definition at line 4985 of file CGOpenMPRuntime.cpp.

References clang::CharUnits::alignTo(), clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::OMPTaskDataTy::DependData::DepExprs, clang::CodeGen::CodeGenFunction::EmitScalarExpr(), getDependTypes(), clang::CodeGen::CodeGenTypeCache::IntPtrTy, clang::CodeGen::OMPTaskDataTy::DependData::IteratorExpr, clang::ArrayType::Normal, and clang::CodeGen::CodeGenTypeCache::SizeTy.

◆ emitDestroyClause()

void CGOpenMPRuntime::emitDestroyClause ( CodeGenFunction CGF,
LValue  DepobjLVal,
SourceLocation  Loc 
)

◆ emitDistributeStaticInit()

void CGOpenMPRuntime::emitDistributeStaticInit ( CodeGenFunction CGF,
SourceLocation  Loc,
OpenMPDistScheduleClauseKind  SchedKind,
const StaticRTInput Values 
)
virtual

◆ emitDoacrossInit()

void CGOpenMPRuntime::emitDoacrossInit ( CodeGenFunction CGF,
const OMPLoopDirective D,
ArrayRef< Expr * >  NumIterations 
)
virtual

Emit initialization for doacross loop nesting support.

Parameters
DLoop-based construct used in doacross nesting construct.

Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.

Definition at line 12072 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.

◆ emitDoacrossOrdered()

void CGOpenMPRuntime::emitDoacrossOrdered ( CodeGenFunction CGF,
const OMPDependClause C 
)
virtual

◆ emitFlush()

void CGOpenMPRuntime::emitFlush ( CodeGenFunction CGF,
ArrayRef< const Expr * >  Vars,
SourceLocation  Loc,
llvm::AtomicOrdering  AO 
)
virtual

◆ emitForDispatchInit()

void CGOpenMPRuntime::emitForDispatchInit ( CodeGenFunction CGF,
SourceLocation  Loc,
const OpenMPScheduleTy ScheduleKind,
unsigned  IVSize,
bool  IVSigned,
bool  Ordered,
const DispatchRTInput DispatchValues 
)
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.

Parameters
CGFReference to current CodeGenFunction.
LocClang source location.
ScheduleKindSchedule kind, specified by the 'schedule' clause.
IVSizeSize of the iteration variable in bits.
IVSignedSign of the iteration variable.
Orderedtrue if loop is ordered, false otherwise.
DispatchValuesstruct 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 2741 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.

◆ emitForNext()

llvm::Value * CGOpenMPRuntime::emitForNext ( CodeGenFunction CGF,
SourceLocation  Loc,
unsigned  IVSize,
bool  IVSigned,
Address  IL,
Address  LB,
Address  UB,
Address  ST 
)
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);.

Parameters
IVSizeSize of the iteration variable in bits.
IVSignedSign of the iteration variable.
ILAddress of the output variable in which the flag of the last iteration is returned.
LBAddress of the output variable in which the lower iteration number is returned.
UBAddress of the output variable in which the upper iteration number is returned.
STAddress of the output variable in which the stride value is returned.

Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.

Definition at line 2903 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().

◆ emitForOrderedIterationEnd()

void CGOpenMPRuntime::emitForOrderedIterationEnd ( CodeGenFunction CGF,
SourceLocation  Loc,
unsigned  IVSize,
bool  IVSigned 
)
virtual

Call the appropriate runtime routine to notify that we finished iteration of the ordered loop with the dynamic scheduling.

Parameters
CGFReference to current CodeGenFunction.
LocClang source location.
IVSizeSize of the iteration variable in bits.
IVSignedSign of the iteration variable.

Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.

Definition at line 2892 of file CGOpenMPRuntime.cpp.

References clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), emitUpdateLocation(), getThreadID(), and clang::CodeGen::CodeGenFunction::HaveInsertPoint().

◆ emitForStaticFinish()

void CGOpenMPRuntime::emitForStaticFinish ( CodeGenFunction CGF,
SourceLocation  Loc,
OpenMPDirectiveKind  DKind 
)
virtual

◆ emitForStaticInit()

void CGOpenMPRuntime::emitForStaticInit ( CodeGenFunction CGF,
SourceLocation  Loc,
OpenMPDirectiveKind  DKind,
const OpenMPScheduleTy ScheduleKind,
const StaticRTInput Values 
)
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.

Parameters
CGFReference to current CodeGenFunction.
LocClang source location.
DKindKind of the directive.
ScheduleKindSchedule kind, specified by the 'schedule' clause.
ValuesInput arguments for the construct.

Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.

Definition at line 2823 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.

◆ emitFunctionProlog()

void CGOpenMPRuntime::emitFunctionProlog ( CodeGenFunction CGF,
const Decl D 
)
virtual

Emits OpenMP-specific function prolog.

Required for device constructs.

Reimplemented in clang::CodeGen::CGOpenMPRuntimeGPU.

Definition at line 12197 of file CGOpenMPRuntime.cpp.

Referenced by clang::CodeGen::CodeGenFunction::StartFunction().

◆ emitIfClause()

void CGOpenMPRuntime::emitIfClause ( CodeGenFunction CGF,
const Expr Cond,
const RegionCodeGenTy ThenGen,
const RegionCodeGenTy ElseGen 
)

◆ emitInlinedDirective()

void CGOpenMPRuntime::emitInlinedDirective ( CodeGenFunction CGF,
OpenMPDirectiveKind  InnermostKind,
const RegionCodeGenTy CodeGen,
bool  HasCancel = false 
)
virtual

Emit code for the directive that does not require outlining.

Parameters
InnermostKindKind of innermost directive (for simple directives it is a directive itself, for combined - its innermost directive).
CodeGenCode generation sequence for the D directive.
HasCanceltrue if region has inner cancel directive, false otherwise.

Definition at line 6288 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(), emitTargetCall(), emitTargetDataStandAloneCall(), and emitTaskgroupRegion().

◆ emitLastprivateConditionalFinalUpdate()

void CGOpenMPRuntime::emitLastprivateConditionalFinalUpdate ( CodeGenFunction CGF,
LValue  PrivLVal,
const VarDecl VD,
SourceLocation  Loc 
)
virtual

◆ emitLastprivateConditionalInit()

Address CGOpenMPRuntime::emitLastprivateConditionalInit ( CodeGenFunction CGF,
const VarDecl VD 
)

◆ emitMaskedRegion()

void CGOpenMPRuntime::emitMaskedRegion ( CodeGenFunction CGF,
const RegionCodeGenTy MaskedOpGen,
SourceLocation  Loc,
const Expr Filter = nullptr 
)
virtual

◆ emitMasterRegion()

void CGOpenMPRuntime::emitMasterRegion ( CodeGenFunction CGF,
const RegionCodeGenTy MasterOpGen,
SourceLocation  Loc 
)
virtual

Emits a master region.

Parameters
MasterOpGenGenerator for the statement associated with the given master region.

Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.

Definition at line 2273 of file CGOpenMPRuntime.cpp.

References CGM, emitInlinedDirective(), emitUpdateLocation(), clang::CodeGen::CodeGenModule::getModule(), getThreadID(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), OMPBuilder, and clang::CodeGen::RegionCodeGenTy::setAction().

◆ emitNumTeamsClause()

void CGOpenMPRuntime::emitNumTeamsClause ( CodeGenFunction CGF,
const Expr NumTeams,
const Expr ThreadLimit,
SourceLocation  Loc 
)
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.

Parameters
NumTeamsAn integer expression of teams.
ThreadLimitAn integer expression of threads.

Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime, and clang::CodeGen::CGOpenMPRuntimeGPU.

Definition at line 11122 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.

◆ emitNumTeamsForTargetDirective()

llvm::Value * CGOpenMPRuntime::emitNumTeamsForTargetDirective ( CodeGenFunction CGF,
const OMPExecutableDirective D 
)
protected

◆ emitNumThreadsClause()

void CGOpenMPRuntime::emitNumThreadsClause ( CodeGenFunction CGF,
llvm::Value NumThreads,
SourceLocation  Loc 
)
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.

Parameters
NumThreadsAn integer value of threads.

Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime, and clang::CodeGen::CGOpenMPRuntimeGPU.

Definition at line 2927 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.

Referenced by clang::CodeGen::CGOpenMPRuntimeGPU::emitNumThreadsClause().

◆ emitNumThreadsForTargetDirective()

llvm::Value * CGOpenMPRuntime::emitNumThreadsForTargetDirective ( CodeGenFunction CGF,
const OMPExecutableDirective D 
)
protected

◆ emitOrderedRegion()

void CGOpenMPRuntime::emitOrderedRegion ( CodeGenFunction CGF,
const RegionCodeGenTy OrderedOpGen,
SourceLocation  Loc,
bool  IsThreads 
)
virtual

Emit an ordered region.

Parameters
OrderedOpGenGenerator for the statement associated with the given ordered region.

Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.

Definition at line 2521 of file CGOpenMPRuntime.cpp.

References CGM, emitInlinedDirective(), emitUpdateLocation(), clang::CodeGen::CodeGenModule::getModule(), getThreadID(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), OMPBuilder, and clang::CodeGen::RegionCodeGenTy::setAction().

◆ emitOutlinedFunctionCall()

void CGOpenMPRuntime::emitOutlinedFunctionCall ( CodeGenFunction CGF,
SourceLocation  Loc,
llvm::FunctionCallee  OutlinedFn,
ArrayRef< llvm::Value * >  Args = llvm::None 
) const
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 12191 of file CGOpenMPRuntime.cpp.

References emitCall().

Referenced by emitGlobalToListReduceFunction(), emitListToGlobalReduceFunction(), clang::CodeGen::CGOpenMPRuntimeGPU::emitOutlinedFunctionCall(), emitParallelCall(), emitShuffleAndReduceFunction(), and emitTargetCall().

◆ emitParallelCall()

void CGOpenMPRuntime::emitParallelCall ( CodeGenFunction CGF,
SourceLocation  Loc,
llvm::Function *  OutlinedFn,
ArrayRef< llvm::Value * >  CapturedVars,
const Expr IfCond 
)
virtual

Emits code for parallel or serial call of the OutlinedFn with variables captured in a record which address is stored in CapturedStruct.

Parameters
OutlinedFnOutlined function to be run in parallel threads. Type of this function is void(*)(kmp_int32 *, kmp_int32, struct context_vars*).
CapturedVarsA pointer to the record with the references to variables used in OutlinedFn function.
IfCondCondition in the associated 'if' clause, if it was specified, nullptr otherwise.

Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime, and clang::CodeGen::CGOpenMPRuntimeGPU.

Definition at line 2084 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.

◆ emitParallelOutlinedFunction()

llvm::Function * CGOpenMPRuntime::emitParallelOutlinedFunction ( const OMPExecutableDirective D,
const VarDecl ThreadIDVar,
OpenMPDirectiveKind  InnermostKind,
const RegionCodeGenTy CodeGen 
)
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).

Parameters
DOpenMP directive.
ThreadIDVarVariable for thread id in the current OpenMP region.
InnermostKindKind of innermost directive (for simple directives it is a directive itself, for combined - its innermost directive).
CodeGenCode generation sequence for the D directive.

Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime, and clang::CodeGen::CGOpenMPRuntimeGPU.

Definition at line 1290 of file CGOpenMPRuntime.cpp.

References CGM, emitParallelOrTeamsOutlinedFunction(), clang::OMPExecutableDirective::getCapturedStmt(), and getOutlinedHelperName().

Referenced by clang::CodeGen::CGOpenMPRuntimeGPU::emitParallelOutlinedFunction().

◆ emitProcBindClause()

void CGOpenMPRuntime::emitProcBindClause ( CodeGenFunction CGF,
llvm::omp::ProcBindKind  ProcBind,
SourceLocation  Loc 
)
virtual

◆ emitReduction()

void CGOpenMPRuntime::emitReduction ( CodeGenFunction CGF,
SourceLocation  Loc,
ArrayRef< const Expr * >  Privates,
ArrayRef< const Expr * >  LHSExprs,
ArrayRef< const Expr * >  RHSExprs,
ArrayRef< const Expr * >  ReductionOps,
ReductionOptionsTy  Options 
)
virtual

Emit a code for reduction clause.

Next code should be emitted for reduction:

static kmp_critical_name lock = { 0 };
void reduce_func(void *lhs[<n>], void *rhs[<n>]) {
...
*(Type<i>*)lhs[i] = RedOp<i>(*(Type<i>*)lhs[i], *(Type<i>*)rhs[i]);
...
}
...
void *RedList[<n>] = {&<RHSExprs>[0], ..., &<RHSExprs>[<n>-1]};
switch (__kmpc_reduce{_nowait}(<loc>, <gtid>, <n>, sizeof(RedList),
RedList, reduce_func, &<lock>)) {
case 1:
...
<LHSExprs>[i] = RedOp<i>(*<LHSExprs>[i], *<RHSExprs>[i]);
...
__kmpc_end_reduce{_nowait}(<loc>, <gtid>, &<lock>);
break;
case 2:
...
Atomic(<LHSExprs>[i] = RedOp<i>(*<LHSExprs>[i], *<RHSExprs>[i]));
...
break;
default:;
}
Parameters
PrivatesList of private copies for original reduction arguments.
LHSExprsList of LHS in ReductionOps reduction operations.
RHSExprsList of RHS in ReductionOps reduction operations.
ReductionOpsList of reduction operations in form 'LHS binop RHS' or 'operator binop(LHS, RHS)'.
OptionsList 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 5562 of file CGOpenMPRuntime.cpp.

◆ emitReductionFunction()

llvm::Function * CGOpenMPRuntime::emitReductionFunction ( SourceLocation  Loc,
llvm::Type *  ArgsType,
ArrayRef< const Expr * >  Privates,
ArrayRef< const Expr * >  LHSExprs,
ArrayRef< const Expr * >  RHSExprs,
ArrayRef< const Expr * >  ReductionOps 
)

Emits reduction function.

Parameters
ArgsTypeArray type containing pointers to reduction variables.
PrivatesList of private copies for original reduction arguments.
LHSExprsList of LHS in ReductionOps reduction operations.
RHSExprsList of RHS in ReductionOps reduction operations.
ReductionOpsList of reduction operations in form 'LHS binop RHS' or 'operator binop(LHS, RHS)'.

Definition at line 5450 of file CGOpenMPRuntime.cpp.

References clang::ImplicitParamDecl::Other, and string().

◆ emitRequiresDirectiveRegFun()

llvm::Function * CGOpenMPRuntime::emitRequiresDirectiveRegFun ( )

◆ emitSingleReductionCombiner()

void CGOpenMPRuntime::emitSingleReductionCombiner ( CodeGenFunction CGF,
const Expr ReductionOp,
const Expr PrivateRef,
const DeclRefExpr LHS,
const DeclRefExpr RHS 
)

◆ emitSingleRegion()

void CGOpenMPRuntime::emitSingleRegion ( CodeGenFunction CGF,
const RegionCodeGenTy SingleOpGen,
SourceLocation  Loc,
ArrayRef< const Expr * >  CopyprivateVars,
ArrayRef< const Expr * >  DestExprs,
ArrayRef< const Expr * >  SrcExprs,
ArrayRef< const Expr * >  AssignmentOps 
)
virtual

◆ emitTargetCall()

void CGOpenMPRuntime::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 
)
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.

Parameters
DDirective to emit.
OutlinedFnHost version of the code to be offloaded.
OutlinedFnIDID of host version of the code to be offloaded.
IfCondExpression evaluated in if clause associated with the target directive, or null if no if clause is used.
DeviceExpression evaluated in device clause associated with the target directive, or null if no device clause is used and device modifier.
SizeEmitterCallback to emit number of iterations for loop-based directives.

Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.

Definition at line 10293 of file CGOpenMPRuntime.cpp.

References clang::CodeGen::CGOpenMPRuntime::TargetDataInfo::BasePointersArray, clang::CapturedStmt::Capture::capturesThis(), clang::CapturedStmt::Capture::capturesVariable(), clang::CapturedStmt::Capture::capturesVariableArrayType(), CGM, emitIfClause(), emitInlinedDirective(), emitNumTeamsForTargetDirective(), emitNumThreadsForTargetDirective(), emitOffloadingArrays(), emitOffloadingArraysArgument(), emitOutlinedFunctionCall(), emitUpdateLocation(), clang::OMPExecutableDirective::getCapturedStmt(), clang::CapturedStmt::Capture::getCapturedVar(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::CodeGenTypeCache::getPointerAlign(), 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, OMPBuilder, clang::OMPC_DEVICE_unknown, clang::CodeGen::CGOpenMPRuntime::TargetDataInfo::PointersArray, clang::CodeGen::CGOpenMPRuntime::TargetDataInfo::SizesArray, and clang::CodeGen::CodeGenTypeCache::VoidPtrTy.

◆ emitTargetDataCalls()

void CGOpenMPRuntime::emitTargetDataCalls ( CodeGenFunction CGF,
const OMPExecutableDirective D,
const Expr IfCond,
const Expr Device,
const RegionCodeGenTy CodeGen,
TargetDataInfo Info 
)
virtual

Emit the target data mapping code associated with D.

Parameters
DDirective to emit.
IfCondExpression evaluated in if clause associated with the target directive, or null if no device clause is used.
DeviceExpression evaluated in device clause associated with the target directive, or null if no device clause is used.
InfoA record used to store information that needs to be preserved until the region is closed.

Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.

Definition at line 11151 of file CGOpenMPRuntime.cpp.

References CGM, emitIfClause(), emitOffloadingArrays(), emitOffloadingArraysArgument(), emitUpdateLocation(), clang::OMPExecutableDirective::getBeginLoc(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), and OMPBuilder.

◆ emitTargetDataStandAloneCall()

void CGOpenMPRuntime::emitTargetDataStandAloneCall ( CodeGenFunction CGF,
const OMPExecutableDirective D,
const Expr IfCond,
const Expr Device 
)
virtual

◆ emitTargetFunctions()

bool CGOpenMPRuntime::emitTargetFunctions ( GlobalDecl  GD)
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.

Parameters
GDFunction to scan.

Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.

Definition at line 10786 of file CGOpenMPRuntime.cpp.

References CGM, clang::GlobalDecl::getDecl(), clang::CodeGen::CodeGenModule::getLangOpts(), and isAssumedToBeNotEmitted().

Referenced by emitTargetGlobal().

◆ emitTargetGlobal()

bool CGOpenMPRuntime::emitTargetGlobal ( GlobalDecl  GD)
virtual

Emit the global GD if it is meaningful for the target.

Returns if it was emitted successfully.

Parameters
GDGlobal to scan.

Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.

Definition at line 10932 of file CGOpenMPRuntime.cpp.

References emitTargetFunctions(), emitTargetGlobalVariable(), and clang::GlobalDecl::getDecl().

◆ emitTargetGlobalVariable()

bool CGOpenMPRuntime::emitTargetGlobalVariable ( GlobalDecl  GD)
virtual

◆ emitTargetOutlinedFunction()

void CGOpenMPRuntime::emitTargetOutlinedFunction ( const OMPExecutableDirective D,
StringRef  ParentName,
llvm::Function *&  OutlinedFn,
llvm::Constant *&  OutlinedFnID,
bool  IsOffloadEntry,
const RegionCodeGenTy CodeGen 
)
virtual

Emit outilined function for 'target' directive.

Parameters
DDirective to emit.
ParentNameName of the function that encloses the target region.
OutlinedFnOutlined function value to be defined by this call.
OutlinedFnIDOutlined function ID value to be defined by this call.
IsOffloadEntryTrue if the outlined function is an offload entry.
CodeGenCode 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 6440 of file CGOpenMPRuntime.cpp.

References clang::OMPUsesAllocatorsClause::Data::Allocator, clang::OMPUsesAllocatorsClause::Data::AllocatorTraits, clang::OMPExecutableDirective::getClausesOfKind(), and clang::CodeGen::RegionCodeGenTy::setAction().

◆ emitTargetOutlinedFunctionHelper()

void CGOpenMPRuntime::emitTargetOutlinedFunctionHelper ( const OMPExecutableDirective D,
StringRef  ParentName,
llvm::Function *&  OutlinedFn,
llvm::Constant *&  OutlinedFnID,
bool  IsOffloadEntry,
const RegionCodeGenTy CodeGen 
)
protectedvirtual

Helper to emit outlined function for 'target' directive.

Parameters
DDirective to emit.
ParentNameName of the function that encloses the target region.
OutlinedFnOutlined function value to be defined by this call.
OutlinedFnIDOutlined function ID value to be defined by this call.
IsOffloadEntryTrue if the outlined function is an offload entry.
CodeGenLambda 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 6512 of file CGOpenMPRuntime.cpp.

References clang::CodeGen::CodeGenFunction::GenerateOpenMPCapturedStmtFunction(), clang::OMPExecutableDirective::getBeginLoc(), clang::OMPExecutableDirective::getCapturedStmt(), getTargetEntryUniqueInfo(), Line, and string().

◆ emitTaskCall()

void CGOpenMPRuntime::emitTaskCall ( CodeGenFunction CGF,
SourceLocation  Loc,
const OMPExecutableDirective D,
llvm::Function *  TaskFunction,
QualType  SharedsTy,
Address  Shareds,
const Expr IfCond,
const OMPTaskDataTy Data 
)
virtual

Emit task region for the task directive.

The task region is emitted in several steps:

  1. Emit a call to kmp_task_t *__kmpc_omp_task_alloc(ident_t *, kmp_int32 gtid, kmp_int32 flags, size_t sizeof_kmp_task_t, size_t sizeof_shareds, kmp_routine_entry_t *task_entry). Here task_entry is a pointer to the function: kmp_int32 .omp_task_entry.(kmp_int32 gtid, kmp_task_t *tt) { TaskFunction(gtid, tt->part_id, tt->shareds); return 0; }
  2. Copy a list of shared variables to field shareds of the resulting structure kmp_task_t returned by the previous call (if any).
  3. Copy a pointer to destructions function to field destructions of the resulting structure kmp_task_t.
  4. Emit a call to kmp_int32 __kmpc_omp_task(ident_t *, kmp_int32 gtid, kmp_task_t *new_task), where new_task is a resulting structure from previous items.
    Parameters
    DCurrent task directive.
    TaskFunctionAn LLVM function with type void (*)(i32 /*gtid*‍/, i32 /*part_id*‍/, captured_struct ‍/__context*‍/);
    SharedsTyA type which contains references the shared variables.
    SharedsContext with the list of shared variables from the TaskFunction.
    IfCondNot a nullptr if 'if' clause was specified, nullptr otherwise.
    DataAdditional data for task generation like tiednsee, final state, list of privates etc.

Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.

Definition at line 5142 of file CGOpenMPRuntime.cpp.

References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::OMPTaskDataTy::Dependences, clang::CodeGen::Address::getPointer(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), clang::CodeGen::RegionCodeGenTy::setAction(), clang::CodeGen::OMPTaskDataTy::Tied, and clang::CodeGen::CodeGenTypeCache::VoidPtrTy.

◆ emitTaskgroupRegion()

void CGOpenMPRuntime::emitTaskgroupRegion ( CodeGenFunction CGF,
const RegionCodeGenTy TaskgroupOpGen,
SourceLocation  Loc 
)
virtual

Emit a taskgroup region.

Parameters
TaskgroupOpGenGenerator for the statement associated with the given taskgroup region.

Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.

Definition at line 2345 of file CGOpenMPRuntime.cpp.

References CGM, emitInlinedDirective(), emitUpdateLocation(), clang::CodeGen::CodeGenModule::getModule(), getThreadID(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), OMPBuilder, and clang::CodeGen::RegionCodeGenTy::setAction().

◆ emitTaskLoopCall()

void CGOpenMPRuntime::emitTaskLoopCall ( CodeGenFunction CGF,
SourceLocation  Loc,
const OMPLoopDirective D,
llvm::Function *  TaskFunction,
QualType  SharedsTy,
Address  Shareds,
const Expr IfCond,
const OMPTaskDataTy Data 
)
virtual

Emit task region for the taskloop directive.

The taskloop region is emitted in several steps:

  1. Emit a call to kmp_task_t *__kmpc_omp_task_alloc(ident_t *, kmp_int32 gtid, kmp_int32 flags, size_t sizeof_kmp_task_t, size_t sizeof_shareds, kmp_routine_entry_t *task_entry). Here task_entry is a pointer to the function: kmp_int32 .omp_task_entry.(kmp_int32 gtid, kmp_task_t *tt) { TaskFunction(gtid, tt->part_id, tt->shareds); return 0; }
  2. Copy a list of shared variables to field shareds of the resulting structure kmp_task_t returned by the previous call (if any).
  3. Copy a pointer to destructions function to field destructions of the resulting structure kmp_task_t.
  4. Emit a call to void __kmpc_taskloop(ident_t *loc, int gtid, kmp_task_t *task, int if_val, kmp_uint64 *lb, kmp_uint64 *ub, kmp_int64 st, int nogroup, int sched, kmp_uint64 grainsize, void *task_dup ), where new_task is a resulting structure from previous items.
    Parameters
    DCurrent task directive.
    TaskFunctionAn LLVM function with type void (*)(i32 /*gtid*‍/, i32 /*part_id*‍/, captured_struct ‍/__context*‍/);
    SharedsTyA type which contains references the shared variables.
    SharedsContext with the list of shared variables from the TaskFunction.
    IfCondNot a nullptr if 'if' clause was specified, nullptr otherwise.
    DataAdditional data for task generation like tiednsee, final state, list of privates etc.

Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.

Definition at line 5260 of file CGOpenMPRuntime.cpp.

References clang::CodeGen::CodeGenFunction::Builder, 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(), clang::CodeGen::CodeGenFunction::EvaluateExprAsBool(), clang::CodeGen::LValue::getAddress(), clang::CodeGen::CodeGenFunction::getContext(), clang::OMPLoopDirective::getLowerBoundVariable(), clang::CodeGen::LValue::getPointer(), clang::CodeGen::LValue::getQuals(), clang::OMPLoopDirective::getStrideVariable(), clang::OMPLoopDirective::getUpperBoundVariable(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), clang::CodeGen::CodeGenTypeCache::Int64Ty, clang::CodeGen::CodeGenTypeCache::IntTy, clang::CodeGen::OMPTaskDataTy::Reductions, clang::CodeGen::OMPTaskDataTy::Schedule, clang::CodeGen::CodeGenTypeCache::VoidPtrTy, and clang::ASTContext::VoidPtrTy.

◆ emitTaskOutlinedFunction()

llvm::Function * CGOpenMPRuntime::emitTaskOutlinedFunction ( const OMPExecutableDirective D,
const VarDecl ThreadIDVar,
const VarDecl PartIDVar,
const VarDecl TaskTVar,
OpenMPDirectiveKind  InnermostKind,
const RegionCodeGenTy CodeGen,
bool  Tied,
unsigned NumberOfParts 
)
virtual

Emits outlined function for the OpenMP task directive D.

This outlined function has type void(*)(kmp_int32 ThreadID, struct task_t* TaskT).

Parameters
DOpenMP directive.
ThreadIDVarVariable for thread id in the current OpenMP region.
PartIDVarVariable for partition id in the current OpenMP untied task region.
TaskTVarVariable for task_t argument.
InnermostKindKind of innermost directive (for simple directives it is a directive itself, for combined - its innermost directive).
CodeGenCode generation sequence for the D directive.
Tiedtrue if task is generated for tied task, false otherwise.
NumberOfPartsNumber of parts in untied task. Ignored for tied tasks.

Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.

Definition at line 1306 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().

◆ emitTaskReductionFini()

void CGOpenMPRuntime::emitTaskReductionFini ( CodeGenFunction CGF,
SourceLocation  Loc,
bool  IsWorksharingReduction 
)
virtual

Emits the following code for reduction clause with task modifier:

__kmpc_task_reduction_modifier_fini(loc, gtid, is_worksharing);

Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.

Definition at line 6212 of file CGOpenMPRuntime.cpp.

References clang::CodeGen::CodeGenFunction::Builder, and clang::CodeGen::CodeGenFunction::EmitRuntimeCall().

◆ emitTaskReductionFixups()

void CGOpenMPRuntime::emitTaskReductionFixups ( CodeGenFunction CGF,
SourceLocation  Loc,
ReductionCodeGen RCG,
unsigned  N 
)
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.

Parameters
RCGAllows to reuse an existing data for the reductions.
NReduction item for which fixups must be emitted.

Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.

Definition at line 6230 of file CGOpenMPRuntime.cpp.

References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CGBuilderTy::CreateStore(), generateUniqueName(), clang::CodeGen::CodeGenFunction::getContext(), clang::CodeGen::ReductionCodeGen::getRefExpr(), clang::CodeGen::ReductionCodeGen::getSizes(), and clang::ASTContext::getSizeType().

◆ emitTaskReductionInit()

llvm::Value * CGOpenMPRuntime::emitTaskReductionInit ( CodeGenFunction CGF,
SourceLocation  Loc,
ArrayRef< const Expr * >  LHSExprs,
ArrayRef< const Expr * >  RHSExprs,
const OMPTaskDataTy Data 
)
virtual

Emit a code for initialization of task reduction clause.

Next code should be emitted for reduction:

_taskred_item_t red_data[n];
...
red_data[i].shar = &shareds[i];
red_data[i].orig = &origs[i];
red_data[i].size = sizeof(origs[i]);
red_data[i].f_init = (void*)RedInit<i>;
red_data[i].f_fini = (void*)RedDest<i>;
red_data[i].f_comb = (void*)RedOp<i>;
red_data[i].flags = <Flag_i>;
...
void* tg1 = __kmpc_taskred_init(gtid, n, red_data);

For reduction clause with task modifier it emits the next call:

_taskred_item_t red_data[n];
...
red_data[i].shar = &shareds[i];
red_data[i].orig = &origs[i];
red_data[i].size = sizeof(origs[i]);
red_data[i].f_init = (void*)RedInit<i>;
red_data[i].f_fini = (void*)RedDest<i>;
red_data[i].f_comb = (void*)RedOp<i>;
red_data[i].flags = <Flag_i>;
...
void* tg1 = __kmpc_taskred_modifier_init(loc, gtid, is_worksharing, n,
red_data);
Parameters
LHSExprsList of LHS in Data.ReductionOps reduction operations.
RHSExprsList of RHS in Data.ReductionOps reduction operations.
DataAdditional data for task generation like tiedness, final state, list of privates, reductions etc.

Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.

Definition at line 6083 of file CGOpenMPRuntime.cpp.

References addFieldToRecordDecl(), clang::CodeGen::CodeGenFunction::Builder, 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(), clang::CodeGen::LValue::getAddress(), clang::CodeGen::ReductionCodeGen::getOrigLValue(), clang::CodeGen::Address::getPointer(), clang::CodeGen::LValue::getPointer(), clang::CodeGen::ReductionCodeGen::getSharedLValue(), clang::CodeGen::ReductionCodeGen::getSizes(), clang::CodeGen::LValue::getType(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), clang::CodeGen::OMPTaskDataTy::IsReductionWithTaskMod, clang::CodeGen::OMPTaskDataTy::IsWorksharingReduction, clang::CodeGen::CodeGenFunction::MakeNaturalAlignAddrLValue(), clang::ArrayType::Normal, clang::CodeGen::OMPTaskDataTy::ReductionCopies, clang::CodeGen::OMPTaskDataTy::ReductionOps, clang::CodeGen::OMPTaskDataTy::ReductionOrigs, clang::CodeGen::OMPTaskDataTy::ReductionVars, and clang::TagDecl::startDefinition().

◆ emitTaskwaitCall()

void CGOpenMPRuntime::emitTaskwaitCall ( CodeGenFunction CGF,
SourceLocation  Loc 
)
virtual

◆ emitTaskyieldCall()

void CGOpenMPRuntime::emitTaskyieldCall ( CodeGenFunction CGF,
SourceLocation  Loc 
)
virtual

◆ emitTeamsCall()

void CGOpenMPRuntime::emitTeamsCall ( CodeGenFunction CGF,
const OMPExecutableDirective D,
SourceLocation  Loc,
llvm::Function *  OutlinedFn,
ArrayRef< llvm::Value * >  CapturedVars 
)
virtual

Emits code for teams call of the OutlinedFn with variables captured in a record which address is stored in CapturedStruct.

Parameters
OutlinedFnOutlined function to be run by team masters. Type of this function is void(*)(kmp_int32 *, kmp_int32, struct context_vars*).
CapturedVarsA 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 11097 of file CGOpenMPRuntime.cpp.

References clang::CodeGen::CodeGenFunction::Builder, CGM, clang::CodeGen::CGBuilderTy::CreateBitCast(), clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), emitUpdateLocation(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), and OMPBuilder.

◆ emitTeamsOutlinedFunction()

llvm::Function * CGOpenMPRuntime::emitTeamsOutlinedFunction ( const OMPExecutableDirective D,
const VarDecl ThreadIDVar,
OpenMPDirectiveKind  InnermostKind,
const RegionCodeGenTy CodeGen 
)
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).

Parameters
DOpenMP directive.
ThreadIDVarVariable for thread id in the current OpenMP region.
InnermostKindKind of innermost directive (for simple directives it is a directive itself, for combined - its innermost directive).
CodeGenCode generation sequence for the D directive.

Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime, and clang::CodeGen::CGOpenMPRuntimeGPU.

Definition at line 1298 of file CGOpenMPRuntime.cpp.

References CGM, emitParallelOrTeamsOutlinedFunction(), clang::OMPExecutableDirective::getCapturedStmt(), and getOutlinedHelperName().

Referenced by clang::CodeGen::CGOpenMPRuntimeGPU::emitTeamsOutlinedFunction().

◆ emitThreadIDAddress()

Address CGOpenMPRuntime::emitThreadIDAddress ( CodeGenFunction CGF,
SourceLocation  Loc 
)
protectedvirtual

◆ emitThreadPrivateVarDefinition()

llvm::Function * CGOpenMPRuntime::emitThreadPrivateVarDefinition ( const VarDecl VD,
Address  VDAddr,
SourceLocation  Loc,
bool  PerformInit,
CodeGenFunction CGF = nullptr 
)
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).

Parameters
VDThreadprivate variable.
VDAddrAddress of the global variable VD.
LocLocation of threadprivate declaration.
PerformInittrue if initialization expression is not constant.

Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.

Definition at line 1779 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().

◆ emitUpdateClause()

void CGOpenMPRuntime::emitUpdateClause ( CodeGenFunction CGF,
LValue  DepobjLVal,
OpenMPDependClauseKind  NewDepKind,
SourceLocation  Loc 
)

Updates the dependency kind in the specified depobj object.

Parameters
DepobjLValLValue for the main depobj object.
NewDepKindNew dependency kind.

Definition at line 5095 of file CGOpenMPRuntime.cpp.

References clang::CodeGen::CodeGenFunction::ConvertTypeForMem(), and getDependTypes().

◆ emitUpdateLocation()

llvm::Value * CGOpenMPRuntime::emitUpdateLocation ( CodeGenFunction CGF,
SourceLocation  Loc,
unsigned  Flags = 0 
)
protected

◆ emitUserDefinedMapper()

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.

void .omp_mapper.<type_name>.<mapper_id>.(void *rt_mapper_handle,
void *base, void *begin,
int64_t size, int64_t type,
void *name = nullptr) {
// Allocate space for an array section first or add a base/begin for
// pointer dereference.
if ((size > 1 || (base != begin && maptype.IsPtrAndObj)) &&
!maptype.IsDelete)
__tgt_push_mapper_component(rt_mapper_handle, base, begin,
size*sizeof(Ty), clearToFromMember(type));
// Map members.
for (unsigned i = 0; i < size; i++) {
// For each component specified by this mapper:
for (auto c : begin[i]->all_components) {
if (c.hasMapper())
(*c.Mapper())(rt_mapper_handle, c.arg_base, c.arg_begin, c.arg_size,
c.arg_type, c.arg_name);
else
__tgt_push_mapper_component(rt_mapper_handle, c.arg_base,
c.arg_begin, c.arg_size, c.arg_type,
c.arg_name);
}
}
// Delete the array section.
if (size > 1 && maptype.IsDelete)
__tgt_push_mapper_component(rt_mapper_handle, base, begin,
size*sizeof(Ty), clearToFromMember(type));
}

Definition at line 9938 of file CGOpenMPRuntime.cpp.

References clang::CodeGen::CodeGenTypes::arrangeBuiltinFunctionDeclaration(), CGM, clang::CodeGen::CodeGenModule::getContext(), clang::CodeGen::CodeGenModule::getCXXABI(), clang::CodeGen::CodeGenTypes::GetFunctionType(), clang::Decl::getLocation(), clang::CodeGen::CGCXXABI::getMangleContext(), clang::OMPDeclareMapperDecl::getMapperVarRef(), clang::ValueDecl::getType(), clang::CodeGen::CodeGenModule::getTypes(), clang::MangleContext::mangleTypeName(), clang::ImplicitParamDecl::Other, and string().

Referenced by clang::CodeGen::CodeGenModule::EmitOMPDeclareMapper(), and getOrCreateUserDefinedMapperFunc().

◆ emitUserDefinedReduction()

void CGOpenMPRuntime::emitUserDefinedReduction ( CodeGenFunction CGF,
const OMPDeclareReductionDecl D 
)
virtual

◆ emitUsesAllocatorsFini()

void CGOpenMPRuntime::emitUsesAllocatorsFini ( CodeGenFunction CGF,
const Expr Allocator 
)

Destroys user defined allocators specified in the uses_allocators clause.

Definition at line 6496 of file CGOpenMPRuntime.cpp.

◆ emitUsesAllocatorsInit()

void CGOpenMPRuntime::emitUsesAllocatorsInit ( CodeGenFunction CGF,
const Expr Allocator,
const Expr AllocatorTraits 
)

Initializes user defined allocators specified in the uses_allocators clauses.

Definition at line 6461 of file CGOpenMPRuntime.cpp.

◆ functionFinished()

void CGOpenMPRuntime::functionFinished ( CodeGenFunction CGF)
virtual

◆ getAddressOfLocalVariable()

Address CGOpenMPRuntime::getAddressOfLocalVariable ( CodeGenFunction CGF,
const VarDecl VD 
)
virtual

◆ getAddrOfArtificialThreadPrivate()

Address CGOpenMPRuntime::getAddrOfArtificialThreadPrivate ( CodeGenFunction CGF,
QualType  VarType,
StringRef  Name 
)
virtual

Creates artificial threadprivate variable with name Name and type VarType.

Parameters
VarTypeType of the artificial threadprivate variable.
NameName of the artificial threadprivate variable.

Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.

Definition at line 2014 of file CGOpenMPRuntime.cpp.

◆ getAddrOfDeclareTargetVar()

Address CGOpenMPRuntime::getAddrOfDeclareTargetVar ( const VarDecl VD)
virtual

◆ getAddrOfThreadPrivate()

Address CGOpenMPRuntime::getAddrOfThreadPrivate ( CodeGenFunction CGF,
const VarDecl VD,
Address  VDAddr,
SourceLocation  Loc 
)
virtual

◆ getCriticalRegionLock()

llvm::Value * CGOpenMPRuntime::getCriticalRegionLock ( StringRef  CriticalName)
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.

Parameters
CriticalNameName of the critical region.

Definition at line 2198 of file CGOpenMPRuntime.cpp.

References string().

Referenced by emitCriticalRegion().

◆ getDefaultDistScheduleAndChunk()

virtual void clang::CodeGen::CGOpenMPRuntime::getDefaultDistScheduleAndChunk ( CodeGenFunction CGF,
const OMPLoopDirective S,
OpenMPDistScheduleClauseKind ScheduleKind,
llvm::Value *&  Chunk 
) const
inlinevirtual

Choose default schedule type and chunk value for the dist_schedule clause.

Reimplemented in clang::CodeGen::CGOpenMPRuntimeGPU.

Definition at line 1780 of file CGOpenMPRuntime.h.

◆ getDefaultFlagsForBarriers()

unsigned CGOpenMPRuntime::getDefaultFlagsForBarriers ( OpenMPDirectiveKind  Kind)
staticprotected

Returns default flags for the barriers depending on the directive, for which this barier is going to be emitted.

Definition at line 2545 of file CGOpenMPRuntime.cpp.

Referenced by clang::CodeGen::CGOpenMPRuntimeGPU::emitBarrierCall(), and emitBarrierCall().

◆ getDefaultLocationReserved2Flags()

virtual unsigned clang::CodeGen::CGOpenMPRuntime::getDefaultLocationReserved2Flags ( ) const
inlineprotectedvirtual

Returns additional flags that can be stored in reserved_2 field of the default location.

Reimplemented in clang::CodeGen::CGOpenMPRuntimeGPU.

Definition at line 403 of file CGOpenMPRuntime.h.

Referenced by emitUpdateLocation().

◆ getDefaultMemoryOrdering()

llvm::AtomicOrdering CGOpenMPRuntime::getDefaultMemoryOrdering ( ) const

Gets default memory ordering as specified in requires directive.

Definition at line 10988 of file CGOpenMPRuntime.cpp.

◆ getDefaultScheduleAndChunk()

void CGOpenMPRuntime::getDefaultScheduleAndChunk ( CodeGenFunction CGF,
const OMPLoopDirective S,
OpenMPScheduleClauseKind ScheduleKind,
const Expr *&  ChunkExpr 
) const
virtual

Choose default schedule type and chunk value for the schedule clause.

Reimplemented in clang::CodeGen::CGOpenMPRuntimeGPU.

Definition at line 2560 of file CGOpenMPRuntime.cpp.

◆ getIdentTyPointerTy()

llvm::Type * CGOpenMPRuntime::getIdentTyPointerTy ( )
protected

Returns pointer to ident_t type.

Definition at line 1548 of file CGOpenMPRuntime.cpp.

References OMPBuilder.

◆ getKmpCriticalNameTy()

llvm::ArrayType* clang::CodeGen::CGOpenMPRuntime::getKmpCriticalNameTy ( ) const
inlineprotected

Get the LLVM type for the critical name.

Definition at line 410 of file CGOpenMPRuntime.h.

◆ getName()

std::string CGOpenMPRuntime::getName ( ArrayRef< StringRef >  Parts) const

Get the platform-specific name separator.

Definition at line 1105 of file CGOpenMPRuntime.cpp.

References FirstSeparator, Separator, and string().

Referenced by emitRequiresDirectiveRegFun(), and registerTargetGlobalVariable().

◆ getNumTeamsExprForTargetDirective()

const Expr * CGOpenMPRuntime::getNumTeamsExprForTargetDirective ( CodeGenFunction CGF,
const OMPExecutableDirective D,
int32_t &  DefaultVal 
)
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 6647 of file CGOpenMPRuntime.cpp.

References clang::CapturedStmt::getCapturedStmt(), clang::CodeGen::CodeGenFunction::getContext(), clang::OMPExecutableDirective::getDirectiveKind(), clang::OMPExecutableDirective::getInnermostCapturedStmt(), clang::Expr::getIntegerConstantExpr(), clang::OMPExecutableDirective::getSingleClause(), clang::OMPExecutableDirective::hasClausesOfKind(), clang::Stmt::IgnoreContainers(), clang::Expr::isIntegerConstantExpr(), clang::isOpenMPParallelDirective(), clang::isOpenMPSimdDirective(), clang::isOpenMPTargetExecutionDirective(), and clang::isOpenMPTeamsDirective().

◆ getNumThreadsExprForTargetDirective()

const Expr * CGOpenMPRuntime::getNumThreadsExprForTargetDirective ( CodeGenFunction CGF,
const OMPExecutableDirective D,
int32_t &  DefaultVal 
)
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 6910 of file CGOpenMPRuntime.cpp.

References clang::CodeGen::CodeGenFunction::getContext(), clang::OMPExecutableDirective::getDirectiveKind(), clang::OMPExecutableDirective::getSingleClause(), clang::OMPExecutableDirective::hasClausesOfKind(), and clang::isOpenMPTargetExecutionDirective().

◆ getOMPBuilder()

llvm::OpenMPIRBuilder& clang::CodeGen::CGOpenMPRuntime::getOMPBuilder ( )
inline

◆ getOrCreateUserDefinedMapperFunc()

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 10256 of file CGOpenMPRuntime.cpp.

References emitUserDefinedMapper().

◆ getOutlinedHelperName()

virtual StringRef clang::CodeGen::CGOpenMPRuntime::getOutlinedHelperName ( ) const
inlineprotectedvirtual

Get the function name of an outlined region.

Reimplemented in clang::CodeGen::CGOpenMPRuntimeGPU.

Definition at line 382 of file CGOpenMPRuntime.h.

Referenced by emitParallelOutlinedFunction(), and emitTeamsOutlinedFunction().

◆ getParameterAddress()

Address CGOpenMPRuntime::getParameterAddress ( CodeGenFunction CGF,
const VarDecl NativeParam,
const VarDecl TargetParam 
) const
virtual

Gets the address of the native argument basing on the address of the target-specific parameter.

Parameters
NativeParamParameter itself.
TargetParamCorresponding target-specific parameter.

Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime, and clang::CodeGen::CGOpenMPRuntimeGPU.

Definition at line 12203 of file CGOpenMPRuntime.cpp.

References clang::CodeGen::CodeGenFunction::GetAddrOfLocalVar().

Referenced by emitOutlinedFunctionPrologue().

◆ getSingleCompoundChild()

const Stmt * CGOpenMPRuntime::getSingleCompoundChild ( ASTContext Ctx,
const Stmt Body 
)
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 6605 of file CGOpenMPRuntime.cpp.

References clang::Stmt::IgnoreContainers().

Referenced by hasNestedLightweightDirective(), and hasNestedSPMDDirective().

◆ getTaskReductionItem()

Address CGOpenMPRuntime::getTaskReductionItem ( CodeGenFunction CGF,
SourceLocation  Loc,
llvm::Value ReductionsPtr,
LValue  SharedLVal 
)
virtual

Get the address of void * type of the privatue copy of the reduction item specified by the SharedLVal.

Parameters
ReductionsPtrPointer to the reduction data returned by the emitTaskReductionInit function.
SharedLValAddress of the original reduction item.

Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.

Definition at line 6247 of file CGOpenMPRuntime.cpp.

References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CGBuilderTy::CreatePointerBitCastOrAddrSpaceCast(), clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), clang::CodeGen::LValue::getAlignment(), and clang::CodeGen::LValue::getPointer().

◆ getThreadID()

llvm::Value * CGOpenMPRuntime::getThreadID ( CodeGenFunction CGF,
SourceLocation  Loc 
)
protected

◆ getUserDefinedReduction()

std::pair< llvm::Function *, llvm::Function * > CGOpenMPRuntime::getUserDefinedReduction ( const OMPDeclareReductionDecl D)
virtual

Get combiner/initializer for the specified user-defined reduction, if any.

Definition at line 1200 of file CGOpenMPRuntime.cpp.

References emitUserDefinedReduction().

Referenced by emitInitWithReductionInitializer(), and emitReductionCombiner().

◆ hasAllocateAttributeForGlobalVar()

bool CGOpenMPRuntime::hasAllocateAttributeForGlobalVar ( const VarDecl VD,
LangAS AS 
)
virtual

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 10992 of file CGOpenMPRuntime.cpp.

References clang::Default, clang::Decl::getAttr(), and clang::Decl::hasAttr().

◆ hasRequiresUnifiedSharedMemory()

bool CGOpenMPRuntime::hasRequiresUnifiedSharedMemory ( ) const

Return whether the unified_shared_memory has been specified.

Definition at line 11017 of file CGOpenMPRuntime.cpp.

Referenced by createOffloadEntriesAndInfoMetadata(), emitDeclTargetVarDeclLValue(), and clang::CodeGen::CodeGenModule::EmitGlobal().

◆ isDefaultLocationConstant()

virtual bool clang::CodeGen::CGOpenMPRuntime::isDefaultLocationConstant ( ) const
inlineprotectedvirtual

Check if the default location must be constant.

Default is false to support OMPT/OMPD.

Reimplemented in clang::CodeGen::CGOpenMPRuntimeGPU.

Definition at line 399 of file CGOpenMPRuntime.h.

◆ isDynamic()

bool CGOpenMPRuntime::isDynamic ( OpenMPScheduleClauseKind  ScheduleKind) const
virtual

Check if the specified ScheduleKind is dynamic.

This kind of worksharing directive is emitted without outer loop.

Parameters
ScheduleKindSchedule Kind specified in the 'schedule' clause.

Definition at line 2683 of file CGOpenMPRuntime.cpp.

References getRuntimeSchedule().

◆ isLocalVarInUntiedTask()

bool CGOpenMPRuntime::isLocalVarInUntiedTask ( CodeGenFunction CGF,
const VarDecl VD 
) const

Returns true if the variable is a local variable in untied task.

Definition at line 12313 of file CGOpenMPRuntime.cpp.

References clang::CodeGen::CodeGenFunction::CurFn.

◆ isNontemporalDecl()

bool CGOpenMPRuntime::isNontemporalDecl ( const ValueDecl VD) const

Checks if the VD variable is marked as nontemporal declaration in current context.

Definition at line 12371 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().

◆ isStaticChunked() [1/2]

bool CGOpenMPRuntime::isStaticChunked ( OpenMPDistScheduleClauseKind  ScheduleKind,
bool  Chunked 
) const
virtual

Check if the specified ScheduleKind is static non-chunked.

Parameters
ScheduleKindSchedule kind specified in the 'dist_schedule' clause.
ChunkedTrue if chunk is specified in the clause.

Definition at line 2677 of file CGOpenMPRuntime.cpp.

References getRuntimeSchedule().

◆ isStaticChunked() [2/2]

bool CGOpenMPRuntime::isStaticChunked ( OpenMPScheduleClauseKind  ScheduleKind,
bool  Chunked 
) const
virtual

Check if the specified ScheduleKind is static chunked.

Parameters
ScheduleKindSchedule kind specified in the 'schedule' clause.
ChunkedTrue if chunk is specified in the clause.

Definition at line 2670 of file CGOpenMPRuntime.cpp.

References getRuntimeSchedule().

◆ isStaticNonchunked() [1/2]

bool CGOpenMPRuntime::isStaticNonchunked ( OpenMPDistScheduleClauseKind  ScheduleKind,
bool  Chunked 
) const
virtual

Check if the specified ScheduleKind is static non-chunked.

This kind of distribute directive is emitted without outer loop.

Parameters
ScheduleKindSchedule kind specified in the 'dist_schedule' clause.
ChunkedTrue if chunk is specified in the clause.

Definition at line 2664 of file CGOpenMPRuntime.cpp.

References getRuntimeSchedule().

◆ isStaticNonchunked() [2/2]

bool CGOpenMPRuntime::isStaticNonchunked ( OpenMPScheduleClauseKind  ScheduleKind,
bool  Chunked 
) const
virtual

Check if the specified ScheduleKind is static non-chunked.

This kind of worksharing directive is emitted without outer loop.

Parameters
ScheduleKindSchedule kind specified in the 'schedule' clause.
ChunkedTrue if chunk is specified in the clause.

Definition at line 2657 of file CGOpenMPRuntime.cpp.

References getRuntimeSchedule().

◆ markAsGlobalTarget()

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 11035 of file CGOpenMPRuntime.cpp.

References CGM, clang::GlobalDecl::getDecl(), clang::CodeGen::CodeGenModule::GetGlobalValue(), clang::CodeGen::CodeGenModule::getLangOpts(), and clang::CodeGen::CodeGenModule::getMangledName().

◆ processRequiresDirective()

void CGOpenMPRuntime::processRequiresDirective ( const OMPRequiresDecl D)
virtual

Perform check on requires decl to ensure that target architecture supports unified addressing.

Reimplemented in clang::CodeGen::CGOpenMPRuntimeGPU.

Definition at line 10965 of file CGOpenMPRuntime.cpp.

References clang::OMPRequiresDecl::clauselists(), and clang::OMPC_ATOMIC_DEFAULT_MEM_ORDER_unknown.

Referenced by clang::CodeGen::CodeGenModule::EmitOMPRequiresDecl(), and clang::CodeGen::CGOpenMPRuntimeGPU::processRequiresDirective().

◆ registerTargetGlobalVariable()

void CGOpenMPRuntime::registerTargetGlobalVariable ( const VarDecl VD,
llvm::Constant *  Addr 
)
virtual

◆ setLocThreadIdInsertPt()

void CGOpenMPRuntime::setLocThreadIdInsertPt ( CodeGenFunction CGF,
bool  AtCurrentPoint = false 
)
protected

◆ translateParameter()

virtual const VarDecl* clang::CodeGen::CGOpenMPRuntime::translateParameter ( const FieldDecl FD,
const VarDecl NativeParam 
) const
inlinevirtual

Translates the native parameter of outlined function if this is required for target.

Parameters
FDField decl from captured record for the parameter.
NativeParamParameter itself.

Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime, and clang::CodeGen::CGOpenMPRuntimeGPU.

Definition at line 1765 of file CGOpenMPRuntime.h.

Referenced by emitOutlinedFunctionPrologue().

Member Data Documentation

◆ CGM

CodeGenModule& clang::CodeGen::CGOpenMPRuntime::CGM
protected

Definition at line 305 of file CGOpenMPRuntime.h.

Referenced by CGOpenMPRuntime(), clang::CodeGen::CGOpenMPRuntimeAMDGCN::CGOpenMPRuntimeAMDGCN(), clang::CodeGen::CGOpenMPRuntimeGPU::CGOpenMPRuntimeGPU(), clang::CodeGen::CGOpenMPRuntimeNVPTX::CGOpenMPRuntimeNVPTX(), clang::CodeGen::CGOpenMPRuntimeGPU::clear(), createOffloadEntriesAndInfoMetadata(), emitAArch64DeclareSimdFunction(), clang::CodeGen::CGOpenMPRuntimeGPU::emitBarrierCall(), emitBarrierCall(), emitCancelCall(), clang::CodeGen::CGOpenMPRuntimeGPU::emitCriticalRegion(), emitCriticalRegion(), emitDeclareSimdFunction(), emitDeclareTargetVarDefinition(), emitDeferredTargetDecls(), emitDistributeStaticInit(), emitDoacrossInit(), emitDoacrossOrdered(), emitFlush(), emitForDispatchInit(), emitForStaticFinish(), clang::CodeGen::CGOpenMPRuntimeGPU::emitFunctionProlog(), emitLastprivateConditionalFinalUpdate(), emitLastprivateConditionalInit(), emitMaskedRegion(), emitMasterRegion(), emitNumTeamsClause(), emitNumThreadsClause(), emitOrderedRegion(), clang::CodeGen::CGOpenMPRuntimeGPU::emitParallelCall(), emitParallelCall(), emitParallelOutlinedFunction(), emitProcBindClause(), emitRequiresDirectiveRegFun(), emitSingleRegion(), emitTargetCall(), emitTargetDataCalls(), emitTargetDataStandAloneCall(), emitTargetFunctions(), emitTargetGlobalVariable(), emitTaskgroupRegion(), emitTaskOutlinedFunction(), emitTaskyieldCall(), emitTeamsCall(), clang::CodeGen::CGOpenMPRuntimeGPU::emitTeamsOutlinedFunction(), emitTeamsOutlinedFunction(), emitThreadPrivateVarDefinition(), emitUpdateLocation(), emitUserDefinedMapper(), emitUserDefinedReduction(), clang::CodeGen::CGOpenMPRuntimeGPU::getAddressOfLocalVariable(), getAddressOfLocalVariable(), getAddrOfDeclareTargetVar(), getAddrOfThreadPrivate(), getThreadID(), isNontemporalDecl(), markAsGlobalTarget(), clang::CodeGen::CGOpenMPRuntimeGPU::processRequiresDirective(), registerTargetGlobalVariable(), 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().

◆ FirstSeparator

StringRef clang::CodeGen::CGOpenMPRuntime::FirstSeparator
protected

Definition at line 306 of file CGOpenMPRuntime.h.

Referenced by getName().

◆ OMPBuilder

llvm::OpenMPIRBuilder clang::CodeGen::CGOpenMPRuntime::OMPBuilder
protected

◆ Separator

StringRef clang::CodeGen::CGOpenMPRuntime::Separator
protected

Definition at line 306 of file CGOpenMPRuntime.h.

Referenced by getName().


The documentation for this class was generated from the following files:
type
clang::ast_matchers::type
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
Definition: ASTMatchersInternal.cpp:772
c
__device__ __2f16 float c
Definition: __clang_hip_libdevice_declares.h:315
clang::transformer::name
RangeSelector name(std::string ID)
Given a node with a "name", (like NamedDecl, DeclRefExpr, CxxCtorInitializer, and TypeLoc) selects th...
Definition: RangeSelector.cpp:200