clang  17.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]
Collaboration diagram for clang::CodeGen::CGOpenMPRuntime:
Collaboration 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 ()
 
virtual bool isTargetCodegen () const
 Returns true if the current target is a GPU. More...
 
void emitIfClause (CodeGenFunction &CGF, const Expr *Cond, const RegionCodeGenTy &ThenGen, const RegionCodeGenTy &ElseGen)
 Emits code for OpenMP 'if' clause using specified CodeGen function. More...
 
std::string getName (ArrayRef< StringRef > Parts) const
 Get the platform-specific name separator. More...
 
virtual void emitUserDefinedReduction (CodeGenFunction *CGF, const OMPDeclareReductionDecl *D)
 Emit code for the specified user defined reduction construct. More...
 
virtual std::pair< llvm::Function *, llvm::Function * > getUserDefinedReduction (const OMPDeclareReductionDecl *D)
 Get combiner/initializer for the specified user-defined reduction, if any. More...
 
void emitUserDefinedMapper (const OMPDeclareMapperDecl *D, CodeGenFunction *CGF=nullptr)
 Emit the function for the user defined mapper construct. More...
 
llvm::Function * getOrCreateUserDefinedMapperFunc (const OMPDeclareMapperDecl *D)
 Get the function for the specified user-defined mapper. More...
 
virtual llvm::Function * emitParallelOutlinedFunction (const OMPExecutableDirective &D, const VarDecl *ThreadIDVar, OpenMPDirectiveKind InnermostKind, const RegionCodeGenTy &CodeGen)
 Emits outlined function for the specified OpenMP parallel directive D. More...
 
virtual llvm::Function * emitTeamsOutlinedFunction (const OMPExecutableDirective &D, const VarDecl *ThreadIDVar, OpenMPDirectiveKind InnermostKind, const RegionCodeGenTy &CodeGen)
 Emits outlined function for the specified OpenMP teams directive D. More...
 
virtual llvm::Function * emitTaskOutlinedFunction (const OMPExecutableDirective &D, const VarDecl *ThreadIDVar, const VarDecl *PartIDVar, const VarDecl *TaskTVar, OpenMPDirectiveKind InnermostKind, const RegionCodeGenTy &CodeGen, bool Tied, unsigned &NumberOfParts)
 Emits outlined function for the OpenMP task directive D. More...
 
virtual void functionFinished (CodeGenFunction &CGF)
 Cleans up references to the objects in finished function. More...
 
virtual void emitParallelCall (CodeGenFunction &CGF, SourceLocation Loc, llvm::Function *OutlinedFn, ArrayRef< llvm::Value * > CapturedVars, const Expr *IfCond, llvm::Value *NumThreads)
 Emits code for parallel or serial call of the OutlinedFn with variables captured in a record which address is stored in CapturedStruct. More...
 
virtual void emitCriticalRegion (CodeGenFunction &CGF, StringRef CriticalName, const RegionCodeGenTy &CriticalOpGen, SourceLocation Loc, const Expr *Hint=nullptr)
 Emits a critical region. More...
 
virtual void emitMasterRegion (CodeGenFunction &CGF, const RegionCodeGenTy &MasterOpGen, SourceLocation Loc)
 Emits a master region. More...
 
virtual void emitMaskedRegion (CodeGenFunction &CGF, const RegionCodeGenTy &MaskedOpGen, SourceLocation Loc, const Expr *Filter=nullptr)
 Emits a masked region. More...
 
virtual void emitTaskyieldCall (CodeGenFunction &CGF, SourceLocation Loc)
 Emits code for a taskyield directive. More...
 
virtual void 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);. More...
 
virtual void emitTaskgroupRegion (CodeGenFunction &CGF, const RegionCodeGenTy &TaskgroupOpGen, SourceLocation Loc)
 Emit a taskgroup region. More...
 
virtual void emitSingleRegion (CodeGenFunction &CGF, const RegionCodeGenTy &SingleOpGen, SourceLocation Loc, ArrayRef< const Expr * > CopyprivateVars, ArrayRef< const Expr * > DestExprs, ArrayRef< const Expr * > SrcExprs, ArrayRef< const Expr * > AssignmentOps)
 Emits a single region. More...
 
virtual void emitOrderedRegion (CodeGenFunction &CGF, const RegionCodeGenTy &OrderedOpGen, SourceLocation Loc, bool IsThreads)
 Emit an ordered region. More...
 
virtual void emitBarrierCall (CodeGenFunction &CGF, SourceLocation Loc, OpenMPDirectiveKind Kind, bool EmitChecks=true, bool ForceSimpleCall=false)
 Emit an implicit/explicit barrier for OpenMP threads. More...
 
virtual bool isStaticNonchunked (OpenMPScheduleClauseKind ScheduleKind, bool Chunked) const
 Check if the specified ScheduleKind is static non-chunked. More...
 
virtual bool isStaticNonchunked (OpenMPDistScheduleClauseKind ScheduleKind, bool Chunked) const
 Check if the specified ScheduleKind is static non-chunked. More...
 
virtual bool isStaticChunked (OpenMPScheduleClauseKind ScheduleKind, bool Chunked) const
 Check if the specified ScheduleKind is static chunked. More...
 
virtual bool isStaticChunked (OpenMPDistScheduleClauseKind ScheduleKind, bool Chunked) const
 Check if the specified ScheduleKind is static non-chunked. More...
 
virtual bool isDynamic (OpenMPScheduleClauseKind ScheduleKind) const
 Check if the specified ScheduleKind is dynamic. More...
 
virtual void emitForDispatchInit (CodeGenFunction &CGF, SourceLocation Loc, const OpenMPScheduleTy &ScheduleKind, unsigned IVSize, bool IVSigned, bool Ordered, const DispatchRTInput &DispatchValues)
 Call the appropriate runtime routine to initialize it before start of loop. More...
 
virtual void emitForStaticInit (CodeGenFunction &CGF, SourceLocation Loc, OpenMPDirectiveKind DKind, const OpenMPScheduleTy &ScheduleKind, const StaticRTInput &Values)
 Call the appropriate runtime routine to initialize it before start of loop. More...
 
virtual void emitDistributeStaticInit (CodeGenFunction &CGF, SourceLocation Loc, OpenMPDistScheduleClauseKind SchedKind, const StaticRTInput &Values)
 
virtual void emitForOrderedIterationEnd (CodeGenFunction &CGF, SourceLocation Loc, unsigned IVSize, bool IVSigned)
 Call the appropriate runtime routine to notify that we finished iteration of the ordered loop with the dynamic scheduling. More...
 
virtual void emitForStaticFinish (CodeGenFunction &CGF, SourceLocation Loc, OpenMPDirectiveKind DKind)
 Call the appropriate runtime routine to notify that we finished all the work with current loop. More...
 
virtual llvm::Value * emitForNext (CodeGenFunction &CGF, SourceLocation Loc, unsigned IVSize, bool IVSigned, Address IL, Address LB, Address UB, Address ST)
 Call __kmpc_dispatch_next( ident_t *loc, kmp_int32 tid, kmp_int32 *p_lastiter, kmp_int[32|64] *p_lower, kmp_int[32|64] *p_upper, kmp_int[32|64] *p_stride);. More...
 
virtual void emitNumThreadsClause (CodeGenFunction &CGF, llvm::Value *NumThreads, SourceLocation Loc)
 Emits call to void __kmpc_push_num_threads(ident_t *loc, kmp_int32 global_tid, kmp_int32 num_threads) to generate code for 'num_threads' clause. More...
 
virtual void emitProcBindClause (CodeGenFunction &CGF, llvm::omp::ProcBindKind ProcBind, SourceLocation Loc)
 Emit call to void __kmpc_push_proc_bind(ident_t *loc, kmp_int32 global_tid, int proc_bind) to generate code for 'proc_bind' clause. More...
 
virtual Address getAddrOfThreadPrivate (CodeGenFunction &CGF, const VarDecl *VD, Address VDAddr, SourceLocation Loc)
 Returns address of the threadprivate variable for the current thread. More...
 
virtual Address getAddrOfDeclareTargetVar (const VarDecl *VD)
 Returns the address of the variable marked as declare target with link clause OR as declare target with to clause and unified memory. More...
 
virtual llvm::Function * emitThreadPrivateVarDefinition (const VarDecl *VD, Address VDAddr, SourceLocation Loc, bool PerformInit, CodeGenFunction *CGF=nullptr)
 Emit a code for initialization of threadprivate variable. More...
 
virtual bool emitDeclareTargetVarDefinition (const VarDecl *VD, llvm::GlobalVariable *Addr, bool PerformInit)
 Emit a code for initialization of declare target variable. More...
 
virtual Address getAddrOfArtificialThreadPrivate (CodeGenFunction &CGF, QualType VarType, StringRef Name)
 Creates artificial threadprivate variable with name Name and type VarType. More...
 
virtual void emitFlush (CodeGenFunction &CGF, ArrayRef< const Expr * > Vars, SourceLocation Loc, llvm::AtomicOrdering AO)
 Emit flush of the variables specified in 'omp flush' directive. More...
 
virtual void emitTaskCall (CodeGenFunction &CGF, SourceLocation Loc, const OMPExecutableDirective &D, llvm::Function *TaskFunction, QualType SharedsTy, Address Shareds, const Expr *IfCond, const OMPTaskDataTy &Data)
 Emit task region for the task directive. More...
 
virtual void emitTaskLoopCall (CodeGenFunction &CGF, SourceLocation Loc, const OMPLoopDirective &D, llvm::Function *TaskFunction, QualType SharedsTy, Address Shareds, const Expr *IfCond, const OMPTaskDataTy &Data)
 Emit task region for the taskloop directive. More...
 
