clang 19.0.0git
Classes | Public Member Functions | Static Public Member Functions | Protected Types | 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]

Classes

struct  DebugLocThreadIdTy
 Stores debug location and ThreadID for the function. More...
 
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...
 
struct  TaskResultTy
 
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 ()
 
llvm::Value * emitUpdateLocation (CodeGenFunction &CGF, SourceLocation Loc, unsigned Flags=0, bool EmitLoc=false)
 Emits object of ident_t type with info for source location.
 
const ExprgetNumTeamsExprForTargetDirective (CodeGenFunction &CGF, const OMPExecutableDirective &D, int32_t &MinTeamsVal, int32_t &MaxTeamsVal)
 Emit the number of teams for a target directive.
 
llvm::Value * emitNumTeamsForTargetDirective (CodeGenFunction &CGF, const OMPExecutableDirective &D)
 
const ExprgetNumThreadsExprForTargetDirective (CodeGenFunction &CGF, const OMPExecutableDirective &D, int32_t &UpperBound, bool UpperBoundOnly, llvm::Value **CondExpr=nullptr, const Expr **ThreadLimitExpr=nullptr)
 Check for a number of threads upper bound constant value (stored in UpperBound), or expression (returned).
 
llvm::Value * emitNumThreadsForTargetDirective (CodeGenFunction &CGF, const OMPExecutableDirective &D)
 Emit an expression that denotes the number of threads a target region shall use.
 
llvm::Value * emitTargetNumIterationsCall (CodeGenFunction &CGF, const OMPExecutableDirective &D, llvm::function_ref< llvm::Value *(CodeGenFunction &CGF, const OMPLoopDirective &D)> SizeEmitter)
 Return the trip count of loops associated with constructs / 'target teams distribute' and 'teams distribute parallel for'.
 
virtual bool isGPU () const
 Returns true if the current target is a GPU.
 
virtual bool isDelayedVariableLengthDecl (CodeGenFunction &CGF, const VarDecl *VD) const
 Check if the variable length declaration is delayed:
 
virtual std::pair< llvm::Value *, llvm::Value * > getKmpcAllocShared (CodeGenFunction &CGF, const VarDecl *VD)
 Get call to __kmpc_alloc_shared.
 
virtual void getKmpcFreeShared (CodeGenFunction &CGF, const std::pair< llvm::Value *, llvm::Value * > &AddrSizePair)
 Get call to __kmpc_free_shared.
 
void emitIfClause (CodeGenFunction &CGF, const Expr *Cond, const RegionCodeGenTy &ThenGen, const RegionCodeGenTy &ElseGen)
 Emits code for OpenMP 'if' clause using specified CodeGen function.
 
std::string getName (ArrayRef< StringRef > Parts) const
 Get the platform-specific name separator.
 
virtual void emitUserDefinedReduction (CodeGenFunction *CGF, const OMPDeclareReductionDecl *D)
 Emit code for the specified user defined reduction construct.
 
virtual std::pair< llvm::Function *, llvm::Function * > getUserDefinedReduction (const OMPDeclareReductionDecl *D)
 Get combiner/initializer for the specified user-defined reduction, if any.
 
void emitUserDefinedMapper (const OMPDeclareMapperDecl *D, CodeGenFunction *CGF=nullptr)
 Emit the function for the user defined mapper construct.
 
llvm::Function * getOrCreateUserDefinedMapperFunc (const OMPDeclareMapperDecl *D)
 Get the function for the specified user-defined mapper.
 
virtual llvm::Function * emitParallelOutlinedFunction (CodeGenFunction &CGF, const OMPExecutableDirective &D, const VarDecl *ThreadIDVar, OpenMPDirectiveKind InnermostKind, const RegionCodeGenTy &CodeGen)
 Emits outlined function for the specified OpenMP parallel directive D.
 
virtual llvm::Function * emitTeamsOutlinedFunction (CodeGenFunction &CGF, const OMPExecutableDirective &D, const VarDecl *ThreadIDVar, OpenMPDirectiveKind InnermostKind, const RegionCodeGenTy &CodeGen)
 Emits outlined function for the specified OpenMP teams directive D.
 
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.
 
virtual void functionFinished (CodeGenFunction &CGF)
 Cleans up references to the objects in finished function.
 
virtual void emitParallelCall (CodeGenFunction &CGF, SourceLocation Loc, llvm::Function *OutlinedFn, ArrayRef< llvm::Value * > CapturedVars, const Expr *IfCond, llvm::Value *NumThreads)
 Emits code for parallel or serial call of the OutlinedFn with variables captured in a record which address is stored in CapturedStruct.
 
virtual void emitCriticalRegion (CodeGenFunction &CGF, StringRef CriticalName, const RegionCodeGenTy &CriticalOpGen, SourceLocation Loc, const Expr *Hint=nullptr)
 Emits a critical region.
 
virtual void emitMasterRegion (CodeGenFunction &CGF, const RegionCodeGenTy &MasterOpGen, SourceLocation Loc)
 Emits a master region.
 
virtual void emitMaskedRegion (CodeGenFunction &CGF, const RegionCodeGenTy &MaskedOpGen, SourceLocation Loc, const Expr *Filter=nullptr)
 Emits a masked region.
 
virtual void emitTaskyieldCall (CodeGenFunction &CGF, SourceLocation Loc)
 Emits code for a taskyield directive.
 
virtual void emitErrorCall (CodeGenFunction &CGF, SourceLocation Loc, Expr *ME, bool IsFatal)
 Emit __kmpc_error call for error directive extern void __kmpc_error(ident_t *loc, int severity, const char *message);.
 
virtual void emitTaskgroupRegion (CodeGenFunction &CGF, const RegionCodeGenTy &TaskgroupOpGen, SourceLocation Loc)
 Emit a taskgroup region.
 
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.
 
virtual void emitOrderedRegion (CodeGenFunction &CGF, const RegionCodeGenTy &OrderedOpGen, SourceLocation Loc, bool IsThreads)
 Emit an ordered region.
 
virtual void emitBarrierCall (CodeGenFunction &CGF, SourceLocation Loc, OpenMPDirectiveKind Kind, bool EmitChecks=true, bool ForceSimpleCall=false)
 Emit an implicit/explicit barrier for OpenMP threads.
 
virtual bool isStaticNonchunked (OpenMPScheduleClauseKind ScheduleKind, bool Chunked) const
 Check if the specified ScheduleKind is static non-chunked.
 
virtual bool isStaticNonchunked (OpenMPDistScheduleClauseKind ScheduleKind, bool Chunked) const
 Check if the specified ScheduleKind is static non-chunked.
 
virtual bool isStaticChunked (OpenMPScheduleClauseKind ScheduleKind, bool Chunked) const
 Check if the specified ScheduleKind is static chunked.
 
virtual bool isStaticChunked (OpenMPDistScheduleClauseKind ScheduleKind, bool Chunked) const
 Check if the specified ScheduleKind is static non-chunked.
 
virtual bool isDynamic (OpenMPScheduleClauseKind ScheduleKind) const
 Check if the specified ScheduleKind is dynamic.
 
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.
 
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.
 
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.
 
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.
 
virtual llvm::Value * emitForNext (CodeGenFunction &CGF, SourceLocation Loc, unsigned IVSize, bool IVSigned, Address IL, Address LB, Address UB, Address ST)
 Call __kmpc_dispatch_next( ident_t *loc, kmp_int32 tid, kmp_int32 *p_lastiter, kmp_int[32|64] *p_lower, kmp_int[32|64] *p_upper, kmp_int[32|64] *p_stride);.
 
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.
 
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.
 
virtual Address getAddrOfThreadPrivate (CodeGenFunction &CGF, const VarDecl *VD, Address VDAddr, SourceLocation Loc)
 Returns address of the threadprivate variable for the current thread.
 
virtual ConstantAddress 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.
 
virtual llvm::Function * emitThreadPrivateVarDefinition (const VarDecl *VD, Address VDAddr, SourceLocation Loc, bool PerformInit, CodeGenFunction *CGF=nullptr)
 Emit a code for initialization of threadprivate variable.
 
virtual void emitDeclareTargetFunction (const FunctionDecl *FD, llvm::GlobalValue *GV)
 Emit code for handling declare target functions in the runtime.
 
virtual Address getAddrOfArtificialThreadPrivate (CodeGenFunction &CGF, QualType VarType, StringRef Name)
 Creates artificial threadprivate variable with name Name and type VarType.
 
virtual void emitFlush (CodeGenFunction &CGF, ArrayRef< const Expr * > Vars, SourceLocation Loc, llvm::AtomicOrdering AO)
 Emit flush of the variables specified in 'omp flush' directive.
 
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.
 
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.
 
virtual void emitInlinedDirective (CodeGenFunction &CGF, OpenMPDirectiveKind InnermostKind, const RegionCodeGenTy &CodeGen, bool HasCancel=false)
 Emit code for the directive that does not require outlining.
 
llvm::Function * emitReductionFunction (StringRef ReducerName, SourceLocation Loc, llvm::Type *ArgsElemType, ArrayRef< const Expr * > Privates, ArrayRef< const Expr * > LHSExprs, ArrayRef< const Expr * > RHSExprs, ArrayRef< const Expr * > ReductionOps)
 Emits reduction function.
 
void emitSingleReductionCombiner (CodeGenFunction &CGF, const Expr *ReductionOp, const Expr *PrivateRef, const DeclRefExpr *LHS, const DeclRefExpr *RHS)
 Emits single reduction combiner.
 
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.
 
virtual llvm::Value * emitTaskReductionInit (CodeGenFunction &CGF, SourceLocation Loc, ArrayRef< const Expr * > LHSExprs, ArrayRef< const Expr * > RHSExprs, const OMPTaskDataTy &Data)
 Emit a code for initialization of task reduction clause.
 
virtual void emitTaskReductionFini (CodeGenFunction &CGF, SourceLocation Loc, bool IsWorksharingReduction)
 Emits the following code for reduction clause with task modifier:
 
virtual void emitTaskReductionFixups (CodeGenFunction &CGF, SourceLocation Loc, ReductionCodeGen &RCG, unsigned N)
 Required to resolve existing problems in the runtime.
 
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.
 
virtual void emitTaskwaitCall (CodeGenFunction &CGF, SourceLocation Loc, const OMPTaskDataTy &Data)
 Emit code for 'taskwait' directive.
 
virtual void emitCancellationPointCall (CodeGenFunction &CGF, SourceLocation Loc, OpenMPDirectiveKind CancelRegion)
 Emit code for 'cancellation point' construct.
 
virtual void emitCancelCall (CodeGenFunction &CGF, SourceLocation Loc, const Expr *IfCond, OpenMPDirectiveKind CancelRegion)
 Emit code for 'cancel' construct.
 
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.
 
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.
 
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.
 
virtual bool emitTargetGlobalVariable (GlobalDecl GD)
 Emit the global variable if it is a valid device global variable.
 
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.
 
virtual bool emitTargetGlobal (GlobalDecl GD)
 Emit the global GD if it is meaningful for the target.
 
void createOffloadEntriesAndInfoMetadata ()
 Creates all the offload entries in the current compilation unit along with the associated metadata.
 
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.
 
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.
 
virtual void emitThreadLimitClause (CodeGenFunction &CGF, const Expr *ThreadLimit, SourceLocation Loc)
 Emits call to void __kmpc_set_thread_limit(ident_t *loc, kmp_int32 global_tid, kmp_int32 thread_limit) to generate code for thread_limit clause on target directive.
 
virtual void emitTargetDataCalls (CodeGenFunction &CGF, const OMPExecutableDirective &D, const Expr *IfCond, const Expr *Device, const RegionCodeGenTy &CodeGen, CGOpenMPRuntime::TargetDataInfo &Info)
 Emit the target data mapping code associated with D.
 
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]'.
 
virtual void emitDeclareSimdFunction (const FunctionDecl *FD, llvm::Function *Fn)
 Marks function Fn with properly mangled versions of vector functions.
 
virtual void emitDoacrossInit (CodeGenFunction &CGF, const OMPLoopDirective &D, ArrayRef< Expr * > NumIterations)
 Emit initialization for doacross loop nesting support.
 
virtual void emitDoacrossOrdered (CodeGenFunction &CGF, const OMPDependClause *C)
 Emit code for doacross ordered directive with 'depend' clause.
 
virtual void emitDoacrossOrdered (CodeGenFunction &CGF, const OMPDoacrossClause *C)
 Emit code for doacross ordered directive with 'doacross' clause.
 
