clang  14.0.0git
Public Member Functions | List of all members
clang::CodeGen::CGOpenMPSIMDRuntime Class Referencefinal

Class supports emissionof SIMD-only code. More...

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

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

Public Member Functions

 CGOpenMPSIMDRuntime (CodeGenModule &CGM)
 
 ~CGOpenMPSIMDRuntime () override
 
llvm::Function * emitParallelOutlinedFunction (const OMPExecutableDirective &D, const VarDecl *ThreadIDVar, OpenMPDirectiveKind InnermostKind, const RegionCodeGenTy &CodeGen) override
 Emits outlined function for the specified OpenMP parallel directive D. More...
 
llvm::Function * emitTeamsOutlinedFunction (const OMPExecutableDirective &D, const VarDecl *ThreadIDVar, OpenMPDirectiveKind InnermostKind, const RegionCodeGenTy &CodeGen) override
 Emits outlined function for the specified OpenMP teams directive D. More...
 
llvm::Function * emitTaskOutlinedFunction (const OMPExecutableDirective &D, const VarDecl *ThreadIDVar, const VarDecl *PartIDVar, const VarDecl *TaskTVar, OpenMPDirectiveKind InnermostKind, const RegionCodeGenTy &CodeGen, bool Tied, unsigned &NumberOfParts) override
 Emits outlined function for the OpenMP task directive D. More...
 
void emitParallelCall (CodeGenFunction &CGF, SourceLocation Loc, llvm::Function *OutlinedFn, ArrayRef< llvm::Value * > CapturedVars, const Expr *IfCond) override
 Emits code for parallel or serial call of the OutlinedFn with variables captured in a record which address is stored in CapturedStruct. More...
 
void emitCriticalRegion (CodeGenFunction &CGF, StringRef CriticalName, const RegionCodeGenTy &CriticalOpGen, SourceLocation Loc, const Expr *Hint=nullptr) override
 Emits a critical region. More...
 
void emitMasterRegion (CodeGenFunction &CGF, const RegionCodeGenTy &MasterOpGen, SourceLocation Loc) override
 Emits a master region. More...
 
void emitMaskedRegion (CodeGenFunction &CGF, const RegionCodeGenTy &MaskedOpGen, SourceLocation Loc, const Expr *Filter=nullptr) override
 Emits a masked region. More...
 
void emitTaskyieldCall (CodeGenFunction &CGF, SourceLocation Loc) override
 Emits a masked region. More...
 
void emitTaskgroupRegion (CodeGenFunction &CGF, const RegionCodeGenTy &TaskgroupOpGen, SourceLocation Loc) override
 Emit a taskgroup region. More...
 
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) override
 Emits a single region. More...
 
void emitOrderedRegion (CodeGenFunction &CGF, const RegionCodeGenTy &OrderedOpGen, SourceLocation Loc, bool IsThreads) override
 Emit an ordered region. More...
 
void emitBarrierCall (CodeGenFunction &CGF, SourceLocation Loc, OpenMPDirectiveKind Kind, bool EmitChecks=true, bool ForceSimpleCall=false) override
 Emit an implicit/explicit barrier for OpenMP threads. More...
 
void emitForDispatchInit (CodeGenFunction &CGF, SourceLocation Loc, const OpenMPScheduleTy &ScheduleKind, unsigned IVSize, bool IVSigned, bool Ordered, const DispatchRTInput &DispatchValues) override
 This is used for non static scheduled types and when the ordered clause is present on the loop construct. More...
 
void emitForStaticInit (CodeGenFunction &CGF, SourceLocation Loc, OpenMPDirectiveKind DKind, const OpenMPScheduleTy &ScheduleKind, const StaticRTInput &Values) override
 Call the appropriate runtime routine to initialize it before start of loop. More...
 
void emitDistributeStaticInit (CodeGenFunction &CGF, SourceLocation Loc, OpenMPDistScheduleClauseKind SchedKind, const StaticRTInput &Values) override
 
void emitForOrderedIterationEnd (CodeGenFunction &CGF, SourceLocation Loc, unsigned IVSize, bool IVSigned) override
 Call the appropriate runtime routine to notify that we finished iteration of the ordered loop with the dynamic scheduling. More...
 
void emitForStaticFinish (CodeGenFunction &CGF, SourceLocation Loc, OpenMPDirectiveKind DKind) override
 Call the appropriate runtime routine to notify that we finished all the work with current loop. More...
 