virtual void emitInlinedDirective (CodeGenFunction &CGF, OpenMPDirectiveKind InnermostKind, const RegionCodeGenTy &CodeGen, bool HasCancel=false)
 Emit code for the directive that does not require outlining. More...
 
llvm::Function * emitReductionFunction (SourceLocation Loc, llvm::Type *ArgsElemType, ArrayRef< const Expr * > Privates, ArrayRef< const Expr * > LHSExprs, ArrayRef< const Expr * > RHSExprs, ArrayRef< const Expr * > ReductionOps)
 Emits reduction function. More...
 
void emitSingleReductionCombiner (CodeGenFunction &CGF, const Expr *ReductionOp, const Expr *PrivateRef, const DeclRefExpr *LHS, const DeclRefExpr *RHS)
 Emits single reduction combiner. More...
 
virtual void emitReduction (CodeGenFunction &CGF, SourceLocation Loc, ArrayRef< const Expr * > Privates, ArrayRef< const Expr * > LHSExprs, ArrayRef< const Expr * > RHSExprs, ArrayRef< const Expr * > ReductionOps, ReductionOptionsTy Options)
 Emit a code for reduction clause. More...
 
virtual llvm::Value * emitTaskReductionInit (CodeGenFunction &CGF, SourceLocation Loc, ArrayRef< const Expr * > LHSExprs, ArrayRef< const Expr * > RHSExprs, const OMPTaskDataTy &Data)
 Emit a code for initialization of task reduction clause. More...
 
virtual void emitTaskReductionFini (CodeGenFunction &CGF, SourceLocation Loc, bool IsWorksharingReduction)
 Emits the following code for reduction clause with task modifier: More...
 
virtual void emitTaskReductionFixups (CodeGenFunction &CGF, SourceLocation Loc, ReductionCodeGen &RCG, unsigned N)
 Required to resolve existing problems in the runtime. More...
 
virtual Address getTaskReductionItem (CodeGenFunction &CGF, SourceLocation Loc, llvm::Value *ReductionsPtr, LValue SharedLVal)
 Get the address of void * type of the privatue copy of the reduction item specified by the SharedLVal. More...
 
virtual void emitTaskwaitCall (CodeGenFunction &CGF, SourceLocation Loc, const OMPTaskDataTy &Data)
 Emit code for 'taskwait' directive. More...
 
virtual void emitCancellationPointCall (CodeGenFunction &CGF, SourceLocation Loc, OpenMPDirectiveKind CancelRegion)
 Emit code for 'cancellation point' construct. More...
 
virtual void emitCancelCall (CodeGenFunction &CGF, SourceLocation Loc, const Expr *IfCond, OpenMPDirectiveKind CancelRegion)
 Emit code for 'cancel' construct. More...
 
virtual void emitTargetOutlinedFunction (const OMPExecutableDirective &D, StringRef ParentName, llvm::Function *&OutlinedFn, llvm::Constant *&OutlinedFnID, bool IsOffloadEntry, const RegionCodeGenTy &CodeGen)
 Emit outilined function for 'target' directive. More...
 
virtual void emitTargetCall (CodeGenFunction &CGF, const OMPExecutableDirective &D, llvm::Function *OutlinedFn, llvm::Value *OutlinedFnID, const Expr *IfCond, llvm::PointerIntPair< const Expr *, 2, OpenMPDeviceClauseModifier > Device, llvm::function_ref< llvm::Value *(CodeGenFunction &CGF, const OMPLoopDirective &D)> SizeEmitter)
 Emit the target offloading code associated with D. More...
 
virtual bool emitTargetFunctions (GlobalDecl GD)
 Emit the target regions enclosed in GD function definition or the function itself in case it is a valid device function. More...
 
virtual bool emitTargetGlobalVariable (GlobalDecl GD)
 Emit the global variable if it is a valid device global variable. More...
 
virtual void registerTargetGlobalVariable (const VarDecl *VD, llvm::Constant *Addr)
 Checks if the provided global decl GD is a declare target variable and registers it when emitting code for the host. More...
 
virtual bool emitTargetGlobal (GlobalDecl GD)
 Emit the global GD if it is meaningful for the target. More...
 
llvm::Function * emitRequiresDirectiveRegFun ()
 Creates and returns a registration function for when at least one requires directives was used in the current module. More...
 
void createOffloadEntriesAndInfoMetadata ()
 Creates all the offload entries in the current compilation unit along with the associated metadata. More...
 
virtual void emitTeamsCall (CodeGenFunction &CGF, const OMPExecutableDirective &D, SourceLocation Loc, llvm::Function *OutlinedFn, ArrayRef< llvm::Value * > CapturedVars)
 Emits code for teams call of the OutlinedFn with variables captured in a record which address is stored in CapturedStruct. More...
 
virtual void emitNumTeamsClause (CodeGenFunction &CGF, const Expr *NumTeams, const Expr *ThreadLimit, SourceLocation Loc)
 Emits call to void __kmpc_push_num_teams(ident_t *loc, kmp_int32 global_tid, kmp_int32 num_teams, kmp_int32 thread_limit) to generate code for num_teams clause. More...
 
virtual void emitTargetDataCalls (CodeGenFunction &CGF, const OMPExecutableDirective &D, const Expr *IfCond, const Expr *Device, const RegionCodeGenTy &CodeGen, CGOpenMPRuntime::TargetDataInfo &Info)
 Emit the target data mapping code associated with D. More...
 
virtual void emitTargetDataStandAloneCall (CodeGenFunction &CGF, const OMPExecutableDirective &D, const Expr *IfCond, const Expr *Device)
 Emit the data mapping/movement code associated with the directive D that should be of the form 'target [{enter|exit} data | update]'. More...
 
virtual void emitDeclareSimdFunction (const FunctionDecl *FD, llvm::Function *Fn)
 Marks function Fn with properly mangled versions of vector functions. More...
 
virtual void emitDoacrossInit (CodeGenFunction &CGF, const OMPLoopDirective &D, ArrayRef< Expr * > NumIterations)
 Emit initialization for doacross loop nesting support. More...
 
virtual void emitDoacrossOrdered (CodeGenFunction &CGF, const OMPDependClause *C)
 Emit code for doacross ordered directive with 'depend' clause. More...
 
virtual const VarDecltranslateParameter (const FieldDecl *FD, const VarDecl *NativeParam) const
 Translates the native parameter of outlined function if this is required for target. More...
 
virtual Address getParameterAddress (CodeGenFunction &CGF, const VarDecl *NativeParam, const VarDecl *TargetParam) const
 Gets the address of the native argument basing on the address of the target-specific parameter. More...
 
virtual void getDefaultDistScheduleAndChunk (CodeGenFunction &CGF, const OMPLoopDirective &S, OpenMPDistScheduleClauseKind &ScheduleKind, llvm::Value *&Chunk) const
 Choose default schedule type and chunk value for the dist_schedule clause. More...
 
virtual void getDefaultScheduleAndChunk (CodeGenFunction &CGF, const OMPLoopDirective &S, OpenMPScheduleClauseKind &ScheduleKind, const Expr *&ChunkExpr) const
 Choose default schedule type and chunk value for the schedule clause. More...
 
virtual void emitOutlinedFunctionCall (CodeGenFunction &CGF, SourceLocation Loc, llvm::FunctionCallee OutlinedFn, ArrayRef< llvm::Value * > Args=std::nullopt) const
 Emits call of the outlined function with the provided arguments, translating these arguments to correct target-specific arguments. More...
 
virtual void emitFunctionProlog (CodeGenFunction &CGF, const Decl *D)
 Emits OpenMP-specific function prolog. More...
 
virtual Address getAddressOfLocalVariable (CodeGenFunction &CGF, const VarDecl *VD)
 Gets the OpenMP-specific address of the local variable. More...
 
bool markAsGlobalTarget (GlobalDecl GD)
 Marks the declaration as already emitted for the device code and returns true, if it was marked already, and false, otherwise. More...
 
void emitDeferredTargetDecls () const
 Emit deferred declare target variables marked for deferred emission. More...
 
virtual void adjustTargetSpecificDataForLambdas (CodeGenFunction &CGF, const OMPExecutableDirective &D) const
 Adjust some parameters for the target-based directives, like addresses of the variables captured by reference in lambdas. More...
 
virtual void processRequiresDirective (const OMPRequiresDecl *D)
 Perform check on requires decl to ensure that target architecture supports unified addressing. More...
 
llvm::AtomicOrdering getDefaultMemoryOrdering () const
 Gets default memory ordering as specified in requires directive. More...
 
virtual bool hasAllocateAttributeForGlobalVar (const VarDecl *VD, LangAS &AS)
 Checks if the variable has associated OMPAllocateDeclAttr attribute with the predefined allocator and translates it into the corresponding address space. More...
 
bool hasRequiresUnifiedSharedMemory () const
 Return whether the unified_shared_memory has been specified. More...
 
bool isNontemporalDecl (const ValueDecl *VD) const
 Checks if the VD variable is marked as nontemporal declaration in current context. More...
 
Address emitLastprivateConditionalInit (CodeGenFunction &CGF, const VarDecl *VD)
 Create specialized alloca to handle lastprivate conditionals. More...
 
virtual void checkAndEmitLastprivateConditional (CodeGenFunction &CGF, const Expr *LHS)
 Checks if the provided LVal is lastprivate conditional and emits the code to update the value of the original variable. More...
 
virtual void checkAndEmitSharedLastprivateConditional (CodeGenFunction &CGF, const OMPExecutableDirective &D, const llvm::DenseSet< CanonicalDeclPtr< const VarDecl >> &IgnoredDecls)
 Checks if the lastprivate conditional was updated in inner region and writes the value. More...
 
virtual void emitLastprivateConditionalFinalUpdate (CodeGenFunction &CGF, LValue PrivLVal, const VarDecl *VD, SourceLocation Loc)
 Gets the address of the global copy used for lastprivate conditional update, if any. More...
 