virtual const VarDecltranslateParameter (const FieldDecl *FD, const VarDecl *NativeParam) const
 Translates the native parameter of outlined function if this is required for target.
 
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.
 
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.
 
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.
 
virtual void emitOutlinedFunctionCall (CodeGenFunction &CGF, SourceLocation Loc, llvm::FunctionCallee OutlinedFn, ArrayRef< llvm::Value * > Args=std::nullopt) const
 Emits call of the outlined function with the provided arguments, translating these arguments to correct target-specific arguments.
 
virtual void emitFunctionProlog (CodeGenFunction &CGF, const Decl *D)
 Emits OpenMP-specific function prolog.
 
virtual Address getAddressOfLocalVariable (CodeGenFunction &CGF, const VarDecl *VD)
 Gets the OpenMP-specific address of the local variable.
 
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.
 
void emitDeferredTargetDecls () const
 Emit deferred declare target variables marked for deferred emission.
 
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.
 
virtual void processRequiresDirective (const OMPRequiresDecl *D)
 Perform check on requires decl to ensure that target architecture supports unified addressing.
 
llvm::AtomicOrdering getDefaultMemoryOrdering () const
 Gets default memory ordering as specified in requires directive.
 
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.
 
bool hasRequiresUnifiedSharedMemory () const
 Return whether the unified_shared_memory has been specified.
 
bool isNontemporalDecl (const ValueDecl *VD) const
 Checks if the VD variable is marked as nontemporal declaration in current context.
 
Address emitLastprivateConditionalInit (CodeGenFunction &CGF, const VarDecl *VD)
 Create specialized alloca to handle lastprivate conditionals.
 
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.
 
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.
 
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.
 
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).
 
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.
 
void emitDestroyClause (CodeGenFunction &CGF, LValue DepobjLVal, SourceLocation Loc)
 Emits the code to destroy the dependency object provided in depobj directive.
 
void emitUpdateClause (CodeGenFunction &CGF, LValue DepobjLVal, OpenMPDependClauseKind NewDepKind, SourceLocation Loc)
 Updates the dependency kind in the specified depobj object.
 
void emitUsesAllocatorsInit (CodeGenFunction &CGF, const Expr *Allocator, const Expr *AllocatorTraits)
 Initializes user defined allocators specified in the uses_allocators clauses.
 
void emitUsesAllocatorsFini (CodeGenFunction &CGF, const Expr *Allocator)
 Destroys user defined allocators specified in the uses_allocators clause.
 
bool isLocalVarInUntiedTask (CodeGenFunction &CGF, const VarDecl *VD) const
 Returns true if the variable is a local variable in untied task.
 

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.
 

Protected Types

typedef llvm::DenseMap< SourceLocation, llvm::Value * > OpenMPDebugLocMapTy
 Map for SourceLocation and OpenMP runtime library debug locations.
 
typedef llvm::DenseMap< llvm::Function *, DebugLocThreadIdTyOpenMPLocThreadIDMapTy
 Map of local debug location, ThreadId and functions.
 
typedef llvm::DenseMap< const OMPDeclareReductionDecl *, std::pair< llvm::Function *, llvm::Function * > > UDRMapTy
 Map of UDRs and corresponding combiner/initializer.
 
typedef llvm::DenseMap< llvm::Function *, SmallVector< const OMPDeclareReductionDecl *, 4 > > FunctionUDRMapTy
 Map of functions and locally defined UDRs.
 
using FunctionUDMMapTy = llvm::DenseMap< llvm::Function *, SmallVector< const OMPDeclareMapperDecl *, 4 > >
 Map of functions and their local user-defined mappers.
 
using NontemporalDeclsSet = llvm::SmallDenseSet< CanonicalDeclPtr< const Decl > >
 
using UntiedLocalVarsAddressesMap = llvm::MapVector< CanonicalDeclPtr< const VarDecl >, std::pair< Address, Address > >
 

Protected Member Functions

void computeMinAndMaxThreadsAndTeams (const OMPExecutableDirective &D, CodeGenFunction &CGF, int32_t &MinThreadsVal, int32_t &MaxThreadsVal, int32_t &MinTeamsVal, int32_t &MaxTeamsVal)
 Helper to determine the min/max number of threads/teams for D.
 
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.
 
llvm::Type * getIdentTyPointerTy ()
 Returns pointer to ident_t type.
 
llvm::Value * getThreadID (CodeGenFunction &CGF, SourceLocation Loc)
 Gets thread id value for the current thread.
 
std::string getOutlinedHelperName (StringRef Name) const
 Get the function name of an outlined region.
 
std::string getOutlinedHelperName (CodeGenFunction &CGF) const
 
std::string getReductionFuncName (StringRef Name) const
 Get the function name of a reduction function.
 
void emitCall (CodeGenFunction &CGF, SourceLocation Loc, llvm::FunctionCallee Callee, ArrayRef< llvm::Value * > Args=std::nullopt) const
 Emits Callee function call with arguments Args with location Loc.
 
virtual Address emitThreadIDAddress (CodeGenFunction &CGF, SourceLocation Loc)
 Emits address of the word in a memory where current thread id is stored.
 
void setLocThreadIdInsertPt (CodeGenFunction &CGF, bool AtCurrentPoint=false)
 
void clearLocThreadIdInsertPt (CodeGenFunction &CGF)
 
virtual bool isDefaultLocationConstant () const
 Check if the default location must be constant.
 
virtual unsigned getDefaultLocationReserved2Flags () const
 Returns additional flags that can be stored in reserved_2 field of the default location.
 
llvm::ArrayType * getKmpCriticalNameTy () const
 Get the LLVM type for the critical name.
 
llvm::Value * getCriticalRegionLock (StringRef CriticalName)
 Returns corresponding lock object for the specified critical region name.
 
void scanForTargetRegionsFunctions (const Stmt *S, StringRef ParentName)
 Start scanning from statement S and emit all target regions found along the way.
 
void emitKmpRoutineEntryT (QualType KmpInt32Ty)
 Build type kmp_routine_entry_t (if not built yet).
 
llvm::Type * getKmpc_MicroPointerTy ()
 Returns pointer to kmpc_micro type.
 
llvm::Constant * getOrCreateThreadPrivateCache (const VarDecl *VD)
 If the specified mangled name is not in the module, create and return threadprivate cache object.
 
void emitThreadPrivateVarInit (CodeGenFunction &CGF, Address VDAddr, llvm::Value *Ctor, llvm::Value *CopyCtor, llvm::Value *Dtor, SourceLocation Loc)
 Emits initialization code for the threadprivate variables.
 
void emitUDMapperArrayInitOrDel (CodeGenFunction &MapperCGF, llvm::Value *Handle, llvm::Value *BasePtr, llvm::Value *Ptr, llvm::Value *Size, llvm::Value *MapType, llvm::Value *MapName, CharUnits ElementSize, llvm::BasicBlock *ExitBB, bool IsInit)
 Emit the array initialization or deletion portion for user-defined mapper code generation.
 
TaskResultTy emitTaskInit (CodeGenFunction &CGF, SourceLocation Loc, const OMPExecutableDirective &D, llvm::Function *TaskFunction, QualType SharedsTy, Address Shareds, const OMPTaskDataTy &Data)
 Emit task region for the task directive.
 
void emitLastprivateConditionalUpdate (CodeGenFunction &CGF, LValue IVLVal, StringRef UniqueDeclName, LValue LVal, SourceLocation Loc)
 Emit update for lastprivate conditional data.
 
std::pair< llvm::Value *, LValuegetDepobjElements (CodeGenFunction &CGF, LValue DepobjLVal, SourceLocation Loc)
 Returns the number of the elements and the address of the depobj dependency array.
 
SmallVector< llvm::Value *, 4 > emitDepobjElementsSizes (CodeGenFunction &CGF, QualType &KmpDependInfoTy, const OMPTaskDataTy::DependData &Data)
 
void emitDepobjElements (CodeGenFunction &CGF, QualType &KmpDependInfoTy, LValue PosLVal, const OMPTaskDataTy::DependData &Data, Address DependenciesArray)
 

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.
 

Protected Attributes

CodeGenModuleCGM
 
llvm::OpenMPIRBuilder OMPBuilder
 An OpenMP-IR-Builder instance.
 
OpenMPDebugLocMapTy OpenMPDebugLocMap
 
llvm::FunctionType * Kmpc_MicroTy = nullptr
 The type for a microtask which gets passed to __kmpc_fork_call().
 
OpenMPLocThreadIDMapTy OpenMPLocThreadIDMap
 
UDRMapTy UDRMap
 
FunctionUDRMapTy FunctionUDRMap
 
llvm::DenseMap< const OMPDeclareMapperDecl *, llvm::Function * > UDMMap
 Map from the user-defined mapper declaration to its corresponding functions.
 
FunctionUDMMapTy FunctionUDMMap
 
llvm::DenseMap< llvm::Function *, llvm::DenseMap< CanonicalDeclPtr< const Decl >, std::tuple< QualType, const FieldDecl *, const FieldDecl *, LValue > > > LastprivateConditionalToTypes
 Maps local variables marked as lastprivate conditional to their internal types.
 
llvm::DenseMap< llvm::Function *, unsignedFunctionToUntiedTaskStackMap
 Maps function to the position of the untied task locals stack.
 
llvm::ArrayType * KmpCriticalNameTy
 Type kmp_critical_name, originally defined as typedef kmp_int32 kmp_critical_name[8];.
 
llvm::StringMap< llvm::AssertingVH< llvm::GlobalVariable >, llvm::BumpPtrAllocator > InternalVars
 An ordered map of auto-generated variables to their unique names.
 
llvm::Type * KmpRoutineEntryPtrTy = nullptr
 Type typedef kmp_int32 (* kmp_routine_entry_t)(kmp_int32, void *);.
 
QualType KmpRoutineEntryPtrQTy
 
QualType KmpTaskTQTy
 Type typedef struct kmp_task { void * shareds; /‍**< pointer to block of pointers to shared vars ‍/ kmp_routine_entry_t routine; /‍**< pointer to routine to call for executing task *‍/ kmp_int32 part_id; /‍**< part id for the task *‍/ kmp_routine_entry_t destructors; / pointer to function to invoke deconstructors of firstprivate C++ objects *‍/ } kmp_task_t;.
 
QualType SavedKmpTaskTQTy
 Saved kmp_task_t for task directive.
 
QualType SavedKmpTaskloopTQTy
 Saved kmp_task_t for taskloop-based directive.
 
QualType KmpDependInfoTy
 Type typedef struct kmp_depend_info { kmp_intptr_t base_addr; size_t len; struct { bool in:1; bool out:1; } flags; } kmp_depend_info_t;.
 
QualType KmpTaskAffinityInfoTy
 Type typedef struct kmp_task_affinity_info { kmp_intptr_t base_addr; size_t len; struct { bool flag1 : 1; bool flag2 : 1; kmp_int32 reserved : 30; } flags; } kmp_task_affinity_info_t;.
 