llvm::ValueemitForNext (CodeGenFunction &CGF, SourceLocation Loc, unsigned IVSize, bool IVSigned, Address IL, Address LB, Address UB, Address ST) override
 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...
 
void emitNumThreadsClause (CodeGenFunction &CGF, llvm::Value *NumThreads, SourceLocation Loc) override
 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...
 
void emitProcBindClause (CodeGenFunction &CGF, llvm::omp::ProcBindKind ProcBind, SourceLocation Loc) override
 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...
 
Address getAddrOfThreadPrivate (CodeGenFunction &CGF, const VarDecl *VD, Address VDAddr, SourceLocation Loc) override
 Returns address of the threadprivate variable for the current thread. More...
 
llvm::Function * emitThreadPrivateVarDefinition (const VarDecl *VD, Address VDAddr, SourceLocation Loc, bool PerformInit, CodeGenFunction *CGF=nullptr) override
 Emit a code for initialization of threadprivate variable. More...
 
Address getAddrOfArtificialThreadPrivate (CodeGenFunction &CGF, QualType VarType, StringRef Name) override
 Creates artificial threadprivate variable with name Name and type VarType. More...
 
void emitFlush (CodeGenFunction &CGF, ArrayRef< const Expr * > Vars, SourceLocation Loc, llvm::AtomicOrdering AO) override
 Emit flush of the variables specified in 'omp flush' directive. More...
 
void emitTaskCall (CodeGenFunction &CGF, SourceLocation Loc, const OMPExecutableDirective &D, llvm::Function *TaskFunction, QualType SharedsTy, Address Shareds, const Expr *IfCond, const OMPTaskDataTy &Data) override
 Emit task region for the task directive. More...
 
void emitTaskLoopCall (CodeGenFunction &CGF, SourceLocation Loc, const OMPLoopDirective &D, llvm::Function *TaskFunction, QualType SharedsTy, Address Shareds, const Expr *IfCond, const OMPTaskDataTy &Data) override
 Emit task region for the taskloop directive. More...
 
void emitReduction (CodeGenFunction &CGF, SourceLocation Loc, ArrayRef< const Expr * > Privates, ArrayRef< const Expr * > LHSExprs, ArrayRef< const Expr * > RHSExprs, ArrayRef< const Expr * > ReductionOps, ReductionOptionsTy Options) override
 Emit a code for reduction clause. More...
 
llvm::ValueemitTaskReductionInit (CodeGenFunction &CGF, SourceLocation Loc, ArrayRef< const Expr * > LHSExprs, ArrayRef< const Expr * > RHSExprs, const OMPTaskDataTy &Data) override
 Emit a code for initialization of task reduction clause. More...
 
void emitTaskReductionFini (CodeGenFunction &CGF, SourceLocation Loc, bool IsWorksharingReduction) override
 Emits the following code for reduction clause with task modifier: More...
 
void emitTaskReductionFixups (CodeGenFunction &CGF, SourceLocation Loc, ReductionCodeGen &RCG, unsigned N) override
 Required to resolve existing problems in the runtime. More...
 
Address getTaskReductionItem (CodeGenFunction &CGF, SourceLocation Loc, llvm::Value *ReductionsPtr, LValue SharedLVal) override
 Get the address of void * type of the privatue copy of the reduction item specified by the SharedLVal. More...
 
void emitTaskwaitCall (CodeGenFunction &CGF, SourceLocation Loc, const OMPTaskDataTy &Data) override
 Emit code for 'taskwait' directive. More...
 
void emitCancellationPointCall (CodeGenFunction &CGF, SourceLocation Loc, OpenMPDirectiveKind CancelRegion) override
 Emit code for 'cancellation point' construct. More...
 
void emitCancelCall (CodeGenFunction &CGF, SourceLocation Loc, const Expr *IfCond, OpenMPDirectiveKind CancelRegion) override
 Emit code for 'cancel' construct. More...
 
void emitTargetOutlinedFunction (const OMPExecutableDirective &D, StringRef ParentName, llvm::Function *&OutlinedFn, llvm::Constant *&OutlinedFnID, bool IsOffloadEntry, const RegionCodeGenTy &CodeGen) override
 Emit outilined function for 'target' directive. More...
 
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) override
 Emit the target offloading code associated with D. More...
 
bool emitTargetFunctions (GlobalDecl GD) override
 Emit the target regions enclosed in GD function definition or the function itself in case it is a valid device function. More...
 