std::pair< llvm::Value *, AddressemitDependClause (CodeGenFunction &CGF, ArrayRef< OMPTaskDataTy::DependData > Dependencies, SourceLocation Loc)
 Emits list of dependecies based on the provided data (array of dependence/expression pairs). More...
 
Address emitDepobjDependClause (CodeGenFunction &CGF, const OMPTaskDataTy::DependData &Dependencies, SourceLocation Loc)
 Emits list of dependecies based on the provided data (array of dependence/expression pairs) for depobj construct. More...
 
void emitDestroyClause (CodeGenFunction &CGF, LValue DepobjLVal, SourceLocation Loc)
 Emits the code to destroy the dependency object provided in depobj directive. More...
 
void emitUpdateClause (CodeGenFunction &CGF, LValue DepobjLVal, OpenMPDependClauseKind NewDepKind, SourceLocation Loc)
 Updates the dependency kind in the specified depobj object. More...
 
void emitUsesAllocatorsInit (CodeGenFunction &CGF, const Expr *Allocator, const Expr *AllocatorTraits)
 Initializes user defined allocators specified in the uses_allocators clauses. More...
 
void emitUsesAllocatorsFini (CodeGenFunction &CGF, const Expr *Allocator)
 Destroys user defined allocators specified in the uses_allocators clause. More...
 
bool isLocalVarInUntiedTask (CodeGenFunction &CGF, const VarDecl *VD) const
 Returns true if the variable is a local variable in untied task. More...
 

Static Public Member Functions

static const StmtgetSingleCompoundChild (ASTContext &Ctx, const Stmt *Body)
 Checks if the Body is the CompoundStmt and returns its child statement iff there is only one that is not evaluatable at the compile time. More...
 

Protected Types

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

Protected Member Functions

virtual void emitTargetOutlinedFunctionHelper (const OMPExecutableDirective &D, StringRef ParentName, llvm::Function *&OutlinedFn, llvm::Constant *&OutlinedFnID, bool IsOffloadEntry, const RegionCodeGenTy &CodeGen)
 Helper to emit outlined function for 'target' directive. More...
 
llvm::Value * emitUpdateLocation (CodeGenFunction &CGF, SourceLocation Loc, unsigned Flags=0, bool EmitLoc=false)
 Emits object of ident_t type with info for source location. More...
 
const ExprgetNumTeamsExprForTargetDirective (CodeGenFunction &CGF, const OMPExecutableDirective &D, int32_t &DefaultVal)
 Emit the number of teams for a target directive. More...
 
llvm::Value * emitNumTeamsForTargetDirective (CodeGenFunction &CGF, const OMPExecutableDirective &D)
 
const ExprgetNumThreadsExprForTargetDirective (CodeGenFunction &CGF, const OMPExecutableDirective &D, int32_t &DefaultVal)
 Emit the number of threads for a target directive. More...
 
llvm::Value * emitNumThreadsForTargetDirective (CodeGenFunction &CGF, const OMPExecutableDirective &D)
 
llvm::Type * getIdentTyPointerTy ()
 Returns pointer to ident_t type. More...
 
llvm::Value * getThreadID (CodeGenFunction &CGF, SourceLocation Loc)
 Gets thread id value for the current thread. More...
 
virtual StringRef getOutlinedHelperName () const
 Get the function name of an outlined region. More...
 
void emitCall (CodeGenFunction &CGF, SourceLocation Loc, llvm::FunctionCallee Callee, ArrayRef< llvm::Value * > Args=std::nullopt) const
 Emits Callee function call with arguments Args with location Loc. More...
 
virtual Address emitThreadIDAddress (CodeGenFunction &CGF, SourceLocation Loc)
 Emits address of the word in a memory where current thread id is stored. More...
 
void setLocThreadIdInsertPt (CodeGenFunction &CGF, bool AtCurrentPoint=false)
 
void clearLocThreadIdInsertPt (CodeGenFunction &CGF)
 
virtual bool isDefaultLocationConstant () const
 Check if the default location must be constant. More...
 
virtual unsigned getDefaultLocationReserved2Flags () const
 Returns additional flags that can be stored in reserved_2 field of the default location. More...
 
llvm::ArrayType * getKmpCriticalNameTy () const
 Get the LLVM type for the critical name. More...
 
llvm::Value * getCriticalRegionLock (StringRef CriticalName)
 Returns corresponding lock object for the specified critical region name. More...
 
void loadOffloadInfoMetadata ()
 Loads all the offload entries information from the host IR metadata. More...
 
void scanForTargetRegionsFunctions (const Stmt *S, StringRef ParentName)
 Start scanning from statement S and emit all target regions found along the way. More...
 
void emitKmpRoutineEntryT (QualType KmpInt32Ty)
 Build type kmp_routine_entry_t (if not built yet). More...
 
llvm::Type * getKmpc_MicroPointerTy ()
 Returns pointer to kmpc_micro type. More...
 
llvm::FunctionCallee createForStaticInitFunction (unsigned IVSize, bool IVSigned, bool IsGPUDistribute)
 Returns __kmpc_for_static_init_* runtime function for the specified size IVSize and sign IVSigned. More...
 
llvm::FunctionCallee createDispatchInitFunction (unsigned IVSize, bool IVSigned)
 Returns __kmpc_dispatch_init_* runtime function for the specified size IVSize and sign IVSigned. More...
 
llvm::FunctionCallee createDispatchNextFunction (unsigned IVSize, bool IVSigned)
 Returns __kmpc_dispatch_next_* runtime function for the specified size IVSize and sign IVSigned. More...
 
llvm::FunctionCallee createDispatchFiniFunction (unsigned IVSize, bool IVSigned)
 Returns __kmpc_dispatch_fini_* runtime function for the specified size IVSize and sign IVSigned. More...
 
llvm::Constant * getOrCreateThreadPrivateCache (const VarDecl *VD)
 If the specified mangled name is not in the module, create and return threadprivate cache object. More...
 
void emitThreadPrivateVarInit (CodeGenFunction &CGF, Address VDAddr, llvm::Value *Ctor, llvm::Value *CopyCtor, llvm::Value *Dtor, SourceLocation Loc)
 Emits initialization code for the threadprivate variables. More...
 
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. More...
 
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. More...
 
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'. More...
 
void emitLastprivateConditionalUpdate (CodeGenFunction &CGF, LValue IVLVal, StringRef UniqueDeclName, LValue LVal, SourceLocation Loc)
 Emit update for lastprivate conditional data. More...
 
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. More...
 
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. More...
 

Protected Attributes

CodeGenModuleCGM
 
llvm::OpenMPIRBuilder OMPBuilder
 An OpenMP-IR-Builder instance. More...
 
OpenMPDebugLocMapTy OpenMPDebugLocMap
 
llvm::FunctionType * Kmpc_MicroTy = nullptr
 The type for a microtask which gets passed to __kmpc_fork_call(). More...
 
OpenMPLocThreadIDMapTy OpenMPLocThreadIDMap
 
UDRMapTy UDRMap
 
FunctionUDRMapTy FunctionUDRMap
 
llvm::DenseMap< const OMPDeclareMapperDecl *, llvm::Function * > UDMMap
 Map from the user-defined mapper declaration to its corresponding functions. More...
 
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. More...
 
llvm::DenseMap< llvm::Function *, unsignedFunctionToUntiedTaskStackMap
 Maps function to the position of the untied task locals stack. More...
 
llvm::ArrayType * KmpCriticalNameTy
 Type kmp_critical_name, originally defined as typedef kmp_int32 kmp_critical_name[8];. More...
 
llvm::StringMap< llvm::AssertingVH< llvm::GlobalVariable >, llvm::BumpPtrAllocator > InternalVars
 An ordered map of auto-generated variables to their unique names. More...
 
llvm::Type * KmpRoutineEntryPtrTy = nullptr
 Type typedef kmp_int32 (* kmp_routine_entry_t)(kmp_int32, void *);. More...
 
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;. More...
 
QualType SavedKmpTaskTQTy
 Saved kmp_task_t for task directive. More...
 
QualType SavedKmpTaskloopTQTy
 Saved kmp_task_t for taskloop-based directive. More...
 
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;. More...
 
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;. More...
 