QualType KmpDimTy
 struct kmp_dim { // loop bounds info casted to kmp_int64 kmp_int64 lo; // lower kmp_int64 up; // upper kmp_int64 st; // stride };
 
bool ShouldMarkAsGlobal = true
 
llvm::DenseSet< CanonicalDeclPtr< const Decl > > AlreadyEmittedTargetDecls
 List of the emitted declarations.
 
llvm::StringMap< llvm::WeakTrackingVH > EmittedNonTargetVariables
 List of the global variables with their addresses that should not be emitted for the target.
 
llvm::SmallDenseSet< const VarDecl * > DeferredGlobalVariables
 List of variables that can become declare target implicitly and, thus, must be emitted.
 
llvm::SmallVector< NontemporalDeclsSet, 4 > NontemporalDeclsStack
 Stack for list of declarations in current context marked as nontemporal.
 
llvm::SmallVector< UntiedLocalVarsAddressesMap, 4 > UntiedLocalVarsStack
 
llvm::SmallVector< LastprivateConditionalData, 4 > LastprivateConditionalStack
 Stack for list of addresses of declarations in current context marked as lastprivate conditional.
 
bool HasRequiresUnifiedSharedMemory = false
 Flag for keeping track of weather a requires unified_shared_memory directive is present.
 
llvm::AtomicOrdering RequiresAtomicOrdering = llvm::AtomicOrdering::Monotonic
 Atomic ordering from the omp requires directive.
 
bool HasEmittedTargetRegion = false
 Flag for keeping track of weather a target region has been emitted.
 
bool HasEmittedDeclareTargetRegion = false
 Flag for keeping track of weather a device routine has been emitted.
 
llvm::StringSet ThreadPrivateWithDefinition
 Set of threadprivate variables with the generated initializer.
 
llvm::StringSet DeclareTargetWithDefinition
 Set of declare target variables with the generated initializer.
 

Detailed Description

Definition at line 229 of file CGOpenMPRuntime.h.

Member Typedef Documentation

◆ FunctionUDMMapTy

using clang::CodeGen::CGOpenMPRuntime::FunctionUDMMapTy = llvm::DenseMap<llvm::Function *, SmallVector<const OMPDeclareMapperDecl *, 4> >
protected

Map of functions and their local user-defined mappers.

Definition at line 420 of file CGOpenMPRuntime.h.

◆ FunctionUDRMapTy

typedef llvm::DenseMap<llvm::Function *, SmallVector<const OMPDeclareReductionDecl *, 4> > clang::CodeGen::CGOpenMPRuntime::FunctionUDRMapTy
protected

Map of functions and locally defined UDRs.

Definition at line 414 of file CGOpenMPRuntime.h.

◆ NontemporalDeclsSet

using clang::CodeGen::CGOpenMPRuntime::NontemporalDeclsSet = llvm::SmallDenseSet<CanonicalDeclPtr<const Decl> >
protected

Definition at line 497 of file CGOpenMPRuntime.h.

◆ OpenMPDebugLocMapTy

typedef llvm::DenseMap<SourceLocation, llvm::Value *> clang::CodeGen::CGOpenMPRuntime::OpenMPDebugLocMapTy
protected

Map for SourceLocation and OpenMP runtime library debug locations.

Definition at line 389 of file CGOpenMPRuntime.h.

◆ OpenMPLocThreadIDMapTy

typedef llvm::DenseMap<llvm::Function *, DebugLocThreadIdTy> clang::CodeGen::CGOpenMPRuntime::OpenMPLocThreadIDMapTy
protected

Map of local debug location, ThreadId and functions.

Definition at line 404 of file CGOpenMPRuntime.h.

◆ UDRMapTy

typedef llvm::DenseMap<const OMPDeclareReductionDecl *, std::pair<llvm::Function *, llvm::Function *> > clang::CodeGen::CGOpenMPRuntime::UDRMapTy
protected

Map of UDRs and corresponding combiner/initializer.

Definition at line 409 of file CGOpenMPRuntime.h.

◆ UntiedLocalVarsAddressesMap

Definition at line 502 of file CGOpenMPRuntime.h.

Constructor & Destructor Documentation

◆ CGOpenMPRuntime()

CGOpenMPRuntime::CGOpenMPRuntime ( CodeGenModule CGM)
explicit

◆ ~CGOpenMPRuntime()

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

Definition at line 628 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 10037 of file CGOpenMPRuntime.cpp.

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

Referenced by emitOMPSimdRegion(), emitTargetParallelRegion(), emitTargetRegion(), and emitTargetTeamsRegion().

◆ 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

◆ clear()

void CGOpenMPRuntime::clear ( )
virtual

Definition at line 1056 of file CGOpenMPRuntime.cpp.

References clang::Data, EmittedNonTargetVariables, and InternalVars.

◆ clearLocThreadIdInsertPt()

void CGOpenMPRuntime::clearLocThreadIdInsertPt ( CodeGenFunction CGF)
protected

Definition at line 1344 of file CGOpenMPRuntime.cpp.

References clang::CodeGen::CodeGenFunction::CurFn, and OpenMPLocThreadIDMap.

Referenced by functionFinished().

◆ computeMinAndMaxThreadsAndTeams()

void CGOpenMPRuntime::computeMinAndMaxThreadsAndTeams ( const OMPExecutableDirective D,
CodeGenFunction CGF,
int32_t &  MinThreadsVal,
int32_t &  MaxThreadsVal,
int32_t &  MinTeamsVal,
int32_t &  MaxTeamsVal 
)
protected

◆ createOffloadEntriesAndInfoMetadata()

void CGOpenMPRuntime::createOffloadEntriesAndInfoMetadata ( )

◆ emitBarrierCall()

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

◆ emitCall()

void CGOpenMPRuntime::emitCall ( CodeGenFunction CGF,
SourceLocation  Loc,
llvm::FunctionCallee  Callee,
ArrayRef< llvm::Value * >  Args = std::nullopt 
) 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 5744 of file CGOpenMPRuntime.cpp.

References clang::CodeGen::CodeGenFunction::CapturedStmtInfo, CGM, emitBarrierCall(), emitIfClause(), emitUpdateLocation(), getCancellationKind(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::CodeGenModule::getOpenMPRuntime(), getThreadID(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), Loc, OMPBuilder, and clang::Result.

◆ 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

◆ emitDeclareTargetFunction()

void CGOpenMPRuntime::emitDeclareTargetFunction ( const FunctionDecl FD,
llvm::GlobalValue *  GV 
)
virtual

◆ emitDeferredTargetDecls()

void CGOpenMPRuntime::emitDeferredTargetDecls ( ) const

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

References clang::CharUnits::alignTo(), clang::CodeGen::CodeGenFunction::Builder, clang::C, CGM, clang::CodeGen::CodeGenFunction::ConvertTypeForMem(), clang::CodeGen::CGBuilderTy::CreateConstGEP(), clang::CodeGen::CodeGenFunction::CreateMemTemp(), clang::CodeGen::CGBuilderTy::CreatePointerBitCastOrAddrSpaceCast(), clang::CodeGen::OMPTaskDataTy::DependData::DepExprs, emitDependData(), clang::CodeGen::CodeGenFunction::EmitLValueForField(), clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), clang::CodeGen::CodeGenFunction::EmitScalarExpr(), clang::CodeGen::CodeGenFunction::EmitStoreOfScalar(), clang::RecordDecl::field_begin(), clang::Type::getAsTagDecl(), clang::CodeGen::CodeGenModule::getContext(), getDependTypes(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::CodeGenModule::getSize(), getThreadID(), clang::CodeGen::CodeGenTypeCache::Int8Ty, clang::CodeGen::CodeGenTypeCache::IntPtrTy, clang::CodeGen::Address::invalid(), clang::CodeGen::OMPTaskDataTy::DependData::IteratorExpr, KmpDependInfoTy, Loc, clang::CodeGen::CodeGenFunction::MakeAddrLValue(), clang::Normal, clang::OMPIteratorExpr::numOfIterators(), OMPBuilder, clang::CodeGen::CodeGenTypeCache::SizeTy, and clang::CodeGen::CodeGenTypeCache::VoidPtrTy.

◆ emitDepobjElements()

void CGOpenMPRuntime::emitDepobjElements ( CodeGenFunction CGF,
QualType KmpDependInfoTy,
LValue  PosLVal,
const OMPTaskDataTy::DependData Data,
Address  DependenciesArray 
)
protected

◆ emitDepobjElementsSizes()

SmallVector< llvm::Value *, 4 > CGOpenMPRuntime::emitDepobjElementsSizes ( CodeGenFunction CGF,
QualType KmpDependInfoTy,
const OMPTaskDataTy::DependData Data 
)
protected

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

References addFieldToRecordDecl(), clang::CodeGen::CodeGenFunction::Builder, clang::C, 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::Address::emitRawPointer(), 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(), getThreadID(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), clang::CodeGen::CodeGenTypeCache::Int32Ty, clang::CodeGen::CodeGenTypeCache::Int64Ty, clang::QualType::isNull(), KmpDimTy, clang::CodeGen::CodeGenFunction::MakeAddrLValue(), clang::Normal, clang::CodeGen::NormalAndEHCleanup, OMPBuilder, clang::TagDecl::startDefinition(), and clang::CodeGen::CodeGenTypeCache::VoidPtrTy.

◆ emitDoacrossOrdered() [1/2]

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

Emit code for doacross ordered directive with 'depend' clause.

Parameters
C'depend' clause with 'sink|source' dependency kind.

Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.

Definition at line 11210 of file CGOpenMPRuntime.cpp.

References clang::C, CGM, emitUpdateLocation(), and getThreadID().

◆ emitDoacrossOrdered() [2/2]

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

Emit code for doacross ordered directive with 'doacross' clause.

Parameters
C'doacross' clause with 'sink|source' dependence type.

Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.

Definition at line 11217 of file CGOpenMPRuntime.cpp.

References clang::C, CGM, emitUpdateLocation(), and getThreadID().

◆ emitErrorCall()

void CGOpenMPRuntime::emitErrorCall ( CodeGenFunction CGF,
SourceLocation  Loc,
Expr ME,
bool  IsFatal 
)
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 2522 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, Loc, clang::OpenMPScheduleTy::M1, clang::OpenMPScheduleTy::M2, OMPBuilder, 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 2692 of file CGOpenMPRuntime.cpp.

References clang::ASTContext::BoolTy, clang::Call, clang::CodeGen::Address::emitRawPointer(), clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), clang::CodeGen::CodeGenFunction::EmitScalarConversion(), emitUpdateLocation(), clang::CodeGen::CodeGenFunction::getContext(), clang::ASTContext::getIntTypeForBitwidth(), getThreadID(), Loc, and OMPBuilder.

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

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

◆ 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 2605 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, Loc, clang::OpenMPScheduleTy::M1, clang::OpenMPScheduleTy::M2, OMPBuilder, 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 11245 of file CGOpenMPRuntime.cpp.

References HasEmittedDeclareTargetRegion.

◆ 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

◆ emitKmpRoutineEntryT()

void CGOpenMPRuntime::emitKmpRoutineEntryT ( QualType  KmpInt32Ty)
protected

◆ emitLastprivateConditionalFinalUpdate()

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

◆ emitLastprivateConditionalInit()

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

◆ emitLastprivateConditionalUpdate()

void CGOpenMPRuntime::emitLastprivateConditionalUpdate ( CodeGenFunction CGF,
LValue  IVLVal,
StringRef  UniqueDeclName,
LValue  LVal,
SourceLocation  Loc 
)
protected

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

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

Referenced by emitMaster().

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

References clang::CodeGen::CodeGenFunction::Builder, CGM, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), clang::CodeGen::CodeGenFunction::EmitScalarExpr(), emitUpdateLocation(), clang::CodeGen::CodeGenModule::getModule(), getThreadID(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), clang::CodeGen::CodeGenTypeCache::Int32Ty, Loc, and OMPBuilder.

Referenced by emitCommonOMPTeamsDirective().

◆ emitNumTeamsForTargetDirective()

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

◆ 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 2715 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, Loc, and OMPBuilder.

Referenced by emitCommonOMPParallelDirective().

◆ emitNumThreadsForTargetDirective()

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

Emit an expression that denotes the number of threads a target region shall use.

Will generate "i32 0" to allow the runtime to choose.

Definition at line 6440 of file CGOpenMPRuntime.cpp.

References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::EmitScalarExpr(), getNumThreadsExprForTargetDirective(), and clang::CodeGen::CodeGenTypeCache::Int32Ty.

Referenced by emitTargetCallKernelLaunch().

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

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

◆ emitOutlinedFunctionCall()

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

References emitCall(), and Loc.

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

◆ emitParallelCall()

void CGOpenMPRuntime::emitParallelCall ( CodeGenFunction CGF,
SourceLocation  Loc,
llvm::Function *  OutlinedFn,
ArrayRef< llvm::Value * >  CapturedVars,
const Expr IfCond,
llvm::Value *  NumThreads 
)
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.
NumThreadsThe value corresponding to the num_threads clause, if any, or nullptr.

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

Definition at line 1866 of file CGOpenMPRuntime.cpp.