bool emitTargetGlobalVariable (GlobalDecl GD) override
 Emit the global variable if it is a valid device global variable. More...
 
bool emitTargetGlobal (GlobalDecl GD) override
 Emit the global GD if it is meaningful for the target. More...
 
void emitTeamsCall (CodeGenFunction &CGF, const OMPExecutableDirective &D, SourceLocation Loc, llvm::Function *OutlinedFn, ArrayRef< llvm::Value * > CapturedVars) override
 Emits code for teams call of the OutlinedFn with variables captured in a record which address is stored in CapturedStruct. More...
 
void emitNumTeamsClause (CodeGenFunction &CGF, const Expr *NumTeams, const Expr *ThreadLimit, SourceLocation Loc) override
 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...
 
void emitTargetDataCalls (CodeGenFunction &CGF, const OMPExecutableDirective &D, const Expr *IfCond, const Expr *Device, const RegionCodeGenTy &CodeGen, TargetDataInfo &Info) override
 Emit the target data mapping code associated with D. More...
 
void emitTargetDataStandAloneCall (CodeGenFunction &CGF, const OMPExecutableDirective &D, const Expr *IfCond, const Expr *Device) override
 Emit the data mapping/movement code associated with the directive D that should be of the form 'target [{enter|exit} data | update]'. More...
 
void emitDoacrossInit (CodeGenFunction &CGF, const OMPLoopDirective &D, ArrayRef< Expr * > NumIterations) override
 Emit initialization for doacross loop nesting support. More...
 
void emitDoacrossOrdered (CodeGenFunction &CGF, const OMPDependClause *C) override
 Emit code for doacross ordered directive with 'depend' clause. More...
 
const VarDecltranslateParameter (const FieldDecl *FD, const VarDecl *NativeParam) const override
 Translates the native parameter of outlined function if this is required for target. More...
 
Address getParameterAddress (CodeGenFunction &CGF, const VarDecl *NativeParam, const VarDecl *TargetParam) const override
 Gets the address of the native argument basing on the address of the target-specific parameter. More...
 
Address getAddressOfLocalVariable (CodeGenFunction &CGF, const VarDecl *VD) override
 Gets the OpenMP-specific address of the local variable. More...
 
- Public Member Functions inherited from clang::CodeGen::CGOpenMPRuntime
llvm::OpenMPIRBuilder & getOMPBuilder ()
 
 CGOpenMPRuntime (CodeGenModule &CGM)
 
virtual ~CGOpenMPRuntime ()
 
virtual void clear ()
 
void emitIfClause (CodeGenFunction &CGF, const Expr *Cond, const RegionCodeGenTy &ThenGen, const RegionCodeGenTy &ElseGen)
 Emits code for OpenMP 'if' clause using specified CodeGen function. More...
 
std::string getName (ArrayRef< StringRef > Parts) const
 Get the platform-specific name separator. More...
 
virtual void emitUserDefinedReduction (CodeGenFunction *CGF, const OMPDeclareReductionDecl *D)
 Emit code for the specified user defined reduction construct. More...
 
virtual std::pair< llvm::Function *, llvm::Function * > getUserDefinedReduction (const OMPDeclareReductionDecl *D)
 Get combiner/initializer for the specified user-defined reduction, if any. More...
 
void emitUserDefinedMapper (const OMPDeclareMapperDecl *D, CodeGenFunction *CGF=nullptr)
 Emit the function for the user defined mapper construct. More...
 
llvm::Function * getOrCreateUserDefinedMapperFunc (const OMPDeclareMapperDecl *D)
 Get the function for the specified user-defined mapper. More...
 
virtual void functionFinished (CodeGenFunction &CGF)
 Cleans up references to the objects in finished function. 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 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 bool emitDeclareTargetVarDefinition (const VarDecl *VD, llvm::GlobalVariable *Addr, bool PerformInit)
 Emit a code for initialization of declare target variable. More...
 
virtual void emitInlinedDirective (CodeGenFunction &CGF, OpenMPDirectiveKind InnermostKind, const RegionCodeGenTy &CodeGen, bool HasCancel=false)
 Emit code for the directive that does not require outlining. More...
 
llvm::Function * emitReductionFunction (SourceLocation Loc, llvm::Type *ArgsType, ArrayRef< const Expr * > Privates, ArrayRef< const Expr * > LHSExprs, ArrayRef< const Expr * > RHSExprs, ArrayRef< const Expr * > ReductionOps)
 Emits reduction function. More...
 