QualType KmpDimTy
 struct kmp_dim { // loop bounds info casted to kmp_int64 kmp_int64 lo; // lower kmp_int64 up; // upper kmp_int64 st; // stride }; More...
 
llvm::OffloadEntriesInfoManager OffloadEntriesInfoManager
 Entity that registers the offloading constants that were emitted so far. More...
 
bool ShouldMarkAsGlobal = true
 
llvm::DenseSet< CanonicalDeclPtr< const Decl > > AlreadyEmittedTargetDecls
 List of the emitted declarations. More...
 
llvm::StringMap< llvm::WeakTrackingVH > EmittedNonTargetVariables
 List of the global variables with their addresses that should not be emitted for the target. More...
 
llvm::SmallDenseSet< const VarDecl * > DeferredGlobalVariables
 List of variables that can become declare target implicitly and, thus, must be emitted. More...
 
llvm::SmallVector< NontemporalDeclsSet, 4 > NontemporalDeclsStack
 Stack for list of declarations in current context marked as nontemporal. More...
 
llvm::SmallVector< UntiedLocalVarsAddressesMap, 4 > UntiedLocalVarsStack
 
llvm::SmallVector< LastprivateConditionalData, 4 > LastprivateConditionalStack
 Stack for list of addresses of declarations in current context marked as lastprivate conditional. More...
 
bool HasRequiresUnifiedSharedMemory = false
 Flag for keeping track of weather a requires unified_shared_memory directive is present. More...
 
llvm::AtomicOrdering RequiresAtomicOrdering = llvm::AtomicOrdering::Monotonic
 Atomic ordering from the omp requires directive. More...
 
bool HasEmittedTargetRegion = false
 Flag for keeping track of weather a target region has been emitted. More...
 
bool HasEmittedDeclareTargetRegion = false
 Flag for keeping track of weather a device routine has been emitted. More...
 
llvm::StringSet ThreadPrivateWithDefinition
 Set of threadprivate variables with the generated initializer. More...
 
llvm::StringSet DeclareTargetWithDefinition
 Set of declare target variables with the generated initializer. More...
 

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 448 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 440 of file CGOpenMPRuntime.h.

◆ NontemporalDeclsSet

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

Definition at line 526 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 415 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 430 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 435 of file CGOpenMPRuntime.h.

◆ UntiedLocalVarsAddressesMap

Definition at line 533 of file CGOpenMPRuntime.h.

Constructor & Destructor Documentation

◆ CGOpenMPRuntime()

CGOpenMPRuntime::CGOpenMPRuntime ( CodeGenModule CGM)
explicit

◆ ~CGOpenMPRuntime()

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

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

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

◆ checkAndEmitLastprivateConditional()

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

◆ checkAndEmitSharedLastprivateConditional()

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

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

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

Definition at line 12307 of file CGOpenMPRuntime.cpp.

References clang::CapturedStmt::capturesVariable(), clang::CodeGen::CodeGenFunction::CurFn, clang::CodeGen::CGOpenMPRuntime::LastprivateConditionalData::Disabled, clang::CodeGen::CodeGenFunction::EmitLoadOfScalar(), clang::CodeGen::CodeGenFunction::EmitLValueForField(), clang::CodeGen::CodeGenFunction::getLangOpts(), clang::getOpenMPCaptureRegions(), LastprivateConditionalStack, and LastprivateConditionalToTypes.

◆ clear()

void CGOpenMPRuntime::clear ( )
virtual

◆ 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().

◆ createDispatchFiniFunction()

llvm::FunctionCallee CGOpenMPRuntime::createDispatchFiniFunction ( unsigned  IVSize,
bool  IVSigned 
)
protected

Returns __kmpc_dispatch_fini_* runtime function for the specified size IVSize and sign IVSigned.

Definition at line 1553 of file CGOpenMPRuntime.cpp.

Referenced by emitForOrderedIterationEnd().

◆ createDispatchInitFunction()

llvm::FunctionCallee CGOpenMPRuntime::createDispatchInitFunction ( unsigned  IVSize,
bool  IVSigned 
)
protected

Returns __kmpc_dispatch_init_* runtime function for the specified size IVSize and sign IVSigned.

Definition at line 1531 of file CGOpenMPRuntime.cpp.

Referenced by emitForDispatchInit().

◆ createDispatchNextFunction()

llvm::FunctionCallee CGOpenMPRuntime::createDispatchNextFunction ( unsigned  IVSize,
bool  IVSigned 
)
protected

Returns __kmpc_dispatch_next_* runtime function for the specified size IVSize and sign IVSigned.

Definition at line 1570 of file CGOpenMPRuntime.cpp.

Referenced by emitForNext().

◆ createForStaticInitFunction()

llvm::FunctionCallee CGOpenMPRuntime::createForStaticInitFunction ( unsigned  IVSize,
bool  IVSigned,
bool  IsGPUDistribute 
)
protected

Returns __kmpc_for_static_init_* runtime function for the specified size IVSize and sign IVSigned.

Will create a distribute call __kmpc_distribute_static_init* if IsGPUDistribute is set.

Definition at line 1496 of file CGOpenMPRuntime.cpp.

Referenced by emitDistributeStaticInit(), and emitForStaticInit().

◆ createOffloadEntriesAndInfoMetadata()

void CGOpenMPRuntime::createOffloadEntriesAndInfoMetadata ( )

◆ emitBarrierCall()

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

Emit an implicit/explicit barrier for OpenMP threads.

Parameters
KindDirective for which this implicit barrier call must be generated. Must be OMPD_barrier for explicit barrier generation.
EmitCheckstrue if need to emit checks for cancellation barriers.
ForceSimpleCalltrue simple barrier call must be emitted, false if runtime class decides which one to emit (simple or with cancellation checks).

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

Definition at line 2513 of file CGOpenMPRuntime.cpp.

References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::CapturedStmtInfo, clang::CodeGen::CodeGenFunction::CGM, CGM, clang::CodeGen::CodeGenFunction::createBasicBlock(), clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), emitUpdateLocation(), getDefaultFlagsForBarriers(), clang::CodeGen::CodeGenModule::getLangOpts(), clang::CodeGen::CodeGenModule::getModule(), getThreadID(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), and OMPBuilder.

◆ emitCall()

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

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

◆ emitCancellationPointCall()

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

◆ emitCriticalRegion()

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

◆ emitDeclareSimdFunction()

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

◆ emitDeclareTargetVarDefinition()

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

◆ emitDeferredTargetDecls()

void CGOpenMPRuntime::emitDeferredTargetDecls ( ) const

Emit deferred declare target variables marked for deferred emission.

Definition at line 10430 of file CGOpenMPRuntime.cpp.

◆ emitDependClause()

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

Emits list of dependecies based on the provided data (array of dependence/expression pairs).

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

Definition at line 4409 of file CGOpenMPRuntime.cpp.

References clang::CodeGen::CodeGenFunction::Builder, CGM, clang::ImplicitParamDecl::Create(), clang::CodeGen::CGBuilderTy::CreateConstArrayGEP(), clang::CodeGen::CodeGenFunction::CreateMemTemp(), clang::CodeGen::CGBuilderTy::CreatePointerBitCastOrAddrSpaceCast(), clang::CodeGen::OMPTaskDataTy::DependData::DepExprs, clang::CodeGen::OMPTaskDataTy::DependData::DepKind, emitDependData(), emitDepobjElements(), emitDepobjElementsSizes(), clang::CodeGen::CodeGenFunction::EmitScalarExpr(), clang::CodeGen::CodeGenFunction::EmitStoreOfScalar(), clang::CodeGen::CodeGenFunction::EmitVarDecl(), End, clang::CodeGen::RValue::get(), clang::CodeGen::CodeGenFunction::GetAddrOfLocalVar(), clang::CodeGen::CodeGenModule::getContext(), getDependTypes(), clang::CodeGen::CodeGenTypeCache::Int32Ty, clang::CodeGen::CodeGenTypeCache::Int8Ty, clang::CodeGen::CodeGenTypeCache::IntPtrTy, clang::CodeGen::Address::invalid(), clang::CodeGen::OMPTaskDataTy::DependData::IteratorExpr, KmpDependInfoTy, clang::CodeGen::CodeGenFunction::MakeAddrLValue(), clang::ArrayType::Normal, clang::OMPIteratorExpr::numOfIterators(), clang::ImplicitParamDecl::Other, clang::CodeGen::CodeGenTypeCache::SizeTy, V, clang::VK_PRValue, and clang::CodeGen::CodeGenTypeCache::VoidPtrTy.

Referenced by emitTaskCall(), and emitTaskwaitCall().

◆ emitDepobjDependClause()

Address CGOpenMPRuntime::emitDepobjDependClause ( CodeGenFunction CGF,
const OMPTaskDataTy::DependData Dependencies,
SourceLocation  Loc 
)

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

References addFieldToRecordDecl(), clang::CodeGen::CodeGenFunction::Builder, CGM, clang::RecordDecl::completeDefinition(), clang::CodeGen::CGBuilderTy::CreateConstArrayGEP(), clang::CodeGen::CodeGenFunction::CreateMemTemp(), clang::CodeGen::CGBuilderTy::CreatePointerBitCastOrAddrSpaceCast(), clang::CodeGen::CodeGenFunction::EHStack, clang::CodeGen::CodeGenFunction::EmitLValueForField(), clang::CodeGen::CodeGenFunction::EmitNullInitialization(), clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), clang::CodeGen::CodeGenFunction::EmitScalarConversion(), clang::CodeGen::CodeGenFunction::EmitScalarExpr(), clang::CodeGen::CodeGenFunction::EmitStoreOfScalar(), emitUpdateLocation(), clang::RecordDecl::field_begin(), clang::Type::getAsTagDecl(), clang::OMPExecutableDirective::getBeginLoc(), clang::CodeGen::CodeGenModule::getContext(), clang::OMPExecutableDirective::getEndLoc(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::Address::getPointer(), getThreadID(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), clang::CodeGen::CodeGenTypeCache::Int32Ty, clang::CodeGen::CodeGenTypeCache::Int64Ty, clang::QualType::isNull(), KmpDimTy, clang::CodeGen::CodeGenFunction::MakeAddrLValue(), clang::ArrayType::Normal, clang::CodeGen::NormalAndEHCleanup, OMPBuilder, clang::TagDecl::startDefinition(), and clang::CodeGen::CodeGenTypeCache::VoidPtrTy.

◆ emitDoacrossOrdered()

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

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

References addMonoNonMonoModifier(), clang::CodeGen::CodeGenFunction::Builder, CGM, clang::CodeGen::CGOpenMPRuntime::DispatchRTInput::Chunk, createDispatchInitFunction(), clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), emitUpdateLocation(), getRuntimeSchedule(), getThreadID(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), clang::CodeGen::CGOpenMPRuntime::DispatchRTInput::LB, clang::OpenMPScheduleTy::M1, clang::OpenMPScheduleTy::M2, clang::OpenMPScheduleTy::Schedule, and clang::CodeGen::CGOpenMPRuntime::DispatchRTInput::UB.

◆ emitForNext()

llvm::Value * CGOpenMPRuntime::emitForNext ( CodeGenFunction CGF,
SourceLocation  Loc,
unsigned  IVSize,
bool  IVSigned,
Address  IL,
Address  LB,
Address  UB,
Address  ST 
)
virtual