References clang::CodeGen::CodeGenFunction::Builder, CGM, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::CreateDefaultAlignTempAlloca(), clang::CodeGen::CGBuilderTy::CreateStore(), emitIfClause(), emitOutlinedFunctionCall(), clang::CodeGen::Address::emitRawPointer(), clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), emitThreadIDAddress(), emitUpdateLocation(), getKmpc_MicroPointerTy(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::CodeGenModule::getOpenMPRuntime(), clang::CodeGen::RawAddress::getPointer(), getThreadID(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), clang::CodeGen::CodeGenTypeCache::Int32Ty, Loc, and OMPBuilder.

Referenced by emitCommonOMPParallelDirective().

◆ emitParallelOutlinedFunction()

llvm::Function * CGOpenMPRuntime::emitParallelOutlinedFunction ( CodeGenFunction CGF,
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
CGFReference to current CodeGenFunction.
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 1261 of file CGOpenMPRuntime.cpp.

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

Referenced by emitCommonOMPParallelDirective(), and clang::CodeGen::CGOpenMPRuntimeGPU::emitParallelOutlinedFunction().

◆ emitProcBindClause()

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

Emit call to void __kmpc_push_proc_bind(ident_t *loc, kmp_int32 global_tid, int proc_bind) to generate code for 'proc_bind' clause.

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

Definition at line 2729 of file CGOpenMPRuntime.cpp.

References CGM, clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), emitUpdateLocation(), clang::CodeGen::CodeGenModule::getModule(), getThreadID(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), clang::CodeGen::CodeGenTypeCache::IntTy, Loc, and OMPBuilder.

Referenced by emitCommonOMPParallelDirective().

◆ 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:;
}
The base class of the type hierarchy.
Definition: Type.h:1813
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 4919 of file CGOpenMPRuntime.cpp.

References clang::CodeGen::CodeGenFunction::OMPPrivateScope::addPrivate(), clang::CodeGen::CodeGenFunction::Builder, clang::C, CGM, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::ConvertTypeForMem(), clang::CodeGen::CodeGenFunction::createBasicBlock(), clang::CodeGen::CGBuilderTy::CreateConstArrayGEP(), clang::CodeGen::CodeGenFunction::CreateMemTemp(), clang::CodeGen::CGBuilderTy::CreatePointerBitCastOrAddrSpaceCast(), clang::CodeGen::CGBuilderTy::CreateStore(), clang::CodeGen::CodeGenFunction::CurFn, clang::CodeGen::CodeGenFunction::EmitBlock(), clang::CodeGen::CodeGenFunction::EmitBranch(), emitCriticalRegion(), clang::CodeGen::CodeGenFunction::EmitLValue(), EmitOMPAggregateReduction(), emitReductionCombiner(), emitReductionFunction(), clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), emitSingleReductionCombiner(), emitUpdateLocation(), clang::CodeGen::PrePostActionTy::Enter(), clang::ASTContext::getAsVariableArrayType(), clang::CodeGen::CodeGenFunction::getContext(), clang::CodeGen::CodeGenModule::getContext(), getCriticalRegionLock(), clang::CodeGen::CodeGenModule::getModule(), getName(), clang::CodeGen::CodeGenModule::getOpenMPRuntime(), clang::CodeGen::RawAddress::getPointer(), clang::CodeGen::LValue::getPointer(), getThreadID(), clang::Expr::getType(), clang::CodeGen::Address::getType(), clang::CodeGen::CodeGenFunction::getTypeSize(), clang::CodeGen::CodeGenFunction::getVLASize(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), clang::Expr::IgnoreParenImpCasts(), clang::Type::isVariablyModifiedType(), Loc, clang::Normal, clang::CodeGen::CodeGenFunction::VlaSizePair::NumElts, OMPBuilder, clang::CodeGen::CodeGenFunction::OMPPrivateScope::Privatize(), clang::CodeGen::RegionCodeGenTy::setAction(), clang::CodeGen::CodeGenTypeCache::SizeTy, clang::CodeGen::CodeGenTypeCache::VoidPtrTy, and X.

Referenced by clang::CodeGen::CGOpenMPSIMDRuntime::emitReduction(), and clang::CodeGen::CGOpenMPRuntimeGPU::emitReduction().

◆ emitReductionFunction()

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

Emits reduction function.

Parameters
ReducerNameName of the function calling the reduction.
ArgsElemTypeArray 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 4809 of file CGOpenMPRuntime.cpp.

References clang::CodeGen::CodeGenTypes::arrangeBuiltinFunctionDeclaration(), clang::CodeGen::CodeGenFunction::Builder, clang::C, CGM, clang::CodeGen::CGBuilderTy::CreateConstArrayGEP(), clang::CodeGen::CGBuilderTy::CreateLoad(), clang::CodeGen::CGBuilderTy::CreatePointerBitCastOrAddrSpaceCast(), emitAddrOfVarFromArray(), EmitOMPAggregateReduction(), emitReductionCombiner(), clang::CodeGen::CodeGenFunction::EmitVariablyModifiedType(), clang::CodeGen::CodeGenFunction::FinishFunction(), clang::CodeGen::RValue::get(), clang::CodeGen::CodeGenFunction::GetAddrOfLocalVar(), clang::ASTContext::getAsVariableArrayType(), clang::CodeGen::CodeGenFunction::getContext(), clang::CodeGen::CodeGenModule::getContext(), clang::CodeGen::CodeGenTypes::GetFunctionType(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::CodeGenTypeCache::getPointerAlign(), getReductionFuncName(), clang::VariableArrayType::getSizeExpr(), clang::CodeGen::CodeGenModule::getTypes(), clang::Type::isVariablyModifiedType(), Loc, clang::Other, clang::CodeGen::CodeGenModule::SetInternalFunctionAttributes(), clang::CodeGen::CodeGenTypeCache::SizeTy, and clang::CodeGen::CodeGenFunction::StartFunction().

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

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

References CGM, clang::Device, emitIfClause(), emitInlinedDirective(), emitTargetCallElse(), emitTargetCallKernelLaunch(), clang::CodeGen::CodeGenFunction::GenerateOpenMPCapturedVars(), clang::OMPExecutableDirective::getCapturedStmt(), clang::OMPExecutableDirective::getDirectiveKind(), clang::CodeGen::CodeGenModule::getLangOpts(), clang::OMPExecutableDirective::hasClausesOfKind(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), and clang::needsTaskBasedThreadLimit().

Referenced by emitCommonOMPTargetDirective().

◆ emitTargetDataCalls()

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

◆ emitTargetDataStandAloneCall()

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

Emit the data mapping/movement code associated with the directive D that should be of the form 'target [{enter|exit} data | update]'.

Parameters
DDirective to emit.
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.

Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.

Definition at line 10307 of file CGOpenMPRuntime.cpp.

References clang::CodeGen::CodeGenFunction::OMPTargetDataInfo::BasePointersArray, clang::CodeGen::CodeGenFunction::Builder, CGM, clang::CodeGen::CodeGenFunction::CGM, clang::Device, emitIfClause(), emitInlinedDirective(), emitOffloadingArrays(), clang::CodeGen::CodeGenFunction::EmitOMPTargetTaskBasedDirective(), clang::CodeGen::Address::emitRawPointer(), clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), clang::CodeGen::CodeGenFunction::EmitScalarExpr(), emitUpdateLocation(), clang::OMPExecutableDirective::getBeginLoc(), clang::CodeGen::CodeGenModule::getCodeGenOpts(), clang::OMPExecutableDirective::getDirectiveKind(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::CodeGenTypeCache::getPointerAlign(), clang::OMPExecutableDirective::hasClausesOfKind(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), clang::CodeGen::CodeGenTypeCache::Int64Ty, clang::CodeGen::CodeGenFunction::OMPTargetDataInfo::MappersArray, clang::CodeGen::CodeGenFunction::OMPTargetDataInfo::NumberOfTargetItems, OMPBuilder, clang::CodeGen::CodeGenFunction::OMPTargetDataInfo::PointersArray, clang::CodeGen::CodeGenFunction::OMPTargetDataInfo::SizesArray, and clang::CodeGen::CodeGenTypeCache::VoidPtrTy.

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

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

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

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

◆ emitTargetGlobalVariable()

bool CGOpenMPRuntime::emitTargetGlobalVariable ( GlobalDecl  GD)
virtual

◆ emitTargetNumIterationsCall()

llvm::Value * CGOpenMPRuntime::emitTargetNumIterationsCall ( CodeGenFunction CGF,
const OMPExecutableDirective D,
llvm::function_ref< llvm::Value *(CodeGenFunction &CGF, const OMPLoopDirective &D)>  SizeEmitter 
)

Return the trip count of loops associated with constructs / 'target teams distribute' and 'teams distribute parallel for'.

Parameters
SizeEmitterEmits the int64 value for the number of iterations of the associated loop.

Definition at line 9385 of file CGOpenMPRuntime.cpp.

References CGM, clang::CodeGen::CodeGenModule::getContext(), clang::OMPExecutableDirective::getDirectiveKind(), getNestedDistributeDirective(), clang::CodeGen::CodeGenTypeCache::Int64Ty, clang::isOpenMPDistributeDirective(), and clang::isOpenMPTeamsDirective().

Referenced by emitTargetCallKernelLaunch().

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

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

Referenced by emitCommonOMPTargetDirective().

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

References clang::C, CGM, clang::CodeGen::CodeGenFunction::GenerateOpenMPCapturedStmtFunction(), clang::OMPExecutableDirective::getBeginLoc(), clang::OMPExecutableDirective::getCapturedStmt(), clang::OMPExecutableDirective::getClausesOfKind(), getEntryInfoFromPresumedLoc(), clang::CodeGen::CodeGenModule::getTargetCodeGenInfo(), clang::CodeGen::CodeGenModule::handleAMDGPUWavesPerEUAttr(), OMPBuilder, and clang::CodeGen::TargetCodeGenInfo::setTargetAttributes().

Referenced by emitTargetOutlinedFunction().

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

References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::CapturedStmtInfo, CGM, clang::Data, emitDependClause(), emitIfClause(), clang::CodeGen::CodeGenFunction::EmitLValueForField(), clang::CodeGen::Address::emitRawPointer(), clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), clang::CodeGen::CodeGenFunction::EmitStoreOfScalar(), emitTaskInit(), emitUpdateLocation(), clang::RecordDecl::field_begin(), clang::CodeGen::CodeGenModule::getModule(), getThreadID(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), clang::CodeGen::CodeGenTypeCache::Int32Ty, clang::CodeGen::Address::invalid(), Loc, OMPBuilder, clang::Result, clang::CodeGen::RegionCodeGenTy::setAction(), 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 2108 of file CGOpenMPRuntime.cpp.

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

◆ emitTaskInit()

CGOpenMPRuntime::TaskResultTy CGOpenMPRuntime::emitTaskInit ( CodeGenFunction CGF,
SourceLocation  Loc,
const OMPExecutableDirective D,
llvm::Function *  TaskFunction,
QualType  SharedsTy,
Address  Shareds,
const OMPTaskDataTy Data 
)
protected

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.
    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.
    DataAdditional data for task generation like tiednsee, final state, list of privates etc.

Definition at line 3604 of file CGOpenMPRuntime.cpp.