void emitSingleReductionCombiner (CodeGenFunction &CGF, const Expr *ReductionOp, const Expr *PrivateRef, const DeclRefExpr *LHS, const DeclRefExpr *RHS)
 Emits single reduction combiner. More...
 
virtual void 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...
 
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 emitDeclareSimdFunction (const FunctionDecl *FD, llvm::Function *Fn)
 Marks function Fn with properly mangled versions of vector functions. More...
 
virtual void getDefaultDistScheduleAndChunk (CodeGenFunction &CGF, const OMPLoopDirective &S, OpenMPDistScheduleClauseKind &ScheduleKind, llvm::Value *&Chunk) const
 Choose default schedule type and chunk value for the dist_schedule clause. More...
 
virtual void getDefaultScheduleAndChunk (CodeGenFunction &CGF, const OMPLoopDirective &S, OpenMPScheduleClauseKind &ScheduleKind, const Expr *&ChunkExpr) const
 Choose default schedule type and chunk value for the schedule clause. More...
 
virtual void emitOutlinedFunctionCall (CodeGenFunction &CGF, SourceLocation Loc, llvm::FunctionCallee OutlinedFn, ArrayRef< llvm::Value * > Args=llvm::None) const
 Emits call of the outlined function with the provided arguments, translating these arguments to correct target-specific arguments. More...
 
virtual void emitFunctionProlog (CodeGenFunction &CGF, const Decl *D)
 Emits OpenMP-specific function prolog. More...
 
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...
 

Additional Inherited Members

- Static Public Member Functions inherited from clang::CodeGen::CGOpenMPRuntime
static const StmtgetSingleCompoundChild (ASTContext &Ctx, const Stmt *Body)
 Checks if the Body is the CompoundStmt and returns its child statement iff there is only one that is not evaluatable at the compile time. More...
 
- Protected Member Functions inherited from clang::CodeGen::CGOpenMPRuntime
 CGOpenMPRuntime (CodeGenModule &CGM, StringRef FirstSeparator, StringRef Separator)
 Constructor allowing to redefine the name separator for the variables. More...
 
virtual void createOffloadEntry (llvm::Constant *ID, llvm::Constant *Addr, uint64_t Size, int32_t Flags, llvm::GlobalValue::LinkageTypes Linkage)
 Creates offloading entry for the provided entry ID ID, address Addr, size Size, and flags Flags. More...
 
virtual void emitTargetOutlinedFunctionHelper (const OMPExecutableDirective &D, StringRef ParentName, llvm::Function *&OutlinedFn, llvm::Constant *&OutlinedFnID, bool IsOffloadEntry, const RegionCodeGenTy &CodeGen)
 Helper to emit outlined function for 'target' directive. More...
 
llvm::ValueemitUpdateLocation (CodeGenFunction &CGF, SourceLocation Loc, unsigned Flags=0)
 Emits object of ident_t type with info for source location. More...
 
const ExprgetNumTeamsExprForTargetDirective (CodeGenFunction &CGF, const OMPExecutableDirective &D, int32_t &DefaultVal)
 Emit the number of teams for a target directive. More...
 
llvm::ValueemitNumTeamsForTargetDirective (CodeGenFunction &CGF, const OMPExecutableDirective &D)
 
const ExprgetNumThreadsExprForTargetDirective (CodeGenFunction &CGF, const OMPExecutableDirective &D, int32_t &DefaultVal)
 Emit the number of threads for a target directive. More...
 
llvm::ValueemitNumThreadsForTargetDirective (CodeGenFunction &CGF, const OMPExecutableDirective &D)
 
llvm::Type * getIdentTyPointerTy ()
 Returns pointer to ident_t type. More...
 
llvm::ValuegetThreadID (CodeGenFunction &CGF, SourceLocation Loc)
 Gets thread id value for the current thread. More...
 
virtual StringRef getOutlinedHelperName () const
 Get the function name of an outlined region. More...
 
void emitCall (CodeGenFunction &CGF, SourceLocation Loc, llvm::FunctionCallee Callee, ArrayRef< llvm::Value * > Args=llvm::None) const
 Emits Callee function call with arguments Args with location Loc. More...
 
virtual Address emitThreadIDAddress (CodeGenFunction &CGF, SourceLocation Loc)
 Emits address of the word in a memory where current thread id is stored. More...
 
void setLocThreadIdInsertPt (CodeGenFunction &CGF, bool AtCurrentPoint=false)
 