Call __kmpc_dispatch_next( ident_t *loc, kmp_int32 tid, kmp_int32 *p_lastiter, kmp_int[32|64] *p_lower, kmp_int[32|64] *p_upper, kmp_int[32|64] *p_stride);.

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

Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.

Definition at line 2854 of file CGOpenMPRuntime.cpp.

References clang::ASTContext::BoolTy, createDispatchNextFunction(), clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), clang::CodeGen::CodeGenFunction::EmitScalarConversion(), emitUpdateLocation(), clang::CodeGen::CodeGenFunction::getContext(), clang::ASTContext::getIntTypeForBitwidth(), clang::CodeGen::Address::getPointer(), and getThreadID().

◆ emitForOrderedIterationEnd()

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

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

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

Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.

Definition at line 2843 of file CGOpenMPRuntime.cpp.

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

◆ emitForStaticFinish()

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

◆ emitForStaticInit()

void CGOpenMPRuntime::emitForStaticInit ( CodeGenFunction CGF,
SourceLocation  Loc,
OpenMPDirectiveKind  DKind,
const OpenMPScheduleTy ScheduleKind,
const StaticRTInput Values 
)
virtual

Call the appropriate runtime routine to initialize it before start of loop.

This is used only in case of static schedule, when the user did not specify a ordered clause on the loop construct. Depending on the loop schedule, it is necessary to call some runtime routine before start of the OpenMP loop to get the loop upper / lower bounds LB and UB and stride ST.

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

Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.

Definition at line 2774 of file CGOpenMPRuntime.cpp.

References clang::CodeGen::CGOpenMPRuntime::StaticRTInput::Chunk, clang::CodeGen::ApplyDebugLocation::CreateDefaultArtificial(), createForStaticInitFunction(), emitForStaticInitCall(), emitUpdateLocation(), getRuntimeSchedule(), getThreadID(), clang::isOpenMPLoopDirective(), clang::isOpenMPWorksharingDirective(), clang::CodeGen::CGOpenMPRuntime::StaticRTInput::IVSigned, clang::CodeGen::CGOpenMPRuntime::StaticRTInput::IVSize, clang::OpenMPScheduleTy::M1, clang::OpenMPScheduleTy::M2, clang::CodeGen::CGOpenMPRuntime::StaticRTInput::Ordered, and clang::OpenMPScheduleTy::Schedule.

◆ emitFunctionProlog()

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

Emits OpenMP-specific function prolog.

Required for device constructs.

Reimplemented in clang::CodeGen::CGOpenMPRuntimeGPU.

Definition at line 11711 of file CGOpenMPRuntime.cpp.

References HasEmittedDeclareTargetRegion.

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

◆ emitIfClause()

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

◆ emitInlinedDirective()

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

Emit code for the directive that does not require outlining.

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

Definition at line 5869 of file CGOpenMPRuntime.cpp.

References clang::CodeGen::CodeGenFunction::CapturedStmtInfo, clang::CodeGen::CodeGenFunction::CGCapturedStmtInfo::EmitBody(), and clang::CodeGen::CodeGenFunction::HaveInsertPoint().

Referenced by emitCriticalRegion(), emitMaskedRegion(), emitMasterRegion(), emitOrderedRegion(), clang::CodeGen::CodeGenFunction::EmitSimpleOMPExecutableDirective(), emitSingleRegion(), emitTargetDataStandAloneCall(), and emitTaskgroupRegion().

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

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

◆ emitNumTeamsClause()

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

Emits call to void __kmpc_push_num_teams(ident_t *loc, kmp_int32 global_tid, kmp_int32 num_teams, kmp_int32 thread_limit) to generate code for num_teams clause.

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

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

Definition at line 10615 of file CGOpenMPRuntime.cpp.

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

◆ emitNumTeamsForTargetDirective()

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

◆ emitNumThreadsClause()

void CGOpenMPRuntime::emitNumThreadsClause ( CodeGenFunction CGF,
llvm::Value *  NumThreads,
SourceLocation  Loc 
)
virtual

Emits call to void __kmpc_push_num_threads(ident_t *loc, kmp_int32 global_tid, kmp_int32 num_threads) to generate code for 'num_threads' clause.

Parameters
NumThreadsAn integer value of threads.

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

Definition at line 2878 of file CGOpenMPRuntime.cpp.

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

◆ emitNumThreadsForTargetDirective()

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

◆ emitOrderedRegion()

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

Emit an ordered region.

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

Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.

Definition at line 2456 of file CGOpenMPRuntime.cpp.

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

◆ emitOutlinedFunctionCall()

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

References emitCall().

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

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