References clang::CodeGen::CodeGenFunction::Builder, clang::C, CGM, checkDestructorsRequired(), checkInitIsRequired(), clang::CodeGen::CodeGenFunction::ConvertType(), clang::ImplicitParamDecl::Create(), clang::CodeGen::CGBuilderTy::CreateConstArrayGEP(), clang::CodeGen::CGBuilderTy::CreateConstGEP(), clang::CodeGen::CGBuilderTy::CreateGEP(), createKmpTaskTRecordDecl(), createKmpTaskTWithPrivatesRecordDecl(), clang::CodeGen::CodeGenFunction::CreateMemTemp(), clang::CodeGen::CGBuilderTy::CreatePointerBitCastOrAddrSpaceCast(), clang::Data, clang::Device, clang::CodeGen::AggValueSlot::DoesNotOverlap, clang::CodeGen::CodeGenFunction::EmitAggregateCopy(), emitDestructorsFunction(), emitKmpRoutineEntryT(), clang::CodeGen::CodeGenFunction::EmitLoadOfScalar(), clang::CodeGen::CodeGenFunction::EmitLValue(), clang::CodeGen::CodeGenFunction::EmitLValueForField(), emitPrivatesInit(), emitProxyTaskFunction(), clang::CodeGen::Address::emitRawPointer(), clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), clang::CodeGen::CodeGenFunction::EmitScalarConversion(), clang::CodeGen::CodeGenFunction::EmitScalarExpr(), clang::CodeGen::CodeGenFunction::EmitStoreOfScalar(), emitTaskDupFunction(), emitTaskPrivateMappingFunction(), emitUpdateLocation(), clang::CodeGen::CodeGenFunction::EmitVarDecl(), clang::RecordDecl::field_begin(), clang::RecordDecl::field_empty(), clang::CodeGen::RValue::get(), clang::CodeGen::CodeGenFunction::GetAddrOfLocalVar(), clang::Type::getAsRecordDecl(), clang::Type::getAsStructureType(), clang::Type::getAsTagDecl(), clang::OMPExecutableDirective::getClausesOfKind(), clang::CodeGen::CodeGenModule::getContext(), clang::RecordType::getDecl(), clang::OMPExecutableDirective::getDirectiveKind(), clang::Expr::getExprLoc(), getKmpAffinityType(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::CodeGenModule::getNaturalTypeAlignment(), clang::CodeGen::CodeGenTypeCache::getPointerAlign(), getPointerAndSize(), clang::OMPExecutableDirective::getSingleClause(), clang::CodeGen::CodeGenModule::getSize(), getThreadID(), clang::Expr::getType(), clang::CodeGen::CodeGenFunction::getTypeSize(), clang::OMPExecutableDirective::hasClausesOfKind(), clang::Expr::IgnoreParenImpCasts(), clang::CodeGen::CodeGenTypeCache::Int32Ty, clang::CodeGen::CodeGenTypeCache::Int64Ty, clang::CodeGen::CodeGenTypeCache::Int8Ty, clang::CodeGen::CodeGenTypeCache::IntPtrTy, clang::CodeGen::CodeGenTypeCache::IntTy, clang::CodeGen::Address::invalid(), isAllocatableDecl(), clang::QualType::isNull(), clang::isOpenMPTargetDataManagementDirective(), clang::isOpenMPTargetExecutionDirective(), clang::isOpenMPTaskLoopDirective(), KmpRoutineEntryPtrQTy, KmpRoutineEntryPtrTy, KmpTaskAffinityInfoTy, KmpTaskTQTy, Loc, clang::CodeGen::CodeGenFunction::MakeAddrLValue(), clang::CodeGen::CodeGenFunction::MakeNaturalAlignRawAddrLValue(), clang::Normal, OMPBuilder, clang::Other, Priority, clang::Result, SavedKmpTaskloopTQTy, SavedKmpTaskTQTy, clang::CodeGen::CodeGenTypeCache::SizeTy, clang::VK_PRValue, and clang::CodeGen::CodeGenTypeCache::VoidPtrTy.

Referenced by emitTaskCall(), and emitTaskLoopCall().

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

References clang::CodeGen::CodeGenFunction::Builder, CGM, clang::CodeGen::CGBuilderTy::CreatePointerBitCastOrAddrSpaceCast(), clang::Data, clang::CodeGen::CodeGenFunction::EmitAnyExprToMem(), clang::CodeGen::CodeGenFunction::EmitLoadOfScalar(), clang::CodeGen::CodeGenFunction::EmitLValueForField(), clang::CodeGen::CodeGenFunction::EmitNullInitialization(), clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), clang::CodeGen::CodeGenFunction::EmitStoreOfScalar(), emitTaskInit(), emitUpdateLocation(), clang::CodeGen::CodeGenFunction::EvaluateExprAsBool(), clang::CodeGen::LValue::getAddress(), clang::CodeGen::CodeGenFunction::getContext(), clang::OMPLoopDirective::getLowerBoundVariable(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::LValue::getPointer(), clang::CodeGen::LValue::getQuals(), clang::OMPLoopDirective::getStrideVariable(), getThreadID(), clang::OMPLoopDirective::getUpperBoundVariable(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), clang::CodeGen::CodeGenTypeCache::Int64Ty, clang::CodeGen::CodeGenTypeCache::IntTy, Loc, OMPBuilder, clang::Result, clang::ASTContext::VoidPtrTy, and clang::CodeGen::CodeGenTypeCache::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 1281 of file CGOpenMPRuntime.cpp.

References clang::Type::castAs(), CGM, emitUpdateLocation(), 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 5558 of file CGOpenMPRuntime.cpp.

References clang::CodeGen::CodeGenFunction::Builder, CGM, clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), emitUpdateLocation(), clang::CodeGen::CodeGenModule::getModule(), getThreadID(), clang::CodeGen::CodeGenTypeCache::IntTy, Loc, and OMPBuilder.

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

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

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

References addFieldToRecordDecl(), clang::CodeGen::CodeGenFunction::Builder, clang::C, CGM, clang::RecordDecl::completeDefinition(), clang::CodeGen::CodeGenFunction::CreateMemTemp(), clang::CodeGen::CGBuilderTy::CreatePointerBitCastOrAddrSpaceCast(), clang::Data, clang::CodeGen::ReductionCodeGen::emitAggregateType(), clang::CodeGen::CodeGenFunction::EmitCheckedInBoundsGEP(), clang::CodeGen::CodeGenFunction::EmitLValueForField(), clang::CodeGen::CodeGenFunction::EmitNullInitialization(), emitReduceCombFunction(), emitReduceFiniFunction(), emitReduceInitFunction(), clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), clang::CodeGen::ReductionCodeGen::emitSharedOrigLValue(), clang::CodeGen::CodeGenFunction::EmitStoreOfScalar(), emitUpdateLocation(), clang::CodeGen::LValue::getAddress(), clang::CodeGen::CodeGenModule::getContext(), clang::CodeGen::RawAddress::getElementType(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::ReductionCodeGen::getOrigLValue(), clang::CodeGen::RawAddress::getPointer(), clang::CodeGen::LValue::getPointer(), clang::CodeGen::ReductionCodeGen::getSharedLValue(), clang::CodeGen::ReductionCodeGen::getSizes(), getThreadID(), clang::CodeGen::LValue::getType(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), clang::CodeGen::CodeGenTypeCache::Int32Ty, clang::CodeGen::CodeGenTypeCache::IntTy, Loc, clang::CodeGen::CodeGenFunction::MakeNaturalAlignRawAddrLValue(), clang::Normal, OMPBuilder, clang::CodeGen::CodeGenTypeCache::SizeTy, clang::TagDecl::startDefinition(), and clang::CodeGen::CodeGenTypeCache::VoidPtrTy.

◆ emitTaskwaitCall()

void CGOpenMPRuntime::emitTaskwaitCall ( CodeGenFunction CGF,
SourceLocation  Loc,
const OMPTaskDataTy Data 
)
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 10134 of file CGOpenMPRuntime.cpp.

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

Referenced by emitCommonOMPTeamsDirective().

◆ emitTeamsOutlinedFunction()

llvm::Function * CGOpenMPRuntime::emitTeamsOutlinedFunction ( CodeGenFunction CGF,
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
CGFReference to current CodeGenFunction.
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 1271 of file CGOpenMPRuntime.cpp.

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

Referenced by emitCommonOMPTeamsDirective(), and clang::CodeGen::CGOpenMPRuntimeGPU::emitTeamsOutlinedFunction().

◆ emitThreadIDAddress()

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

◆ emitThreadLimitClause()

void CGOpenMPRuntime::emitThreadLimitClause ( CodeGenFunction CGF,
const Expr ThreadLimit,
SourceLocation  Loc 
)
virtual

Emits call to void __kmpc_set_thread_limit(ident_t *loc, kmp_int32 global_tid, kmp_int32 thread_limit) to generate code for thread_limit clause on target directive.

Parameters
ThreadLimitAn integer expression of threads.

Definition at line 10188 of file CGOpenMPRuntime.cpp.

References clang::CodeGen::CodeGenFunction::Builder, CGM, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), clang::CodeGen::CodeGenFunction::EmitScalarExpr(), emitUpdateLocation(), clang::CodeGen::CodeGenModule::getModule(), getThreadID(), clang::CodeGen::CodeGenTypeCache::Int32Ty, Loc, and OMPBuilder.

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

References clang::CodeGen::CodeGenTypes::arrangeBuiltinFunctionDeclaration(), clang::CodeGen::CodeGenTypes::arrangeNullaryFunction(), clang::CodeGen::CodeGenFunction::Builder, CGM, clang::CodeGen::CodeGenFunction::ConvertTypeForMem(), clang::CodeGen::ApplyDebugLocation::CreateArtificial(), clang::CodeGen::ApplyDebugLocation::CreateEmpty(), clang::CodeGen::CodeGenModule::CreateGlobalInitOrCleanUpFunction(), clang::CodeGen::CGBuilderTy::CreateStore(), clang::QualType::DK_none, clang::CodeGen::CodeGenFunction::EmitAnyExprToMem(), clang::CodeGen::CodeGenFunction::emitDestroy(), clang::CodeGen::CodeGenFunction::EmitLoadOfScalar(), emitThreadPrivateVarInit(), clang::CodeGen::CodeGenFunction::FinishFunction(), clang::CodeGen::CodeGenFunction::GetAddrOfLocalVar(), clang::CodeGen::Address::getAlignment(), clang::VarDecl::getAnyInitializer(), clang::CodeGen::CodeGenModule::getContext(), clang::VarDecl::getDefinition(), clang::CodeGen::CodeGenFunction::getDestroyer(), clang::CodeGen::CodeGenTypes::GetFunctionType(), clang::CodeGen::CodeGenModule::getLangOpts(), clang::Decl::getLocation(), clang::CodeGen::CodeGenModule::getMangledName(), getName(), clang::ASTContext::getTargetInfo(), clang::ValueDecl::getType(), clang::CodeGen::CodeGenModule::getTypes(), clang::Init, clang::CodeGen::CodeGenTypeCache::Int8Ty, clang::QualType::isDestructedType(), clang::TargetInfo::isTLSSupported(), Loc, clang::CodeGen::CodeGenFunction::needsEHCleanup(), clang::Other, clang::CodeGen::CodeGenFunction::ReturnValue, clang::CodeGen::CodeGenFunction::StartFunction(), ThreadPrivateWithDefinition, clang::ASTContext::VoidPtrTy, clang::CodeGen::CodeGenTypeCache::VoidPtrTy, clang::ASTContext::VoidTy, and clang::CodeGen::CodeGenTypeCache::VoidTy.

◆ emitThreadPrivateVarInit()

void CGOpenMPRuntime::emitThreadPrivateVarInit ( CodeGenFunction CGF,
Address  VDAddr,
llvm::Value *  Ctor,
llvm::Value *  CopyCtor,
llvm::Value *  Dtor,
SourceLocation  Loc 
)
protected

Emits initialization code for the threadprivate variables.

Parameters
VDAddrAddress of the global variable VD.
CtorPointer to a global init function for VD.
CopyCtorPointer to a global copy function for VD.
DtorPointer to a global destructor function for VD.
LocLocation of threadprivate declaration.

Definition at line 1618 of file CGOpenMPRuntime.cpp.

References clang::CodeGen::CodeGenFunction::Builder, CGM, clang::CodeGen::Address::emitRawPointer(), clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), emitUpdateLocation(), clang::CodeGen::CodeGenModule::getModule(), Loc, OMPBuilder, and clang::CodeGen::CodeGenTypeCache::VoidPtrTy.

Referenced by emitThreadPrivateVarDefinition().

◆ emitUDMapperArrayInitOrDel()

void CGOpenMPRuntime::emitUDMapperArrayInitOrDel ( CodeGenFunction MapperCGF,
llvm::Value *  Handle,
llvm::Value *  Base,
llvm::Value *  Begin,
llvm::Value *  Size,
llvm::Value *  MapType,
llvm::Value *  MapName,
CharUnits  ElementSize,
llvm::BasicBlock *  ExitBB,
bool  IsInit 
)
protected

Emit the array initialization or deletion portion for user-defined mapper code generation.

First, it evaluates whether an array section is mapped and whether the MapType instructs to delete this section. If IsInit is true, and MapType indicates to not delete this array, array initialization code is generated. If IsInit is false, and MapType indicates to not this array, array deletion code is generated.

Definition at line 9306 of file CGOpenMPRuntime.cpp.

References Begin, clang::CodeGen::CodeGenFunction::Builder, CGM, clang::CodeGen::CodeGenFunction::createBasicBlock(), clang::CodeGen::CGBuilderTy::CreateIsNull(), clang::CodeGen::CodeGenFunction::EmitBlock(), clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), clang::CodeGen::CodeGenModule::getModule(), getName(), clang::CharUnits::getQuantity(), and OMPBuilder.

Referenced by emitUserDefinedMapper().

◆ emitUpdateClause()

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

◆ emitUpdateLocation()

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

Emits object of ident_t type with info for source location.

Parameters
FlagsFlags for OpenMP location.
EmitLocemit source location with debug-info is off.

Definition at line 1366 of file CGOpenMPRuntime.cpp.

References CGM, clang::Column, clang::CodeGen::CodeGenFunction::CurFuncDecl, clang::FileName, clang::CodeGen::CodeGenModule::getCodeGenOpts(), clang::PresumedLoc::getColumn(), clang::CodeGen::CodeGenFunction::getContext(), getDefaultLocationReserved2Flags(), clang::PresumedLoc::getFilename(), clang::PresumedLoc::getLine(), clang::SourceManager::getPresumedLoc(), clang::ASTContext::getSourceManager(), clang::SourceLocation::isInvalid(), clang::Line, Loc, and OMPBuilder.