void clearLocThreadIdInsertPt (CodeGenFunction &CGF)
 
virtual bool isDefaultLocationConstant () const
 Check if the default location must be constant. More...
 
virtual unsigned getDefaultLocationReserved2Flags () const
 Returns additional flags that can be stored in reserved_2 field of the default location. More...
 
llvm::ArrayType * getKmpCriticalNameTy () const
 Get the LLVM type for the critical name. More...
 
llvm::ValuegetCriticalRegionLock (StringRef CriticalName)
 Returns corresponding lock object for the specified critical region name. More...
 
- Static Protected Member Functions inherited from clang::CodeGen::CGOpenMPRuntime
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 inherited from clang::CodeGen::CGOpenMPRuntime
CodeGenModuleCGM
 
StringRef FirstSeparator
 
StringRef Separator
 
llvm::OpenMPIRBuilder OMPBuilder
 An OpenMP-IR-Builder instance. More...
 

Detailed Description

Class supports emissionof SIMD-only code.

Definition at line 1931 of file CGOpenMPRuntime.h.

Constructor & Destructor Documentation

◆ CGOpenMPSIMDRuntime()

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

Definition at line 1933 of file CGOpenMPRuntime.h.

◆ ~CGOpenMPSIMDRuntime()

clang::CodeGen::CGOpenMPSIMDRuntime::~CGOpenMPSIMDRuntime ( )
inlineoverride

Definition at line 1934 of file CGOpenMPRuntime.h.

Member Function Documentation

◆ emitBarrierCall()

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

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 from clang::CodeGen::CGOpenMPRuntime.

Definition at line 12940 of file CGOpenMPRuntime.cpp.

◆ emitCancelCall()

void CGOpenMPSIMDRuntime::emitCancelCall ( CodeGenFunction CGF,
SourceLocation  Loc,
const Expr IfCond,
OpenMPDirectiveKind  CancelRegion 
)
overridevirtual

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 from clang::CodeGen::CGOpenMPRuntime.

Definition at line 13088 of file CGOpenMPRuntime.cpp.

◆ emitCancellationPointCall()

void CGOpenMPSIMDRuntime::emitCancellationPointCall ( CodeGenFunction CGF,
SourceLocation  Loc,
OpenMPDirectiveKind  CancelRegion 
)
overridevirtual

Emit code for 'cancellation point' construct.

Parameters
CancelRegionRegion kind for which the cancellation point must be emitted.

Reimplemented from clang::CodeGen::CGOpenMPRuntime.

Definition at line 13082 of file CGOpenMPRuntime.cpp.

◆ emitCriticalRegion()

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

Emits a critical region.

Parameters
CriticalNameName of the critical region.
CriticalOpGenGenerator for the statement associated with the given critical region.
HintValue of the 'hint' clause (optional).

Reimplemented from clang::CodeGen::CGOpenMPRuntime.

Definition at line 12894 of file CGOpenMPRuntime.cpp.

◆ emitDistributeStaticInit()

void CGOpenMPSIMDRuntime::emitDistributeStaticInit ( CodeGenFunction CGF,
SourceLocation  Loc,
OpenMPDistScheduleClauseKind  SchedKind,
const StaticRTInput Values 
)
overridevirtual
Parameters
CGFReference to current CodeGenFunction.
LocClang source location.
SchedKindSchedule kind, specified by the 'dist_schedule' clause.
ValuesInput arguments for the construct.

Reimplemented from clang::CodeGen::CGOpenMPRuntime.

Definition at line 12961 of file CGOpenMPRuntime.cpp.

◆ emitDoacrossInit()

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

Emit initialization for doacross loop nesting support.

Parameters
DLoop-based construct used in doacross nesting construct.

Reimplemented from clang::CodeGen::CGOpenMPRuntime.

Definition at line 13150 of file CGOpenMPRuntime.cpp.

◆ emitDoacrossOrdered()

void CGOpenMPSIMDRuntime::emitDoacrossOrdered ( CodeGenFunction CGF,
const OMPDependClause C 
)
overridevirtual

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

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

Reimplemented from clang::CodeGen::CGOpenMPRuntime.

Definition at line 13156 of file CGOpenMPRuntime.cpp.

◆ emitFlush()

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

Emit flush of the variables specified in 'omp flush' directive.

Parameters
VarsList of variables to flush.

Reimplemented from clang::CodeGen::CGOpenMPRuntime.