References CGM, emitIfClause(), emitOutlinedFunctionCall(), emitThreadIDAddress(), emitUpdateLocation(), getKmpc_MicroPointerTy(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::CodeGenModule::getOpenMPRuntime(), clang::CodeGen::Address::getPointer(), getThreadID(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), and OMPBuilder.

◆ emitParallelOutlinedFunction()

llvm::Function * CGOpenMPRuntime::emitParallelOutlinedFunction ( const OMPExecutableDirective D,
const VarDecl ThreadIDVar,
OpenMPDirectiveKind  InnermostKind,
const RegionCodeGenTy CodeGen 
)
virtual

Emits outlined function for the specified OpenMP parallel directive D.

This outlined function has type void(*)(kmp_int32 ThreadID, kmp_int32 BoundID, struct context_vars).

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

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

Definition at line 1265 of file CGOpenMPRuntime.cpp.

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

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

◆ emitProcBindClause()

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

◆ emitReduction()

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

Emit a code for reduction clause.

Next code should be emitted for reduction:

static kmp_critical_name lock = { 0 };
void reduce_func(void *lhs[<n>], void *rhs[<n>]) {
...
*(Type<i>*)lhs[i] = RedOp<i>(*(Type<i>*)lhs[i], *(Type<i>*)rhs[i]);
...
}
...
void *RedList[<n>] = {&<RHSExprs>[0], ..., &<RHSExprs>[<n>-1]};
switch (__kmpc_reduce{_nowait}(<loc>, <gtid>, <n>, sizeof(RedList),
RedList, reduce_func, &<lock>)) {
case 1:
...
<LHSExprs>[i] = RedOp<i>(*<LHSExprs>[i], *<RHSExprs>[i]);
...
__kmpc_end_reduce{_nowait}(<loc>, <gtid>, &<lock>);
break;
case 2:
...
Atomic(<LHSExprs>[i] = RedOp<i>(*<LHSExprs>[i], *<RHSExprs>[i]));
...
break;
default:;
}
Parameters
PrivatesList of private copies for original reduction arguments.
LHSExprsList of LHS in ReductionOps reduction operations.
RHSExprsList of RHS in ReductionOps reduction operations.
ReductionOpsList of reduction operations in form 'LHS binop RHS' or 'operator binop(LHS, RHS)'.
OptionsList of options for reduction codegen: WithNowait true if parent directive has also nowait clause, false otherwise. SimpleReduction Emit reduction operation only. Used for omp simd directive on the host. ReductionKind The kind of reduction to perform.

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

Definition at line 5117 of file CGOpenMPRuntime.cpp.

◆ emitReductionFunction()

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

Emits reduction function.

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

References clang::CodeGen::CodeGenTypes::arrangeBuiltinFunctionDeclaration(), CGM, clang::CodeGen::CodeGenModule::getContext(), clang::CodeGen::CodeGenModule::getTypes(), clang::ImplicitParamDecl::Other, and string().

◆ emitRequiresDirectiveRegFun()

llvm::Function * CGOpenMPRuntime::emitRequiresDirectiveRegFun ( )

◆ emitSingleReductionCombiner()

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

◆ emitSingleRegion()

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

◆ emitTargetCall()

void CGOpenMPRuntime::emitTargetCall ( CodeGenFunction CGF,
const OMPExecutableDirective D,
llvm::Function *  OutlinedFn,
llvm::Value *  OutlinedFnID,
const Expr IfCond,
llvm::PointerIntPair< const Expr *, 2, OpenMPDeviceClauseModifier Device,
llvm::function_ref< llvm::Value *(CodeGenFunction &CGF, const OMPLoopDirective &D)>  SizeEmitter 
)
virtual

Emit the target offloading code associated with D.

The emitted code attempts offloading the execution to the device, an the event of a failure it executes the host version outlined in OutlinedFn.

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

Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.

Definition at line 9811 of file CGOpenMPRuntime.cpp.

References clang::CapturedStmt::Capture::capturesThis(), clang::CapturedStmt::Capture::capturesVariable(), clang::CapturedStmt::Capture::capturesVariableArrayType(), emitOffloadingArrays(), clang::OMPExecutableDirective::getCapturedStmt(), clang::CapturedStmt::Capture::getCapturedVar(), clang::ValueDecl::getType(), clang::OMPExecutableDirective::hasClausesOfKind(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), clang::codegenoptions::NoDebugInfo, and clang::OMPC_DEVICE_unknown.

◆ emitTargetDataCalls()

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

Emit the target data mapping code associated with D.

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

Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.

Definition at line 10644 of file CGOpenMPRuntime.cpp.

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

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

References CGM, emitIfClause(), emitInlinedDirective(), emitOffloadingArrays(), emitUpdateLocation(), clang::OMPExecutableDirective::getBeginLoc(), clang::OMPExecutableDirective::getDirectiveKind(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::CodeGenTypeCache::getPointerAlign(), clang::OMPExecutableDirective::hasClausesOfKind(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), clang::codegenoptions::NoDebugInfo, and OMPBuilder.

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

References clang::GlobalDecl::getDecl(), and isAssumedToBeNotEmitted().

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

References clang::GlobalDecl::getDecl().

◆ emitTargetGlobalVariable()

bool CGOpenMPRuntime::emitTargetGlobalVariable ( GlobalDecl  GD)
virtual

Emit the global variable if it is a valid device global variable.

Returns true if GD was dealt with successfully.

Parameters
GDVariable declaration to emit.

Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.

Definition at line 10298 of file CGOpenMPRuntime.cpp.

References clang::Ctor_Complete, clang::CXXRecordDecl::ctors(), clang::Dtor_Complete, clang::Type::getAsCXXRecordDecl(), clang::Type::getBaseElementTypeUnsafe(), clang::GlobalDecl::getDecl(), clang::CXXRecordDecl::getDestructor(), and isAssumedToBeNotEmitted().

◆ emitTargetNumIterationsCall()

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

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

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

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

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

◆ emitTargetOutlinedFunctionHelper()

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

Helper to emit outlined function for 'target' directive.

Parameters
DDirective to emit.
ParentNameName of the function that encloses the target region.
OutlinedFnOutlined function value to be defined by this call.
OutlinedFnIDOutlined function ID value to be defined by this call.
IsOffloadEntryTrue if the outlined function is an offload entry.
CodeGenLambda codegen specific to an accelerator device. An outlined function may not be an entry if, e.g. the if clause always evaluates to false.

Definition at line 6093 of file CGOpenMPRuntime.cpp.

References CGM, clang::CodeGen::CodeGenFunction::GenerateOpenMPCapturedStmtFunction(), clang::OMPExecutableDirective::getBeginLoc(), clang::CapturedStmt::getBeginLoc(), clang::CapturedStmt::getCapturedStmt(), clang::CodeGen::CodeGenModule::getContext(), getNumTeamsExprForTargetDirective(), getNumThreadsExprForTargetDirective(), clang::CodeGen::CodeGenModule::getTargetCodeGenInfo(), getTargetEntryUniqueInfo(), OffloadEntriesInfoManager, 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 4697 of file CGOpenMPRuntime.cpp.

References clang::CodeGen::CodeGenFunction::Builder, CGM, clang::CodeGen::OMPTaskDataTy::Dependences, emitDependClause(), emitIfClause(), emitTaskInit(), emitUpdateLocation(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::Address::getPointer(), getThreadID(), clang::CodeGen::OMPTaskDataTy::HasNowaitClause, clang::CodeGen::CodeGenFunction::HaveInsertPoint(), clang::CodeGen::Address::invalid(), OMPBuilder, clang::CodeGen::RegionCodeGenTy::setAction(), clang::CodeGen::OMPTaskDataTy::Tied, and clang::CodeGen::CodeGenTypeCache::VoidPtrTy.

◆ emitTaskgroupRegion()

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

Emit a taskgroup region.

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

Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.

Definition at line 2278 of file CGOpenMPRuntime.cpp.

References CGM, emitInlinedDirective(), emitUpdateLocation(), clang::CodeGen::CodeGenModule::getModule(), getThreadID(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), 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 3802 of file CGOpenMPRuntime.cpp.

References clang::CodeGen::CodeGenFunction::Builder, 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::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::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::OMPTaskDataTy::Final, clang::CodeGen::OMPTaskDataTy::FirstprivateCopies, clang::CodeGen::OMPTaskDataTy::FirstprivateInits, clang::CodeGen::OMPTaskDataTy::FirstprivateVars, 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::Address::getPointer(), 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, clang::CodeGen::OMPTaskDataTy::LastprivateCopies, clang::CodeGen::OMPTaskDataTy::LastprivateVars, clang::CodeGen::CodeGenFunction::MakeAddrLValue(), clang::CodeGen::CodeGenFunction::MakeNaturalAlignAddrLValue(), clang::ArrayType::Normal, OMPBuilder, clang::ImplicitParamDecl::Other, clang::CodeGen::OMPTaskDataTy::Priority, Priority, clang::CodeGen::OMPTaskDataTy::PrivateCopies, clang::CodeGen::OMPTaskDataTy::PrivateLocals, clang::CodeGen::OMPTaskDataTy::PrivateVars, SavedKmpTaskloopTQTy, SavedKmpTaskTQTy, clang::CodeGen::CodeGenTypeCache::SizeTy, clang::CodeGen::OMPTaskDataTy::Tied, 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 4817 of file CGOpenMPRuntime.cpp.

References clang::CodeGen::CodeGenFunction::Builder, CGM, clang::CodeGen::CGBuilderTy::CreatePointerBitCastOrAddrSpaceCast(), clang::CodeGen::CodeGenFunction::EmitAnyExprToMem(), clang::CodeGen::CodeGenFunction::EmitLoadOfScalar(), clang::CodeGen::CodeGenFunction::EmitLValueForField(), clang::CodeGen::CodeGenFunction::EmitNullInitialization(), clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), clang::CodeGen::CodeGenFunction::EmitStoreOfScalar(), 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, OMPBuilder, clang::CodeGen::OMPTaskDataTy::Reductions, clang::CodeGen::OMPTaskDataTy::Schedule, clang::CodeGen::CodeGenTypeCache::VoidPtrTy, and clang::ASTContext::VoidPtrTy.

◆ emitTaskOutlinedFunction()

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

Emits outlined function for the OpenMP task directive D.

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

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

Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.

Definition at line 1281 of file CGOpenMPRuntime.cpp.

References clang::Type::castAs(), CGM, emitUpdateLocation(), clang::CodeGen::CodeGenFunction::GenerateCapturedStmtFunction(), clang::OMPExecutableDirective::getBeginLoc(), clang::OMPExecutableDirective::getCapturedStmt(), clang::OMPExecutableDirective::getDirectiveKind(), clang::CodeGen::CodeGenModule::getModule(), getThreadID(), clang::ValueDecl::getType(), clang::isOpenMPTaskLoopDirective(), clang::Type::isPointerType(), OMPBuilder, and clang::CodeGen::RegionCodeGenTy::setAction().

◆ emitTaskReductionFini()

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

Emits the following code for reduction clause with task modifier:

__kmpc_task_reduction_modifier_fini(loc, gtid, is_worksharing);

Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.

Definition at line 5761 of file CGOpenMPRuntime.cpp.

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

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

References addFieldToRecordDecl(), clang::CodeGen::CodeGenFunction::Builder, CGM, clang::RecordDecl::completeDefinition(), clang::CodeGen::CodeGenFunction::CreateMemTemp(), clang::CodeGen::CGBuilderTy::CreatePointerBitCastOrAddrSpaceCast(), clang::CodeGen::ReductionCodeGen::emitAggregateType(), clang::CodeGen::CodeGenFunction::EmitCastToVoidPtr(), clang::CodeGen::CodeGenFunction::EmitCheckedInBoundsGEP(), clang::CodeGen::CodeGenFunction::EmitLValueForField(), clang::CodeGen::CodeGenFunction::EmitNullInitialization(), emitReduceCombFunction(), emitReduceFiniFunction(), emitReduceInitFunction(), clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), clang::CodeGen::ReductionCodeGen::emitSharedOrigLValue(), clang::CodeGen::CodeGenFunction::EmitStoreOfScalar(), emitUpdateLocation(), clang::CodeGen::LValue::getAddress(), clang::CodeGen::CodeGenModule::getContext(), clang::CodeGen::Address::getElementType(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::ReductionCodeGen::getOrigLValue(), clang::CodeGen::Address::getPointer(), clang::CodeGen::LValue::getPointer(), clang::CodeGen::ReductionCodeGen::getSharedLValue(), clang::CodeGen::ReductionCodeGen::getSizes(), getThreadID(), clang::CodeGen::LValue::getType(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), clang::CodeGen::CodeGenTypeCache::Int32Ty, clang::CodeGen::CodeGenTypeCache::IntTy, clang::CodeGen::OMPTaskDataTy::IsReductionWithTaskMod, clang::CodeGen::OMPTaskDataTy::IsWorksharingReduction, clang::CodeGen::CodeGenFunction::MakeNaturalAlignAddrLValue(), clang::ArrayType::Normal, OMPBuilder, clang::CodeGen::OMPTaskDataTy::ReductionCopies, clang::CodeGen::OMPTaskDataTy::ReductionOps, clang::CodeGen::OMPTaskDataTy::ReductionOrigs, clang::CodeGen::OMPTaskDataTy::ReductionVars, clang::CodeGen::CodeGenTypeCache::SizeTy, clang::TagDecl::startDefinition(), and clang::CodeGen::CodeGenTypeCache::VoidPtrTy.

◆ 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 10590 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(), and OMPBuilder.

◆ emitTeamsOutlinedFunction()

llvm::Function * CGOpenMPRuntime::emitTeamsOutlinedFunction ( const OMPExecutableDirective D,
const VarDecl ThreadIDVar,
OpenMPDirectiveKind  InnermostKind,
const RegionCodeGenTy CodeGen 
)
virtual

Emits outlined function for the specified OpenMP teams directive D.

This outlined function has type void(*)(kmp_int32 ThreadID, kmp_int32 BoundID, struct context_vars).

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

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

Definition at line 1273 of file CGOpenMPRuntime.cpp.

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

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

◆ emitThreadIDAddress()

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

◆ emitThreadPrivateVarDefinition()

llvm::Function * CGOpenMPRuntime::emitThreadPrivateVarDefinition ( const VarDecl VD,
Address  VDAddr,
SourceLocation  Loc,
bool  PerformInit,
CodeGenFunction CGF = nullptr 
)
virtual

Emit a code for initialization of threadprivate variable.

It emits a call to runtime library which adds initial value to the newly created threadprivate variable (if it is not constant) and registers destructor for the variable (if any).

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

Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.

Definition at line 1711 of file CGOpenMPRuntime.cpp.

References clang::CodeGen::CodeGenTypes::arrangeBuiltinFunctionDeclaration(), CGM, clang::VarDecl::getAnyInitializer(), clang::CodeGen::CodeGenModule::getContext(), clang::VarDecl::getDefinition(), clang::CodeGen::CodeGenTypes::GetFunctionType(), clang::CodeGen::CodeGenModule::getLangOpts(), clang::CodeGen::CodeGenModule::getMangledName(), clang::ASTContext::getTargetInfo(), clang::ValueDecl::getType(), clang::CodeGen::CodeGenModule::getTypes(), clang::TargetInfo::isTLSSupported(), clang::ImplicitParamDecl::Other, string(), ThreadPrivateWithDefinition, and clang::ASTContext::VoidPtrTy.

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

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

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

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

References Begin, clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::createBasicBlock(), clang::CodeGen::CodeGenFunction::EmitBlock(), clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), getName(), and clang::CharUnits::getQuantity().

◆ 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 
)
protected

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::CodeGen::CodeGenFunction::CurFuncDecl, clang::CodeGen::CodeGenModule::getCodeGenOpts(), clang::PresumedLoc::getColumn(), clang::CodeGen::CodeGenFunction::getContext(), getDefaultLocationReserved2Flags(), clang::PresumedLoc::getFilename(), clang::PresumedLoc::getLine(), clang::SourceManager::getPresumedLoc(), clang::ASTContext::getSourceManager(), clang::SourceLocation::isInvalid(), Line, clang::codegenoptions::NoDebugInfo, OMPBuilder, and string().