Referenced by emitBarrierCall(), clang::CodeGen::CGOpenMPRuntimeGPU::emitBarrierCall(), emitCancelCall(), emitCancellationPointCall(), emitCriticalRegion(), emitDistributeStaticInit(), emitDoacrossInit(), emitDoacrossOrdered(), emitErrorCall(), emitFlush(), emitForDispatchInit(), emitForNext(), emitForOrderedIterationEnd(), emitForStaticFinish(), emitForStaticInit(), emitMaskedRegion(), emitMasterRegion(), emitNumTeamsClause(), emitNumThreadsClause(), emitOrderedRegion(), emitParallelCall(), clang::CodeGen::CGOpenMPRuntimeGPU::emitParallelCall(), emitProcBindClause(), emitReduction(), clang::CodeGen::CGOpenMPRuntimeGPU::emitReduction(), emitSingleRegion(), emitTargetCallKernelLaunch(), emitTargetDataCalls(), emitTargetDataStandAloneCall(), emitTaskCall(), emitTaskgroupRegion(), emitTaskInit(), emitTaskLoopCall(), emitTaskOutlinedFunction(), emitTaskReductionFini(), emitTaskReductionInit(), emitTaskwaitCall(), emitTaskyieldCall(), emitTeamsCall(), emitThreadLimitClause(), emitThreadPrivateVarInit(), getAddrOfArtificialThreadPrivate(), getAddrOfThreadPrivate(), and getThreadID().

◆ 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));
}
__device__ __2f16 float c

Definition at line 9037 of file CGOpenMPRuntime.cpp.

References clang::CharUnits::alignmentOfArrayElement(), clang::CodeGen::CodeGenTypes::arrangeBuiltinFunctionDeclaration(), clang::CodeGen::CodeGenFunction::Builder, clang::C, CGM, clang::CodeGen::CodeGenTypes::ConvertTypeForMem(), clang::CodeGen::CodeGenFunction::createBasicBlock(), clang::CodeGen::CGBuilderTy::CreateGEP(), clang::CodeGen::CGBuilderTy::CreateIsNull(), clang::CodeGen::CodeGenFunction::CurFn, clang::CodeGen::CodeGenFunction::EmitBlock(), clang::CodeGen::CodeGenFunction::EmitLoadOfScalar(), emitMappingInformation(), clang::CodeGen::CodeGenFunction::EmitNounwindRuntimeCall(), clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), emitUDMapperArrayInitOrDel(), clang::CodeGen::CodeGenFunction::FinishFunction(), FunctionUDMMap, clang::CodeGen::CodeGenFunction::GetAddrOfLocalVar(), clang::CodeGen::Address::getAlignment(), clang::CodeGen::CodeGenModule::getCodeGenOpts(), clang::CodeGen::CodeGenModule::getContext(), clang::CodeGen::CodeGenModule::getCXXABI(), clang::CodeGen::CodeGenTypes::GetFunctionType(), clang::Decl::getLocation(), clang::CodeGen::CGCXXABI::getMangleContext(), clang::OMPDeclareMapperDecl::getMapperVarRef(), clang::CodeGen::CodeGenModule::getModule(), clang::NamedDecl::getName(), getName(), getOrCreateUserDefinedMapperFunc(), clang::CharUnits::getQuantity(), clang::ValueDecl::getType(), clang::CodeGen::CodeGenModule::getTypes(), clang::CodeGen::CodeGenTypeCache::Int64Ty, Loc, clang::MangleContext::mangleCanonicalTypeName(), OMPBuilder, clang::Other, clang::CodeGen::CodeGenModule::SetInternalFunctionAttributes(), clang::CodeGen::CodeGenFunction::StartFunction(), UDMMap, and clang::CodeGen::CodeGenTypeCache::VoidPtrTy.

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 
)

◆ emitUsesAllocatorsInit()

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

◆ functionFinished()

void CGOpenMPRuntime::functionFinished ( CodeGenFunction CGF)
virtual

◆ getAddressOfLocalVariable()

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

Gets the OpenMP-specific address of the local variable.

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

Definition at line 11287 of file CGOpenMPRuntime.cpp.

References clang::CharUnits::alignTo(), clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::CapturedStmtInfo, CGM, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::ConvertTypeForMem(), clang::CodeGen::CGBuilderTy::CreatePointerBitCastOrAddrSpaceCast(), clang::CodeGen::CodeGenFunction::CurFn, clang::CodeGen::CodeGenFunction::EHStack, clang::CodeGen::Address::emitRawPointer(), clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), clang::CodeGen::CodeGenFunction::EmitStoreOfScalar(), clang::CharUnits::fromQuantity(), FunctionToUntiedTaskStackMap, getAlignmentValue(), getAllocatorVal(), clang::Decl::getAttr(), clang::DeclaratorDecl::getBeginLoc(), clang::VarDecl::getCanonicalDecl(), clang::CodeGen::CodeGenModule::getContext(), clang::ASTContext::getDeclAlign(), clang::SourceLocation::getFromRawEncoding(), clang::Decl::getLocation(), clang::CodeGen::CodeGenModule::getModule(), clang::NamedDecl::getName(), getName(), clang::CodeGen::CodeGenModule::getOpenMPRuntime(), clang::ASTContext::getPointerType(), clang::SourceLocation::getRawEncoding(), clang::CodeGen::CodeGenModule::getSize(), getThreadID(), clang::ValueDecl::getType(), clang::CodeGen::CodeGenFunction::getTypeSize(), clang::ASTContext::getTypeSizeInChars(), clang::Decl::hasAttr(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), clang::CodeGen::Address::invalid(), isAllocatableDecl(), clang::CodeGen::Address::isValid(), clang::Type::isVariablyModifiedType(), clang::CodeGen::NormalAndEHCleanup, OMPBuilder, UntiedLocalVarsStack, and clang::CodeGen::CodeGenTypeCache::VoidPtrTy.

◆ getAddrOfArtificialThreadPrivate()

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

◆ getAddrOfDeclareTargetVar()

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

References getName(), KmpCriticalNameTy, and OMPBuilder.

Referenced by emitCriticalRegion(), and emitReduction().

◆ 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 1523 of file CGOpenMPRuntime.h.

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

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

Referenced by emitBarrierCall(), and clang::CodeGen::CGOpenMPRuntimeGPU::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.

Definition at line 371 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 10067 of file CGOpenMPRuntime.cpp.

References RequiresAtomicOrdering.

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

References clang::C, clang::IntegerLiteral::Create(), clang::CodeGen::CodeGenFunction::getContext(), and clang::ASTContext::getIntTypeForBitwidth().

◆ getDepobjElements()

std::pair< llvm::Value *, LValue > CGOpenMPRuntime::getDepobjElements ( CodeGenFunction CGF,
LValue  DepobjLVal,
SourceLocation  Loc 
)
protected

◆ getIdentTyPointerTy()

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

Returns pointer to ident_t type.

Definition at line 1482 of file CGOpenMPRuntime.cpp.

References OMPBuilder.

◆ getKmpc_MicroPointerTy()

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

Returns pointer to kmpc_micro type.

Definition at line 1486 of file CGOpenMPRuntime.cpp.

References CGM, clang::CodeGen::CodeGenTypeCache::Int32Ty, Kmpc_MicroTy, and clang::CodeGen::CodeGenTypeCache::VoidTy.

Referenced by emitParallelCall(), and emitTeamsCall().

◆ getKmpcAllocShared()

virtual std::pair< llvm::Value *, llvm::Value * > clang::CodeGen::CGOpenMPRuntime::getKmpcAllocShared ( CodeGenFunction CGF,
const VarDecl VD 
)
inlinevirtual

Get call to __kmpc_alloc_shared.

Reimplemented in clang::CodeGen::CGOpenMPRuntimeGPU.

Definition at line 689 of file CGOpenMPRuntime.h.

◆ getKmpcFreeShared()

virtual void clang::CodeGen::CGOpenMPRuntime::getKmpcFreeShared ( CodeGenFunction CGF,
const std::pair< llvm::Value *, llvm::Value * > &  AddrSizePair 
)
inlinevirtual

Get call to __kmpc_free_shared.

Reimplemented in clang::CodeGen::CGOpenMPRuntimeGPU.

Definition at line 694 of file CGOpenMPRuntime.h.

◆ getKmpCriticalNameTy()

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

Get the LLVM type for the critical name.

Definition at line 378 of file CGOpenMPRuntime.h.

References KmpCriticalNameTy.

◆ getName()

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

◆ getNumTeamsExprForTargetDirective()

const Expr * CGOpenMPRuntime::getNumTeamsExprForTargetDirective ( CodeGenFunction CGF,
const OMPExecutableDirective D,
int32_t &  MinTeamsVal,
int32_t &  MaxTeamsVal 
)

◆ getNumThreadsExprForTargetDirective()

const Expr * CGOpenMPRuntime::getNumThreadsExprForTargetDirective ( CodeGenFunction CGF,
const OMPExecutableDirective D,
int32_t &  UpperBound,
bool  UpperBoundOnly,
llvm::Value **  CondExpr = nullptr,
const Expr **  ThreadLimitExpr = nullptr 
)

Check for a number of threads upper bound constant value (stored in UpperBound), or expression (returned).

If the value is conditional (via an if-clause), store the condition in CondExpr. Similarly, a potential thread limit expression is stored in ThreadLimitExpr. If UpperBoundOnly is true, no expression evaluation is perfomed.

Definition at line 6280 of file CGOpenMPRuntime.cpp.

References clang::C, clang::CodeGen::CodeGenFunction::EmitAutoVarAlloca(), clang::CodeGen::CodeGenFunction::EmitAutoVarCleanups(), clang::CodeGen::CodeGenFunction::EmitVarDecl(), clang::Expr::EvaluateAsBooleanCondition(), clang::CodeGen::CodeGenFunction::EvaluateExprAsBool(), clang::CapturedStmt::getCapturedStmt(), clang::OMPExecutableDirective::getClausesOfKind(), clang::OMPIfClause::getCondition(), clang::CodeGen::CodeGenFunction::getContext(), clang::OMPExecutableDirective::getDirectiveKind(), clang::OMPExecutableDirective::getInnermostCapturedStmt(), clang::Expr::getIntegerConstantExpr(), clang::CodeGen::CodeGenFunction::getLangOpts(), getNumThreads(), clang::OMPExecutableDirective::getSingleClause(), getSingleCompoundChild(), clang::OMPExecutableDirective::hasClausesOfKind(), clang::Expr::isIntegerConstantExpr(), clang::isOpenMPDistributeDirective(), clang::isOpenMPParallelDirective(), clang::isOpenMPSimdDirective(), clang::isOpenMPTargetExecutionDirective(), clang::isOpenMPTeamsDirective(), and clang::Result.

Referenced by computeMinAndMaxThreadsAndTeams(), and emitNumThreadsForTargetDirective().

◆ getOMPBuilder()

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

◆ getOrCreateThreadPrivateCache()

llvm::Constant * CGOpenMPRuntime::getOrCreateThreadPrivateCache ( const VarDecl VD)
protected

If the specified mangled name is not in the module, create and return threadprivate cache object.

This object is a pointer's worth of storage that's reserved for use by the OpenMP runtime.

Parameters
VDThreadprivate variable.
Returns
Cache variable for the specified threadprivate.

Definition at line 1587 of file CGOpenMPRuntime.cpp.

References CGM, clang::CodeGen::CodeGenModule::getContext(), clang::CodeGen::CodeGenModule::getLangOpts(), clang::CodeGen::CodeGenModule::getMangledName(), getName(), clang::ASTContext::getTargetInfo(), clang::CodeGen::CodeGenTypeCache::Int8PtrPtrTy, clang::TargetInfo::isTLSSupported(), and OMPBuilder.

Referenced by getAddrOfThreadPrivate().

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

References emitUserDefinedMapper(), and UDMMap.

Referenced by emitOffloadingArrays(), emitTargetDataCalls(), and emitUserDefinedMapper().

◆ getOutlinedHelperName() [1/2]

std::string CGOpenMPRuntime::getOutlinedHelperName ( CodeGenFunction CGF) const
protected

◆ getOutlinedHelperName() [2/2]