Definition at line 13018 of file CGOpenMPRuntime.cpp.

◆ emitForDispatchInit()

void CGOpenMPSIMDRuntime::emitForDispatchInit ( CodeGenFunction CGF,
SourceLocation  Loc,
const OpenMPScheduleTy ScheduleKind,
unsigned  IVSize,
bool  IVSigned,
bool  Ordered,
const DispatchRTInput DispatchValues 
)
overridevirtual

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 from clang::CodeGen::CGOpenMPRuntime.

Definition at line 12948 of file CGOpenMPRuntime.cpp.

◆ emitForNext()

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

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 from clang::CodeGen::CGOpenMPRuntime.

Definition at line 12980 of file CGOpenMPRuntime.cpp.

◆ emitForOrderedIterationEnd()

void CGOpenMPSIMDRuntime::emitForOrderedIterationEnd ( CodeGenFunction CGF,
SourceLocation  Loc,
unsigned  IVSize,
bool  IVSigned 
)
overridevirtual

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 from clang::CodeGen::CGOpenMPRuntime.

Definition at line 12967 of file CGOpenMPRuntime.cpp.

◆ emitForStaticFinish()

void CGOpenMPSIMDRuntime::emitForStaticFinish ( CodeGenFunction CGF,
SourceLocation  Loc,
OpenMPDirectiveKind  DKind 
)
overridevirtual

Call the appropriate runtime routine to notify that we finished all the work with current loop.

Parameters
CGFReference to current CodeGenFunction.
LocClang source location.
DKindKind of the directive for which the static finish is emitted.

Reimplemented from clang::CodeGen::CGOpenMPRuntime.

Definition at line 12974 of file CGOpenMPRuntime.cpp.

◆ emitForStaticInit()

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

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 from clang::CodeGen::CGOpenMPRuntime.

Definition at line 12955 of file CGOpenMPRuntime.cpp.

◆ emitMaskedRegion()

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

Emits a masked region.

Parameters
MaskedOpGenGenerator for the statement associated with the given masked region.

Reimplemented from clang::CodeGen::CGOpenMPRuntime.

Definition at line 12907 of file CGOpenMPRuntime.cpp.

◆ emitMasterRegion()

void CGOpenMPSIMDRuntime::emitMasterRegion ( CodeGenFunction CGF,
const RegionCodeGenTy MasterOpGen,
SourceLocation  Loc 
)
overridevirtual

Emits a master region.

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

Reimplemented from clang::CodeGen::CGOpenMPRuntime.

Definition at line 12901 of file CGOpenMPRuntime.cpp.

◆ emitNumTeamsClause()

void CGOpenMPSIMDRuntime::emitNumTeamsClause ( CodeGenFunction CGF,
const Expr NumTeams,
const Expr ThreadLimit,
SourceLocation  Loc 
)
overridevirtual

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 from clang::CodeGen::CGOpenMPRuntime.

Definition at line 13131 of file CGOpenMPRuntime.cpp.

◆ emitNumThreadsClause()

void CGOpenMPSIMDRuntime::emitNumThreadsClause ( CodeGenFunction CGF,
llvm::Value NumThreads,
SourceLocation  Loc 
)
overridevirtual

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 from clang::CodeGen::CGOpenMPRuntime.

Definition at line 12988 of file CGOpenMPRuntime.cpp.

◆ emitOrderedRegion()

void CGOpenMPSIMDRuntime::emitOrderedRegion ( CodeGenFunction CGF,
const RegionCodeGenTy OrderedOpGen,
SourceLocation  Loc,
bool  IsThreads 
)
overridevirtual

Emit an ordered region.

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

Reimplemented from clang::CodeGen::CGOpenMPRuntime.

Definition at line 12933 of file CGOpenMPRuntime.cpp.

◆ emitParallelCall()

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

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

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

Reimplemented from clang::CodeGen::CGOpenMPRuntime.

Definition at line 12886 of file CGOpenMPRuntime.cpp.

◆ emitParallelOutlinedFunction()

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

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 from clang::CodeGen::CGOpenMPRuntime.

Definition at line 12866 of file CGOpenMPRuntime.cpp.

◆ emitProcBindClause()

void CGOpenMPSIMDRuntime::emitProcBindClause ( CodeGenFunction CGF,
llvm::omp::ProcBindKind  ProcBind,
SourceLocation  Loc 
)
overridevirtual

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

Reimplemented from clang::CodeGen::CGOpenMPRuntime.