Referenced by clang::CodeGen::CGOpenMPRuntimeGPU::emitBarrierCall(), emitBarrierCall(), emitCancelCall(), emitCancellationPointCall(), emitCriticalRegion(), emitDistributeStaticInit(), emitDoacrossInit(), emitDoacrossOrdered(), emitErrorCall(), emitFlush(), emitForDispatchInit(), emitForNext(), emitForOrderedIterationEnd(), emitForStaticFinish(), emitForStaticInit(), emitMaskedRegion(), emitMasterRegion(), emitNumTeamsClause(), emitNumThreadsClause(), emitOrderedRegion(), clang::CodeGen::CGOpenMPRuntimeGPU::emitParallelCall(), emitParallelCall(), emitProcBindClause(), emitSingleRegion(), emitTargetDataCalls(), emitTargetDataStandAloneCall(), emitTaskCall(), emitTaskgroupRegion(), emitTaskInit(), emitTaskLoopCall(), emitTaskOutlinedFunction(), emitTaskReductionFini(), emitTaskReductionInit(), emitTaskwaitCall(), emitTaskyieldCall(), emitTeamsCall(), emitThreadPrivateVarInit(), 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,
void *name = nullptr) {
// Allocate space for an array section first or add a base/begin for
// pointer dereference.
if ((size > 1 || (base != begin && maptype.IsPtrAndObj)) &&
!maptype.IsDelete)
__tgt_push_mapper_component(rt_mapper_handle, base, begin,
size*sizeof(Ty), clearToFromMember(type));
// Map members.
for (unsigned i = 0; i < size; i++) {
// For each component specified by this mapper:
for (auto c : begin[i]->all_components) {
if (c.hasMapper())
(*c.Mapper())(rt_mapper_handle, c.arg_base, c.arg_begin, c.arg_size,
c.arg_type, c.arg_name);
else
__tgt_push_mapper_component(rt_mapper_handle, c.arg_base,
c.arg_begin, c.arg_size, c.arg_type,
c.arg_name);
}
}
// Delete the array section.
if (size > 1 && maptype.IsDelete)
__tgt_push_mapper_component(rt_mapper_handle, base, begin,
size*sizeof(Ty), clearToFromMember(type));
}

Definition at line 9445 of file CGOpenMPRuntime.cpp.

References clang::Decl::getLocation(), clang::OMPDeclareMapperDecl::getMapperVarRef(), clang::ValueDecl::getType(), and clang::ImplicitParamDecl::Other.

Referenced by clang::CodeGen::CodeGenModule::EmitOMPDeclareMapper().

◆ emitUserDefinedReduction()

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

◆ emitUsesAllocatorsFini()

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

Destroys user defined allocators specified in the uses_allocators clause.

Definition at line 6077 of file CGOpenMPRuntime.cpp.

◆ emitUsesAllocatorsInit()

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

Initializes user defined allocators specified in the uses_allocators clauses.

Definition at line 6042 of file CGOpenMPRuntime.cpp.

◆ functionFinished()

void CGOpenMPRuntime::functionFinished ( CodeGenFunction CGF)
virtual

◆ getAddressOfLocalVariable()

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

◆ getAddrOfArtificialThreadPrivate()

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

Creates artificial threadprivate variable with name Name and type VarType.

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

Reimplemented in clang::CodeGen::CGOpenMPSIMDRuntime.

Definition at line 1964 of file CGOpenMPRuntime.cpp.

Referenced by emitTaskReductionFixups().

◆ getAddrOfDeclareTargetVar()

Address CGOpenMPRuntime::getAddrOfDeclareTargetVar ( const VarDecl VD)
virtual

◆ getAddrOfThreadPrivate()

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

◆ getCriticalRegionLock()

llvm::Value * CGOpenMPRuntime::getCriticalRegionLock ( StringRef  CriticalName)
protected

Returns corresponding lock object for the specified critical region name.

If the lock object does not exist it is created, otherwise the reference to the existing copy is returned.

Parameters
CriticalNameName of the critical region.

Definition at line 2131 of file CGOpenMPRuntime.cpp.

References string().

Referenced by emitCriticalRegion().

◆ getDefaultDistScheduleAndChunk()

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

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

Reimplemented in clang::CodeGen::CGOpenMPRuntimeGPU.

Definition at line 1511 of file CGOpenMPRuntime.h.

◆ getDefaultFlagsForBarriers()

unsigned CGOpenMPRuntime::getDefaultFlagsForBarriers ( OpenMPDirectiveKind  Kind)
staticprotected

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

Definition at line 2480 of file CGOpenMPRuntime.cpp.

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

◆ getDefaultLocationReserved2Flags()

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

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

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

◆ getDefaultScheduleAndChunk()

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

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

Reimplemented in clang::CodeGen::CGOpenMPRuntimeGPU.

Definition at line 2495 of file CGOpenMPRuntime.cpp.

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

References OMPBuilder.

◆ getKmpc_MicroPointerTy()

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

Returns pointer to kmpc_micro type.

Definition at line 1485 of file CGOpenMPRuntime.cpp.

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

Referenced by emitParallelCall(), and emitTeamsCall().

◆ getKmpCriticalNameTy()

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

Get the LLVM type for the critical name.

Definition at line 404 of file CGOpenMPRuntime.h.

References KmpCriticalNameTy.

◆ getName()

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

Get the platform-specific name separator.

Definition at line 1089 of file CGOpenMPRuntime.cpp.

References OMPBuilder.

Referenced by emitLastprivateConditionalUpdate(), emitRequiresDirectiveRegFun(), and getOrCreateThreadPrivateCache().

◆ getNumTeamsExprForTargetDirective()

const Expr * CGOpenMPRuntime::getNumTeamsExprForTargetDirective ( CodeGenFunction CGF,
const OMPExecutableDirective D,
int32_t &  DefaultVal 
)
protected

◆ getNumThreadsExprForTargetDirective()

const Expr * CGOpenMPRuntime::getNumThreadsExprForTargetDirective ( CodeGenFunction CGF,
const OMPExecutableDirective D,
int32_t &  DefaultVal 
)
protected

Emit the number of threads for a target directive.

Inspect the thread_limit clause associated with a teams construct combined or closely nested with the target directive.

Emit the num_threads clause for directives such as 'target parallel' that have no associated teams construct.

Otherwise, return nullptr.

Definition at line 6437 of file CGOpenMPRuntime.cpp.

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

Referenced by emitTargetOutlinedFunctionHelper().

◆ 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 1660 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(), OMPBuilder, and string().

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

◆ getOutlinedHelperName()

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

Get the function name of an outlined region.

Reimplemented in clang::CodeGen::CGOpenMPRuntimeGPU.

Definition at line 376 of file CGOpenMPRuntime.h.

Referenced by emitParallelOutlinedFunction(), and emitTeamsOutlinedFunction().

◆ getParameterAddress()

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

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

Parameters
NativeParamParameter itself.
TargetParamCorresponding target-specific parameter.

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

Definition at line 11717 of file CGOpenMPRuntime.cpp.

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

Referenced by emitOutlinedFunctionPrologue().

◆ getSingleCompoundChild()

const Stmt * CGOpenMPRuntime::getSingleCompoundChild ( ASTContext Ctx,
const Stmt Body 
)
static

Checks if the Body is the CompoundStmt and returns its child statement iff there is only one that is not evaluatable at the compile time.

Definition at line 6136 of file CGOpenMPRuntime.cpp.

References clang::Stmt::IgnoreContainers().

Referenced by emitNumThreadsForTargetDirective(), getNumTeamsExprForTargetDirective(), getNumThreads(), 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 5796 of file CGOpenMPRuntime.cpp.

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