std::string CGOpenMPRuntime::getOutlinedHelperName ( StringRef  Name) const
protected

Get the function name of an outlined region.

Definition at line 1247 of file CGOpenMPRuntime.cpp.

References getName().

Referenced by emitParallelOutlinedFunction(), emitTeamsOutlinedFunction(), and getOutlinedHelperName().

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

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

Referenced by emitOutlinedFunctionPrologue().

◆ getReductionFuncName()

std::string CGOpenMPRuntime::getReductionFuncName ( StringRef  Name) const
protected

Get the function name of a reduction function.

Definition at line 1256 of file CGOpenMPRuntime.cpp.

References getName().

Referenced by emitReductionFunction().

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

References clang::C, clang::Stmt::IgnoreContainers(), and isTrivial().

Referenced by getDistributeLastprivateVars(), getNestedDistributeDirective(), getNumTeamsExprForTargetDirective(), getNumThreads(), getNumThreadsExprForTargetDirective(), 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 5593 of file CGOpenMPRuntime.cpp.

References clang::CodeGen::CodeGenFunction::Builder, CGM, clang::CodeGen::CGBuilderTy::CreatePointerBitCastOrAddrSpaceCast(), clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), clang::CodeGen::LValue::getAlignment(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::LValue::getPointer(), getThreadID(), clang::CodeGen::CodeGenTypeCache::Int8Ty, clang::CodeGen::CodeGenTypeCache::IntTy, Loc, OMPBuilder, and clang::CodeGen::CodeGenTypeCache::VoidPtrTy.

◆ getThreadID()

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

Gets thread id value for the current thread.

Definition at line 1391 of file CGOpenMPRuntime.cpp.

References clang::CodeGen::CodeGenFunction::AllocaInsertPt, clang::CodeGen::CodeGenFunction::Builder, clang::Call, clang::CodeGen::CodeGenFunction::CapturedStmtInfo, CGM, clang::CodeGen::ApplyDebugLocation::CreateDefaultArtificial(), clang::CodeGen::CodeGenFunction::CurFn, clang::CodeGen::CodeGenFunction::EHStack, clang::CodeGen::CodeGenFunction::EmitLoadOfScalar(), emitUpdateLocation(), getIdentStringFromSourceLocation(), clang::CodeGen::CodeGenFunction::getLangOpts(), clang::CodeGen::CodeGenModule::getLangOpts(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::LValue::getPointer(), clang::CodeGen::CodeGenTypeCache::getRuntimeCC(), Loc, OMPBuilder, OpenMPLocThreadIDMap, clang::CodeGen::EHScopeStack::requiresLandingPad(), and setLocThreadIdInsertPt().

Referenced by emitBarrierCall(), clang::CodeGen::CGOpenMPRuntimeGPU::emitBarrierCall(), emitCancelCall(), emitCancellationPointCall(), emitCriticalRegion(), emitDepobjDependClause(), emitDestroyClause(), emitDistributeStaticInit(), emitDoacrossInit(), emitDoacrossOrdered(), emitForDispatchInit(), emitForNext(), emitForOrderedIterationEnd(), emitForStaticFinish(), emitForStaticInit(), emitMaskedRegion(), emitMasterRegion(), emitNumTeamsClause(), emitNumThreadsClause(), emitOrderedRegion(), emitParallelCall(), clang::CodeGen::CGOpenMPRuntimeGPU::emitParallelCall(), emitProcBindClause(), emitReduction(), emitSingleRegion(), emitTaskCall(), emitTaskgroupRegion(), emitTaskInit(), emitTaskLoopCall(), emitTaskOutlinedFunction(), emitTaskReductionFini(), emitTaskReductionInit(), emitTaskwaitCall(), emitTaskyieldCall(), emitThreadIDAddress(), emitThreadLimitClause(), emitUsesAllocatorsFini(), emitUsesAllocatorsInit(), getAddressOfLocalVariable(), getAddrOfArtificialThreadPrivate(), getAddrOfThreadPrivate(), and getTaskReductionItem().

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

References emitUserDefinedReduction(), and UDRMap.

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

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

◆ hasRequiresUnifiedSharedMemory()

bool CGOpenMPRuntime::hasRequiresUnifiedSharedMemory ( ) const

◆ 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 367 of file CGOpenMPRuntime.h.

◆ isDelayedVariableLengthDecl()

virtual bool clang::CodeGen::CGOpenMPRuntime::isDelayedVariableLengthDecl ( CodeGenFunction CGF,
const VarDecl VD 
) const
inlinevirtual

Check if the variable length declaration is delayed:

Reimplemented in clang::CodeGen::CGOpenMPRuntimeGPU.

Definition at line 682 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 2464 of file CGOpenMPRuntime.cpp.

References getRuntimeSchedule().

◆ isGPU()

virtual bool clang::CodeGen::CGOpenMPRuntime::isGPU ( ) const
inlinevirtual

Returns true if the current target is a GPU.

Reimplemented in clang::CodeGen::CGOpenMPRuntimeGPU.

Definition at line 679 of file CGOpenMPRuntime.h.

Referenced by CGOpenMPRuntime().

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

References clang::CodeGen::CodeGenFunction::CurFn, FunctionToUntiedTaskStackMap, and UntiedLocalVarsStack.

◆ isNontemporalDecl()

bool CGOpenMPRuntime::isNontemporalDecl ( const ValueDecl VD) const

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

Definition at line 11445 of file CGOpenMPRuntime.cpp.

References CGM, clang::CodeGen::CodeGenModule::getLangOpts(), clang::CodeGen::CodeGenModule::getOpenMPRuntime(), NontemporalDeclsStack, and clang::Set.

◆ 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 2458 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 2451 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 2445 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 2438 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 10114 of file CGOpenMPRuntime.cpp.

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

◆ processRequiresDirective()

void CGOpenMPRuntime::processRequiresDirective ( const OMPRequiresDecl D)
virtual

◆ registerTargetGlobalVariable()

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

◆ scanForTargetRegionsFunctions()

void CGOpenMPRuntime::scanForTargetRegionsFunctions ( const Stmt S,
StringRef  ParentName 
)
protected

◆ 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 1508 of file CGOpenMPRuntime.h.

Referenced by emitOutlinedFunctionPrologue().

Member Data Documentation

◆ AlreadyEmittedTargetDecls

llvm::DenseSet<CanonicalDeclPtr<const Decl> > clang::CodeGen::CGOpenMPRuntime::AlreadyEmittedTargetDecls
protected

List of the emitted declarations.

Definition at line 488 of file CGOpenMPRuntime.h.

Referenced by emitTargetFunctions(), and markAsGlobalTarget().

◆ CGM

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

Definition at line 309 of file CGOpenMPRuntime.h.

Referenced by CGOpenMPRuntime(), clang::CodeGen::CGOpenMPRuntimeGPU::CGOpenMPRuntimeGPU(), computeMinAndMaxThreadsAndTeams(), createOffloadEntriesAndInfoMetadata(), emitAArch64DeclareSimdFunction(), emitBarrierCall(), clang::CodeGen::CGOpenMPRuntimeGPU::emitBarrierCall(), emitCancelCall(), emitCancellationPointCall(), emitCriticalRegion(), clang::CodeGen::CGOpenMPRuntimeGPU::emitCriticalRegion(), emitDeclareSimdFunction(), emitDeclareTargetFunction(), emitDeferredTargetDecls(), emitDependClause(), emitDepobjDependClause(), emitDestroyClause(), emitDistributeStaticInit(), emitDoacrossInit(), EmitDoacrossOrdered(), emitDoacrossOrdered(), emitErrorCall(), emitFlush(), emitForDispatchInit(), emitForStaticFinish(), emitKmpRoutineEntryT(), emitLastprivateConditionalFinalUpdate(), emitLastprivateConditionalInit(), emitLastprivateConditionalUpdate(), emitMaskedRegion(), emitMasterRegion(), emitNumTeamsClause(), emitNumThreadsClause(), emitOrderedRegion(), emitParallelCall(), clang::CodeGen::CGOpenMPRuntimeGPU::emitParallelCall(), emitParallelOutlinedFunction(), emitProcBindClause(), emitReduction(), clang::CodeGen::CGOpenMPRuntimeGPU::emitReduction(), emitReductionFunction(), emitSingleRegion(), emitTargetCall(), emitTargetDataCalls(), emitTargetDataStandAloneCall(), emitTargetFunctions(), emitTargetGlobalVariable(), emitTargetNumIterationsCall(), emitTargetOutlinedFunctionHelper(), emitTaskCall(), emitTaskgroupRegion(), emitTaskInit(), emitTaskLoopCall(), emitTaskOutlinedFunction(), emitTaskReductionFini(), emitTaskReductionFixups(), emitTaskReductionInit(), emitTaskwaitCall(), emitTaskyieldCall(), emitTeamsCall(), clang::CodeGen::CGOpenMPRuntimeGPU::emitTeamsCall(), emitTeamsOutlinedFunction(), clang::CodeGen::CGOpenMPRuntimeGPU::emitTeamsOutlinedFunction(), emitThreadLimitClause(), emitThreadPrivateVarDefinition(), emitThreadPrivateVarInit(), emitUDMapperArrayInitOrDel(), emitUpdateClause(), emitUpdateLocation(), emitUserDefinedMapper(), emitUserDefinedReduction(), emitUsesAllocatorsFini(), emitUsesAllocatorsInit(), getAddressOfLocalVariable(), clang::CodeGen::CGOpenMPRuntimeGPU::getAddressOfLocalVariable(), getAddrOfArtificialThreadPrivate(), getAddrOfDeclareTargetVar(), getAddrOfThreadPrivate(), getAlignmentValue(), getDepobjElements(), clang::CodeGen::CGOpenMPRuntimeGPU::getGPUThreadID(), clang::CodeGen::CGOpenMPRuntimeGPU::getGPUWarpSize(), getKmpc_MicroPointerTy(), clang::CodeGen::CGOpenMPRuntimeGPU::getKmpcAllocShared(), clang::CodeGen::CGOpenMPRuntimeGPU::getKmpcFreeShared(), getOrCreateThreadPrivateCache(), getTaskReductionItem(), getThreadID(), isNontemporalDecl(), markAsGlobalTarget(), clang::CodeGen::CGOpenMPRuntimeGPU::processRequiresDirective(), registerTargetGlobalVariable(), scanForTargetRegionsFunctions(), 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().

◆ DeclareTargetWithDefinition

llvm::StringSet clang::CodeGen::CGOpenMPRuntime::DeclareTargetWithDefinition
protected

Set of declare target variables with the generated initializer.

Definition at line 549 of file CGOpenMPRuntime.h.

◆ DeferredGlobalVariables

llvm::SmallDenseSet<const VarDecl *> clang::CodeGen::CGOpenMPRuntime::DeferredGlobalVariables
protected

List of variables that can become declare target implicitly and, thus, must be emitted.

Definition at line 495 of file CGOpenMPRuntime.h.

Referenced by emitDeferredTargetDecls(), and emitTargetGlobalVariable().

◆ EmittedNonTargetVariables

llvm::StringMap<llvm::WeakTrackingVH> clang::CodeGen::CGOpenMPRuntime::EmittedNonTargetVariables
protected

List of the global variables with their addresses that should not be emitted for the target.

Definition at line 491 of file CGOpenMPRuntime.h.

Referenced by clear(), and registerTargetGlobalVariable().

◆ FunctionToUntiedTaskStackMap

llvm::DenseMap<llvm::Function *, unsigned> clang::CodeGen::CGOpenMPRuntime::FunctionToUntiedTaskStackMap
protected

Maps function to the position of the untied task locals stack.

Definition at line 432 of file CGOpenMPRuntime.h.

Referenced by functionFinished(), getAddressOfLocalVariable(), isLocalVarInUntiedTask(), and clang::CodeGen::CGOpenMPRuntime::UntiedTaskLocalDeclsRAII::UntiedTaskLocalDeclsRAII().

◆ FunctionUDMMap

FunctionUDMMapTy clang::CodeGen::CGOpenMPRuntime::FunctionUDMMap
protected

Definition at line 423 of file CGOpenMPRuntime.h.

Referenced by emitUserDefinedMapper(), and functionFinished().

◆ FunctionUDRMap

FunctionUDRMapTy clang::CodeGen::CGOpenMPRuntime::FunctionUDRMap
protected

Definition at line 415 of file CGOpenMPRuntime.h.

Referenced by emitUserDefinedReduction(), and functionFinished().

◆ HasEmittedDeclareTargetRegion

bool clang::CodeGen::CGOpenMPRuntime::HasEmittedDeclareTargetRegion = false
protected

Flag for keeping track of weather a device routine has been emitted.

Device routines are specific to the

Definition at line 524 of file CGOpenMPRuntime.h.

Referenced by emitFunctionProlog().

◆ HasEmittedTargetRegion

bool clang::CodeGen::CGOpenMPRuntime::HasEmittedTargetRegion = false
protected

Flag for keeping track of weather a target region has been emitted.

Definition at line 520 of file CGOpenMPRuntime.h.

Referenced by emitTargetOutlinedFunction().

◆ HasRequiresUnifiedSharedMemory

bool clang::CodeGen::CGOpenMPRuntime::HasRequiresUnifiedSharedMemory = false
protected

Flag for keeping track of weather a requires unified_shared_memory directive is present.

Definition at line 514 of file CGOpenMPRuntime.h.

Referenced by CGOpenMPRuntime(), emitDeferredTargetDecls(), emitTargetGlobalVariable(), hasRequiresUnifiedSharedMemory(), and processRequiresDirective().

◆ InternalVars

llvm::StringMap<llvm::AssertingVH<llvm::GlobalVariable>, llvm::BumpPtrAllocator> clang::CodeGen::CGOpenMPRuntime::InternalVars
protected

An ordered map of auto-generated variables to their unique names.

It stores variables with the following names: 1) ".gomp_critical_user_" + <critical_section_name> + ".var" for "omp critical" directives; 2) <mangled_name_for_global_var> + ".cache." for cache for threadprivate variables.