Definition at line 12994 of file CGOpenMPRuntime.cpp.

◆ emitReduction()

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

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 from clang::CodeGen::CGOpenMPRuntime.

Definition at line 13041 of file CGOpenMPRuntime.cpp.

◆ emitSingleRegion()

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

Emits a single region.

Parameters
SingleOpGenGenerator for the statement associated with the given single region.

Reimplemented from clang::CodeGen::CGOpenMPRuntime.

Definition at line 12925 of file CGOpenMPRuntime.cpp.

◆ emitTargetCall()

void CGOpenMPSIMDRuntime::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 
)
overridevirtual

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.

Reimplemented from clang::CodeGen::CGOpenMPRuntime.

Definition at line 13101 of file CGOpenMPRuntime.cpp.

◆ emitTargetDataCalls()

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

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 from clang::CodeGen::CGOpenMPRuntime.

Definition at line 13138 of file CGOpenMPRuntime.cpp.

◆ emitTargetDataStandAloneCall()

void CGOpenMPSIMDRuntime::emitTargetDataStandAloneCall ( CodeGenFunction CGF,
const OMPExecutableDirective D,
const Expr IfCond,
const Expr Device 
)
overridevirtual

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 from clang::CodeGen::CGOpenMPRuntime.

Definition at line 13144 of file CGOpenMPRuntime.cpp.

◆ emitTargetFunctions()

bool CGOpenMPSIMDRuntime::emitTargetFunctions ( GlobalDecl  GD)
overridevirtual

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 from clang::CodeGen::CGOpenMPRuntime.

Definition at line 13111 of file CGOpenMPRuntime.cpp.

◆ emitTargetGlobal()

bool CGOpenMPSIMDRuntime::emitTargetGlobal ( GlobalDecl  GD)
overridevirtual

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

Returns if it was emitted successfully.

Parameters
GDGlobal to scan.

Reimplemented from clang::CodeGen::CGOpenMPRuntime.

Definition at line 13119 of file CGOpenMPRuntime.cpp.

◆ emitTargetGlobalVariable()

bool CGOpenMPSIMDRuntime::emitTargetGlobalVariable ( GlobalDecl  GD)
overridevirtual

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 from clang::CodeGen::CGOpenMPRuntime.

Definition at line 13115 of file CGOpenMPRuntime.cpp.

◆ emitTargetOutlinedFunction()

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

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 from clang::CodeGen::CGOpenMPRuntime.

Definition at line 13094 of file CGOpenMPRuntime.cpp.

◆ emitTaskCall()

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

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 from clang::CodeGen::CGOpenMPRuntime.

Definition at line 13025 of file CGOpenMPRuntime.cpp.

◆ emitTaskgroupRegion()

void CGOpenMPSIMDRuntime::emitTaskgroupRegion ( CodeGenFunction CGF,
const RegionCodeGenTy TaskgroupOpGen,
SourceLocation  Loc 
)
overridevirtual

Emit a taskgroup region.

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

Reimplemented from clang::CodeGen::CGOpenMPRuntime.

Definition at line 12919 of file CGOpenMPRuntime.cpp.

◆ emitTaskLoopCall()

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

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 from clang::CodeGen::CGOpenMPRuntime.

Definition at line 13034 of file CGOpenMPRuntime.cpp.

◆ emitTaskOutlinedFunction()

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

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 from clang::CodeGen::CGOpenMPRuntime.

Definition at line 12878 of file CGOpenMPRuntime.cpp.

◆ emitTaskReductionFini()

void CGOpenMPSIMDRuntime::emitTaskReductionFini ( CodeGenFunction CGF,
SourceLocation  Loc,
bool  IsWorksharingReduction 
)
overridevirtual

Emits the following code for reduction clause with task modifier:

__kmpc_task_reduction_modifier_fini(loc, gtid, is_worksharing);

Reimplemented from clang::CodeGen::CGOpenMPRuntime.

Definition at line 13056 of file CGOpenMPRuntime.cpp.

◆ emitTaskReductionFixups()

void CGOpenMPSIMDRuntime::emitTaskReductionFixups ( CodeGenFunction CGF,
SourceLocation  Loc,
ReductionCodeGen RCG,
unsigned  N 
)
overridevirtual

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 + emits threadprivate variable to store the pointer to the original reduction item for the custom initializer defined by declare reduction construct.

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

Reimplemented from clang::CodeGen::CGOpenMPRuntime.