◆ 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::CodeGen::CodeGenFunction::CapturedStmtInfo, CGM, clang::CodeGen::CodeGenFunction::CurFn, clang::CodeGen::CodeGenFunction::EHStack, clang::CodeGen::CodeGenFunction::EmitLoadOfScalar(), emitUpdateLocation(), getIdentStringFromSourceLocation(), clang::CodeGen::CodeGenModule::getLangOpts(), clang::CodeGen::CodeGenFunction::getLangOpts(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::LValue::getPointer(), clang::CodeGen::CodeGenTypeCache::getRuntimeCC(), OMPBuilder, OpenMPLocThreadIDMap, clang::CodeGen::EHScopeStack::requiresLandingPad(), and setLocThreadIdInsertPt().

Referenced by clang::CodeGen::CGOpenMPRuntimeGPU::emitBarrierCall(), emitBarrierCall(), emitCancelCall(), emitCancellationPointCall(), emitCriticalRegion(), emitDepobjDependClause(), emitDestroyClause(), emitDistributeStaticInit(), emitDoacrossInit(), emitDoacrossOrdered(), emitForDispatchInit(), emitForNext(), emitForOrderedIterationEnd(), emitForStaticFinish(), emitForStaticInit(), emitMaskedRegion(), emitMasterRegion(), emitNumTeamsClause(), emitNumThreadsClause(), emitOrderedRegion(), clang::CodeGen::CGOpenMPRuntimeGPU::emitParallelCall(), emitParallelCall(), emitProcBindClause(), emitSingleRegion(), emitTaskCall(), emitTaskgroupRegion(), emitTaskInit(), emitTaskLoopCall(), emitTaskOutlinedFunction(), emitTaskReductionFini(), emitTaskReductionInit(), emitTaskwaitCall(), emitTaskyieldCall(), emitThreadIDAddress(), getAddressOfLocalVariable(), 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 1175 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 10485 of file CGOpenMPRuntime.cpp.

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

◆ hasRequiresUnifiedSharedMemory()

bool CGOpenMPRuntime::hasRequiresUnifiedSharedMemory ( ) const

Return whether the unified_shared_memory has been specified.

Definition at line 10510 of file CGOpenMPRuntime.cpp.

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

◆ isDefaultLocationConstant()

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

Check if the default location must be constant.

Default is false to support OMPT/OMPD.

Reimplemented in clang::CodeGen::CGOpenMPRuntimeGPU.

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

References getRuntimeSchedule().

◆ isLocalVarInUntiedTask()

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

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

Definition at line 11853 of file CGOpenMPRuntime.cpp.

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

◆ isNontemporalDecl()

bool CGOpenMPRuntime::isNontemporalDecl ( const ValueDecl VD) const

◆ 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 2628 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 2621 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 2615 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 2608 of file CGOpenMPRuntime.cpp.

References getRuntimeSchedule().

◆ isTargetCodegen()

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

Returns true if the current target is a GPU.

Reimplemented in clang::CodeGen::CGOpenMPRuntimeGPU.

Definition at line 696 of file CGOpenMPRuntime.h.

◆ loadOffloadInfoMetadata()

void CGOpenMPRuntime::loadOffloadInfoMetadata ( )
protected

◆ 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 10528 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

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

Reimplemented in clang::CodeGen::CGOpenMPRuntimeGPU.

Definition at line 10457 of file CGOpenMPRuntime.cpp.

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

Referenced by clang::CodeGen::CodeGenModule::EmitOMPRequiresDecl().

◆ registerTargetGlobalVariable()

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

Checks if the provided global decl GD is a declare target variable and registers it when emitting code for the host.

Definition at line 10337 of file CGOpenMPRuntime.cpp.

References clang::VarDecl::DeclarationOnly, getName(), clang::ValueDecl::getType(), clang::VarDecl::hasDefinition(), clang::InternalLinkage, clang::NamedDecl::isExternallyVisible(), and string().

Referenced by getAddrOfDeclareTargetVar().

◆ scanForTargetRegionsFunctions()

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

Start scanning from statement S and emit all target regions found along the way.

Parameters
SStarting statement.
ParentNameName of the function declaration that is being scanned.

Definition at line 10111 of file CGOpenMPRuntime.cpp.

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

Referenced by markAsGlobalTarget().

◆ CGM

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

Definition at line 309 of file CGOpenMPRuntime.h.

Referenced by CGOpenMPRuntime(), clang::CodeGen::CGOpenMPRuntimeGPU::CGOpenMPRuntimeGPU(), clang::CodeGen::CGOpenMPRuntimeGPU::clear(), createOffloadEntriesAndInfoMetadata(), emitAArch64DeclareSimdFunction(), clang::CodeGen::CGOpenMPRuntimeGPU::emitBarrierCall(), emitBarrierCall(), emitCancelCall(), emitCancellationPointCall(), clang::CodeGen::CGOpenMPRuntimeGPU::emitCriticalRegion(), emitCriticalRegion(), emitDeclareSimdFunction(), emitDeclareTargetVarDefinition(), emitDependClause(), emitDepobjDependClause(), emitDestroyClause(), emitDistributeStaticInit(), emitDoacrossInit(), emitDoacrossOrdered(), emitErrorCall(), emitFlush(), emitForDispatchInit(), emitForStaticFinish(), clang::CodeGen::CGOpenMPRuntimeGPU::emitFunctionProlog(), emitKmpRoutineEntryT(), emitLastprivateConditionalFinalUpdate(), emitLastprivateConditionalInit(), emitLastprivateConditionalUpdate(), emitMaskedRegion(), emitMasterRegion(), emitNumTeamsClause(), emitNumThreadsClause(), emitOrderedRegion(), clang::CodeGen::CGOpenMPRuntimeGPU::emitParallelCall(), emitParallelCall(), emitParallelOutlinedFunction(), emitProcBindClause(), emitReductionFunction(), emitRequiresDirectiveRegFun(), emitSingleRegion(), emitTargetDataCalls(), emitTargetDataStandAloneCall(), emitTargetOutlinedFunctionHelper(), emitTaskCall(), emitTaskgroupRegion(), emitTaskInit(), emitTaskLoopCall(), emitTaskOutlinedFunction(), emitTaskReductionFini(), emitTaskReductionFixups(), emitTaskReductionInit(), emitTaskwaitCall(), emitTaskyieldCall(), emitTeamsCall(), clang::CodeGen::CGOpenMPRuntimeGPU::emitTeamsOutlinedFunction(), emitTeamsOutlinedFunction(), emitThreadPrivateVarDefinition(), emitThreadPrivateVarInit(), emitUpdateClause(), emitUpdateLocation(), emitUserDefinedReduction(), clang::CodeGen::CGOpenMPRuntimeGPU::getAddressOfLocalVariable(), getAddressOfLocalVariable(), getAddrOfDeclareTargetVar(), getAddrOfThreadPrivate(), getAlignmentValue(), getDepobjElements(), clang::CodeGen::CGOpenMPRuntimeGPU::getGPUThreadID(), clang::CodeGen::CGOpenMPRuntimeGPU::getGPUWarpSize(), getKmpc_MicroPointerTy(), getOrCreateThreadPrivateCache(), getTaskReductionItem(), getThreadID(), isNontemporalDecl(), loadOffloadInfoMetadata(), markAsGlobalTarget(), clang::CodeGen::CGOpenMPRuntimeGPU::processRequiresDirective(), clang::CodeGen::CGOpenMPRuntimeGPU::translateParameter(), clang::CodeGen::CGOpenMPRuntime::DisableAutoDeclareTargetRAII::~DisableAutoDeclareTargetRAII(), clang::CodeGen::CGOpenMPRuntime::LastprivateConditionalRAII::~LastprivateConditionalRAII(), clang::CodeGen::CGOpenMPRuntime::NontemporalDeclsRAII::~NontemporalDeclsRAII(), and clang::CodeGen::CGOpenMPRuntime::UntiedTaskLocalDeclsRAII::~UntiedTaskLocalDeclsRAII().

◆ DeclareTargetWithDefinition

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

Set of declare target variables with the generated initializer.

Definition at line 604 of file CGOpenMPRuntime.h.

Referenced by emitDeclareTargetVarDefinition().

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

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

Referenced by clear().

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

Referenced by functionFinished().

◆ FunctionUDRMap

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

Definition at line 441 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 553 of file CGOpenMPRuntime.h.

Referenced by emitFunctionProlog(), and emitRequiresDirectiveRegFun().

◆ HasEmittedTargetRegion

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

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

Definition at line 549 of file CGOpenMPRuntime.h.

Referenced by emitRequiresDirectiveRegFun(), and 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 543 of file CGOpenMPRuntime.h.

Referenced by emitDeclareTargetVarDefinition(), emitRequiresDirectiveRegFun(), and getAddrOfDeclareTargetVar().

◆ 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 468 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 420 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 461 of file CGOpenMPRuntime.h.

Referenced by CGOpenMPRuntime(), 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 494 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 510 of file CGOpenMPRuntime.h.

Referenced by emitDoacrossInit().

◆ KmpRoutineEntryPtrQTy

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

Definition at line 471 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 470 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 504 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 481 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 539 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 456 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 529 of file CGOpenMPRuntime.h.

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

◆ OffloadEntriesInfoManager

llvm::OffloadEntriesInfoManager clang::CodeGen::CGOpenMPRuntime::OffloadEntriesInfoManager
protected

◆ OMPBuilder

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

◆ OpenMPDebugLocMap

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

Definition at line 416 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 546 of file CGOpenMPRuntime.h.

◆ SavedKmpTaskloopTQTy

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

Saved kmp_task_t for taskloop-based directive.

Definition at line 485 of file CGOpenMPRuntime.h.

Referenced by emitTaskInit().

◆ SavedKmpTaskTQTy

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

Saved kmp_task_t for task directive.

Definition at line 483 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 601 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 444 of file CGOpenMPRuntime.h.

Referenced by functionFinished().

◆ 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:
clang::ast_matchers::type
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
Definition: ASTMatchersInternal.cpp:774
hlsl::int64_t
long int64_t
Definition: hlsl_basic_types.h:26
c
__device__ __2f16 float c
Definition: __clang_hip_libdevice_declares.h:320
clang::transformer::name
RangeSelector name(std::string ID)
Given a node with a "name", (like NamedDecl, DeclRefExpr, CxxCtorInitializer, and TypeLoc) selects th...
Definition: RangeSelector.cpp:200