Definition at line 442 of file CGOpenMPRuntime.h.

Referenced by clear().

◆ Kmpc_MicroTy

llvm::FunctionType* clang::CodeGen::CGOpenMPRuntime::Kmpc_MicroTy = nullptr
protected

The type for a microtask which gets passed to __kmpc_fork_call().

Original representation is: typedef void (kmpc_micro)(kmp_int32 global_tid, kmp_int32 bound_tid,...);

Definition at line 394 of file CGOpenMPRuntime.h.

Referenced by getKmpc_MicroPointerTy().

◆ KmpCriticalNameTy

llvm::ArrayType* clang::CodeGen::CGOpenMPRuntime::KmpCriticalNameTy
protected

Type kmp_critical_name, originally defined as typedef kmp_int32 kmp_critical_name[8];.

Definition at line 435 of file CGOpenMPRuntime.h.

Referenced by CGOpenMPRuntime(), getCriticalRegionLock(), and getKmpCriticalNameTy().

◆ KmpDependInfoTy

QualType clang::CodeGen::CGOpenMPRuntime::KmpDependInfoTy
protected

Type typedef struct kmp_depend_info { kmp_intptr_t base_addr; size_t len; struct { bool in:1; bool out:1; } flags; } kmp_depend_info_t;.

Definition at line 468 of file CGOpenMPRuntime.h.

Referenced by emitDependClause(), emitDepobjDependClause(), emitDepobjElements(), emitDestroyClause(), emitUpdateClause(), and getDepobjElements().

◆ KmpDimTy

QualType clang::CodeGen::CGOpenMPRuntime::KmpDimTy
protected

struct kmp_dim { // loop bounds info casted to kmp_int64 kmp_int64 lo; // lower kmp_int64 up; // upper kmp_int64 st; // stride };

Definition at line 484 of file CGOpenMPRuntime.h.

Referenced by emitDoacrossInit().

◆ KmpRoutineEntryPtrQTy

QualType clang::CodeGen::CGOpenMPRuntime::KmpRoutineEntryPtrQTy
protected

Definition at line 445 of file CGOpenMPRuntime.h.

Referenced by emitKmpRoutineEntryT(), and emitTaskInit().

◆ KmpRoutineEntryPtrTy

llvm::Type* clang::CodeGen::CGOpenMPRuntime::KmpRoutineEntryPtrTy = nullptr
protected

Type typedef kmp_int32 (* kmp_routine_entry_t)(kmp_int32, void *);.

Definition at line 444 of file CGOpenMPRuntime.h.

Referenced by emitKmpRoutineEntryT(), and emitTaskInit().

◆ KmpTaskAffinityInfoTy

QualType clang::CodeGen::CGOpenMPRuntime::KmpTaskAffinityInfoTy
protected

Type typedef struct kmp_task_affinity_info { kmp_intptr_t base_addr; size_t len; struct { bool flag1 : 1; bool flag2 : 1; kmp_int32 reserved : 30; } flags; } kmp_task_affinity_info_t;.

Definition at line 478 of file CGOpenMPRuntime.h.

Referenced by emitTaskInit().

◆ KmpTaskTQTy

QualType clang::CodeGen::CGOpenMPRuntime::KmpTaskTQTy
protected

Type typedef struct kmp_task { void * shareds; /‍**< pointer to block of pointers to shared vars ‍/ kmp_routine_entry_t routine; /‍**< pointer to routine to call for executing task *‍/ kmp_int32 part_id; /‍**< part id for the task *‍/ kmp_routine_entry_t destructors; / pointer to function to invoke deconstructors of firstprivate C++ objects *‍/ } kmp_task_t;.

Definition at line 455 of file CGOpenMPRuntime.h.

Referenced by emitTaskInit().

◆ LastprivateConditionalStack

llvm::SmallVector<LastprivateConditionalData, 4> clang::CodeGen::CGOpenMPRuntime::LastprivateConditionalStack
protected

Stack for list of addresses of declarations in current context marked as lastprivate conditional.

The set is the union of all current stack elements.

Definition at line 510 of file CGOpenMPRuntime.h.

Referenced by checkAndEmitLastprivateConditional(), checkAndEmitSharedLastprivateConditional(), emitLastprivateConditionalFinalUpdate(), and clang::CodeGen::CGOpenMPRuntime::LastprivateConditionalRAII::~LastprivateConditionalRAII().

◆ LastprivateConditionalToTypes

llvm::DenseMap<llvm::Function *, llvm::DenseMap<CanonicalDeclPtr<const Decl>, std::tuple<QualType, const FieldDecl *, const FieldDecl *, LValue> > > clang::CodeGen::CGOpenMPRuntime::LastprivateConditionalToTypes
protected

Maps local variables marked as lastprivate conditional to their internal types.

Definition at line 430 of file CGOpenMPRuntime.h.

Referenced by checkAndEmitLastprivateConditional(), checkAndEmitSharedLastprivateConditional(), emitLastprivateConditionalInit(), and functionFinished().

◆ NontemporalDeclsStack

llvm::SmallVector<NontemporalDeclsSet, 4> clang::CodeGen::CGOpenMPRuntime::NontemporalDeclsStack
protected

Stack for list of declarations in current context marked as nontemporal.

The set is the union of all current stack elements.

Definition at line 500 of file CGOpenMPRuntime.h.

Referenced by isNontemporalDecl(), clang::CodeGen::CGOpenMPRuntime::NontemporalDeclsRAII::NontemporalDeclsRAII(), and clang::CodeGen::CGOpenMPRuntime::NontemporalDeclsRAII::~NontemporalDeclsRAII().

◆ OMPBuilder

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

An OpenMP-IR-Builder instance.

Definition at line 312 of file CGOpenMPRuntime.h.

Referenced by CGOpenMPRuntime(), clang::CodeGen::CGOpenMPRuntimeGPU::CGOpenMPRuntimeGPU(), createOffloadEntriesAndInfoMetadata(), emitBarrierCall(), clang::CodeGen::CGOpenMPRuntimeGPU::emitBarrierCall(), emitCancelCall(), emitCancellationPointCall(), emitCriticalRegion(), clang::CodeGen::CGOpenMPRuntimeGPU::emitCriticalRegion(), emitDeclareTargetFunction(), emitDepobjDependClause(), emitDestroyClause(), emitDistributeStaticInit(), emitDoacrossInit(), EmitDoacrossOrdered(), emitErrorCall(), emitFlush(), emitForDispatchInit(), emitForNext(), emitForOrderedIterationEnd(), emitForStaticFinish(), emitForStaticInit(), emitLastprivateConditionalUpdate(), emitMaskedRegion(), emitMasterRegion(), emitNumTeamsClause(), emitNumThreadsClause(), emitOrderedRegion(), emitParallelCall(), clang::CodeGen::CGOpenMPRuntimeGPU::emitParallelCall(), emitProcBindClause(), emitReduction(), clang::CodeGen::CGOpenMPRuntimeGPU::emitReduction(), emitSingleRegion(), emitTargetDataCalls(), emitTargetDataStandAloneCall(), emitTargetOutlinedFunctionHelper(), emitTaskCall(), emitTaskgroupRegion(), emitTaskInit(), emitTaskLoopCall(), emitTaskOutlinedFunction(), emitTaskReductionFini(), emitTaskReductionInit(), emitTaskwaitCall(), emitTaskyieldCall(), emitTeamsCall(), emitThreadLimitClause(), emitThreadPrivateVarInit(), emitUDMapperArrayInitOrDel(), emitUpdateLocation(), emitUserDefinedMapper(), emitUsesAllocatorsFini(), emitUsesAllocatorsInit(), getAddressOfLocalVariable(), getAddrOfArtificialThreadPrivate(), getAddrOfDeclareTargetVar(), getAddrOfThreadPrivate(), getCriticalRegionLock(), clang::CodeGen::CGOpenMPRuntimeGPU::getGPUThreadID(), clang::CodeGen::CGOpenMPRuntimeGPU::getGPUWarpSize(), getIdentTyPointerTy(), clang::CodeGen::CGOpenMPRuntimeGPU::getKmpcAllocShared(), clang::CodeGen::CGOpenMPRuntimeGPU::getKmpcFreeShared(), getName(), getOMPBuilder(), getOrCreateThreadPrivateCache(), getTaskReductionItem(), getThreadID(), processRequiresDirective(), registerTargetGlobalVariable(), and scanForTargetRegionsFunctions().

◆ OpenMPDebugLocMap

OpenMPDebugLocMapTy clang::CodeGen::CGOpenMPRuntime::OpenMPDebugLocMap
protected

Definition at line 390 of file CGOpenMPRuntime.h.

◆ OpenMPLocThreadIDMap

OpenMPLocThreadIDMapTy clang::CodeGen::CGOpenMPRuntime::OpenMPLocThreadIDMap
protected

◆ RequiresAtomicOrdering

llvm::AtomicOrdering clang::CodeGen::CGOpenMPRuntime::RequiresAtomicOrdering = llvm::AtomicOrdering::Monotonic
protected

Atomic ordering from the omp requires directive.

Definition at line 517 of file CGOpenMPRuntime.h.

Referenced by getDefaultMemoryOrdering(), and processRequiresDirective().

◆ SavedKmpTaskloopTQTy

QualType clang::CodeGen::CGOpenMPRuntime::SavedKmpTaskloopTQTy
protected

Saved kmp_task_t for taskloop-based directive.

Definition at line 459 of file CGOpenMPRuntime.h.

Referenced by emitTaskInit().

◆ SavedKmpTaskTQTy

QualType clang::CodeGen::CGOpenMPRuntime::SavedKmpTaskTQTy
protected

Saved kmp_task_t for task directive.

Definition at line 457 of file CGOpenMPRuntime.h.

Referenced by emitTaskInit().

◆ ShouldMarkAsGlobal

bool clang::CodeGen::CGOpenMPRuntime::ShouldMarkAsGlobal = true
protected

◆ ThreadPrivateWithDefinition

llvm::StringSet clang::CodeGen::CGOpenMPRuntime::ThreadPrivateWithDefinition
protected

Set of threadprivate variables with the generated initializer.

Definition at line 546 of file CGOpenMPRuntime.h.

Referenced by emitThreadPrivateVarDefinition().

◆ UDMMap

llvm::DenseMap<const OMPDeclareMapperDecl *, llvm::Function *> clang::CodeGen::CGOpenMPRuntime::UDMMap
protected

Map from the user-defined mapper declaration to its corresponding functions.

Definition at line 418 of file CGOpenMPRuntime.h.

Referenced by emitUserDefinedMapper(), functionFinished(), and getOrCreateUserDefinedMapperFunc().

◆ UDRMap

UDRMapTy clang::CodeGen::CGOpenMPRuntime::UDRMap
protected

◆ UntiedLocalVarsStack

llvm::SmallVector<UntiedLocalVarsAddressesMap, 4> clang::CodeGen::CGOpenMPRuntime::UntiedLocalVarsStack
protected

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