Definition at line 13062 of file CGOpenMPRuntime.cpp.

◆ emitTaskReductionInit()

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

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 from clang::CodeGen::CGOpenMPRuntime.

Definition at line 13050 of file CGOpenMPRuntime.cpp.

◆ emitTaskwaitCall()

void CGOpenMPSIMDRuntime::emitTaskwaitCall ( CodeGenFunction CGF,
SourceLocation  Loc,
const OMPTaskDataTy Data 
)
overridevirtual

Emit code for 'taskwait' directive.

Reimplemented from clang::CodeGen::CGOpenMPRuntime.

Definition at line 13076 of file CGOpenMPRuntime.cpp.

◆ emitTaskyieldCall()

void CGOpenMPSIMDRuntime::emitTaskyieldCall ( CodeGenFunction CGF,
SourceLocation  Loc 
)
overridevirtual

Emits a masked region.

Parameters
MaskedOpGenGenerator for the statement associated with the given masked region. Emits code for a taskyield directive.

Reimplemented from clang::CodeGen::CGOpenMPRuntime.

Definition at line 12914 of file CGOpenMPRuntime.cpp.

◆ emitTeamsCall()

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

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 from clang::CodeGen::CGOpenMPRuntime.

Definition at line 13123 of file CGOpenMPRuntime.cpp.

◆ emitTeamsOutlinedFunction()

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

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 from clang::CodeGen::CGOpenMPRuntime.

Definition at line 12872 of file CGOpenMPRuntime.cpp.

◆ emitThreadPrivateVarDefinition()

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

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 from clang::CodeGen::CGOpenMPRuntime.

Definition at line 13007 of file CGOpenMPRuntime.cpp.

◆ getAddressOfLocalVariable()

Address clang::CodeGen::CGOpenMPSIMDRuntime::getAddressOfLocalVariable ( CodeGenFunction CGF,
const VarDecl VD 
)
inlineoverridevirtual

Gets the OpenMP-specific address of the local variable.

Reimplemented from clang::CodeGen::CGOpenMPRuntime.

Definition at line 2528 of file CGOpenMPRuntime.h.

References clang::CodeGen::Address::invalid().

◆ getAddrOfArtificialThreadPrivate()

Address CGOpenMPSIMDRuntime::getAddrOfArtificialThreadPrivate ( CodeGenFunction CGF,
QualType  VarType,
StringRef  Name 
)
overridevirtual

Creates artificial threadprivate variable with name Name and type VarType.

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

Reimplemented from clang::CodeGen::CGOpenMPRuntime.

Definition at line 13013 of file CGOpenMPRuntime.cpp.

◆ getAddrOfThreadPrivate()

Address CGOpenMPSIMDRuntime::getAddrOfThreadPrivate ( CodeGenFunction CGF,
const VarDecl VD,
Address  VDAddr,
SourceLocation  Loc 
)
overridevirtual

Returns address of the threadprivate variable for the current thread.

Parameters
VDThreadprivate variable.
VDAddrAddress of the global variable VD.
LocLocation of the reference to threadprivate var.
Returns
Address of the threadprivate variable for the current thread.

Reimplemented from clang::CodeGen::CGOpenMPRuntime.

Definition at line 13000 of file CGOpenMPRuntime.cpp.

◆ getParameterAddress()

Address CGOpenMPSIMDRuntime::getParameterAddress ( CodeGenFunction CGF,
const VarDecl NativeParam,
const VarDecl TargetParam 
) const
overridevirtual

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

Parameters
NativeParamParameter itself.
TargetParamCorresponding target-specific parameter.

Reimplemented from clang::CodeGen::CGOpenMPRuntime.

Definition at line 13168 of file CGOpenMPRuntime.cpp.

◆ getTaskReductionItem()

Address CGOpenMPSIMDRuntime::getTaskReductionItem ( CodeGenFunction CGF,
SourceLocation  Loc,
llvm::Value ReductionsPtr,
LValue  SharedLVal 
)
overridevirtual

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 from clang::CodeGen::CGOpenMPRuntime.

Definition at line 13069 of file CGOpenMPRuntime.cpp.

◆ translateParameter()

const VarDecl * CGOpenMPSIMDRuntime::translateParameter ( const FieldDecl FD,
const VarDecl NativeParam 
) const
overridevirtual

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 from clang::CodeGen::CGOpenMPRuntime.

Definition at line 13162 of file CGOpenMPRuntime.cpp.


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