clang  10.0.0svn
Classes | Enumerations | Functions | Variables
CGOpenMPRuntime.cpp File Reference
#include "CGCXXABI.h"
#include "CGCleanup.h"
#include "CGOpenMPRuntime.h"
#include "CGRecordLayout.h"
#include "CodeGenFunction.h"
#include "clang/CodeGen/ConstantInitBuilder.h"
#include "clang/AST/Decl.h"
#include "clang/AST/StmtOpenMP.h"
#include "clang/Basic/BitmaskEnum.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/Bitcode/BitcodeReader.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/Value.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/raw_ostream.h"
#include <cassert>
Include dependency graph for CGOpenMPRuntime.cpp:

Go to the source code of this file.

Classes

class  CleanupTy
 A basic class for pre|post-action for advanced codegen sequence for OpenMP region. More...
 

Enumerations

enum  OpenMPLocationFlags : unsigned
 Values for bit flags used in the ident_t to describe the fields. More...
 
enum  OpenMPOffloadingRequiresDirFlags : int64_t
 Values for bit flags for marking which requires clauses have been used. More...
 
enum  OpenMPOffloadingReservedDeviceIDs
 
enum  IdentFieldIndex {
  IdentField_Reserved_1, IdentField_Flags, IdentField_Reserved_2, IdentField_Reserved_3,
  IdentField_PSource
}
 
enum  OpenMPSchedType {
  OMP_sch_lower = 32, OMP_sch_static_chunked = 33, OMP_sch_static = 34, OMP_sch_dynamic_chunked = 35,
  OMP_sch_guided_chunked = 36, OMP_sch_runtime = 37, OMP_sch_auto = 38, OMP_sch_static_balanced_chunked = 45,
  OMP_ord_lower = 64, OMP_ord_static_chunked = 65, OMP_ord_static = 66, OMP_ord_dynamic_chunked = 67,
  OMP_ord_guided_chunked = 68, OMP_ord_runtime = 69, OMP_ord_auto = 70, OMP_sch_default = OMP_sch_static,
  OMP_dist_sch_static_chunked = 91, OMP_dist_sch_static = 92, OMP_sch_modifier_monotonic = (1 << 29), OMP_sch_modifier_nonmonotonic = (1 << 30)
}
 Schedule types for 'omp for' loops (these enumerators are taken from the enum sched_type in kmp.h). More...
 
enum  OpenMPRTLFunction {
  OMPRTL__kmpc_fork_call, OMPRTL__kmpc_threadprivate_cached, OMPRTL__kmpc_threadprivate_register, OMPRTL__kmpc_global_thread_num,
  OMPRTL__kmpc_critical, OMPRTL__kmpc_critical_with_hint, OMPRTL__kmpc_end_critical, OMPRTL__kmpc_cancel_barrier,
  OMPRTL__kmpc_barrier, OMPRTL__kmpc_for_static_fini, OMPRTL__kmpc_serialized_parallel, OMPRTL__kmpc_end_serialized_parallel,
  OMPRTL__kmpc_push_num_threads, OMPRTL__kmpc_flush, OMPRTL__kmpc_master, OMPRTL__kmpc_end_master,
  OMPRTL__kmpc_omp_taskyield, OMPRTL__kmpc_single, OMPRTL__kmpc_end_single, OMPRTL__kmpc_omp_task_alloc,
  OMPRTL__kmpc_omp_target_task_alloc, OMPRTL__kmpc_omp_task, OMPRTL__kmpc_copyprivate, OMPRTL__kmpc_reduce,
  OMPRTL__kmpc_reduce_nowait, OMPRTL__kmpc_end_reduce, OMPRTL__kmpc_end_reduce_nowait, OMPRTL__kmpc_omp_task_begin_if0,
  OMPRTL__kmpc_omp_task_complete_if0, OMPRTL__kmpc_ordered, OMPRTL__kmpc_end_ordered, OMPRTL__kmpc_omp_taskwait,
  OMPRTL__kmpc_taskgroup, OMPRTL__kmpc_end_taskgroup, OMPRTL__kmpc_push_proc_bind, OMPRTL__kmpc_omp_task_with_deps,
  OMPRTL__kmpc_omp_wait_deps, OMPRTL__kmpc_cancellationpoint, OMPRTL__kmpc_cancel, OMPRTL__kmpc_push_num_teams,
  OMPRTL__kmpc_fork_teams, OMPRTL__kmpc_taskloop, OMPRTL__kmpc_doacross_init, OMPRTL__kmpc_doacross_fini,
  OMPRTL__kmpc_doacross_post, OMPRTL__kmpc_doacross_wait, OMPRTL__kmpc_task_reduction_init, OMPRTL__kmpc_task_reduction_get_th_data,
  OMPRTL__kmpc_alloc, OMPRTL__kmpc_free, OMPRTL__kmpc_push_target_tripcount, OMPRTL__tgt_target,
  OMPRTL__tgt_target_nowait, OMPRTL__tgt_target_teams, OMPRTL__tgt_target_teams_nowait, OMPRTL__tgt_register_requires,
  OMPRTL__tgt_register_lib, OMPRTL__tgt_unregister_lib, OMPRTL__tgt_target_data_begin, OMPRTL__tgt_target_data_begin_nowait,
  OMPRTL__tgt_target_data_end, OMPRTL__tgt_target_data_end_nowait, OMPRTL__tgt_target_data_update, OMPRTL__tgt_target_data_update_nowait
}
 
enum  KmpTaskTFields
 Indexes of fields for type kmp_task_t. More...
 
enum  RTCancelKind
 
enum  ParamKindTy
 Kind of parameter in a function with 'declare simd' directive. More...
 

Functions

static const OMPDeclareReductionDeclgetReductionInit (const Expr *ReductionOp)
 Check if the combiner is a call to UDR combiner and if it is so return the UDR decl used for reduction. More...
 
static void emitInitWithReductionInitializer (CodeGenFunction &CGF, const OMPDeclareReductionDecl *DRD, const Expr *InitOp, Address Private, Address Original, QualType Ty)
 
static void EmitOMPAggregateInit (CodeGenFunction &CGF, Address DestAddr, QualType Type, bool EmitDeclareReductionInit, const Expr *Init, const OMPDeclareReductionDecl *DRD, Address SrcAddr=Address::invalid())
 Emit initialization of arrays of complex types. More...
 
static LValue loadToBegin (CodeGenFunction &CGF, QualType BaseTy, QualType ElTy, LValue BaseLV)
 
static Address castToBase (CodeGenFunction &CGF, QualType BaseTy, QualType ElTy, llvm::Type *BaseLVType, CharUnits BaseLVAlignment, llvm::Value *Addr)
 
static const VarDeclgetBaseDecl (const Expr *Ref, const DeclRefExpr *&DE)
 
static FieldDecladdFieldToRecordDecl (ASTContext &C, DeclContext *DC, QualType FieldTy)
 
static llvm::Function * emitCombinerOrInitializer (CodeGenModule &CGM, QualType Ty, const Expr *CombinerInitializer, const VarDecl *In, const VarDecl *Out, bool IsCombiner)
 
static llvm::Function * emitParallelOrTeamsOutlinedFunction (CodeGenModule &CGM, const OMPExecutableDirective &D, const CapturedStmt *CS, const VarDecl *ThreadIDVar, OpenMPDirectiveKind InnermostKind, const StringRef OutlinedHelperName, const RegionCodeGenTy &CodeGen)
 
static void buildStructValue (ConstantStructBuilder &Fields, CodeGenModule &CGM, const RecordDecl *RD, const CGRecordLayout &RL, ArrayRef< llvm::Constant *> Data)
 
template<class... As>
static llvm::GlobalVariable * createGlobalStruct (CodeGenModule &CGM, QualType Ty, bool IsConstant, ArrayRef< llvm::Constant *> Data, const Twine &Name, As &&... Args)
 
template<typename T >
static void createConstantGlobalStructAndAddToParent (CodeGenModule &CGM, QualType Ty, ArrayRef< llvm::Constant *> Data, T &Parent)
 
static void getTargetEntryUniqueInfo (ASTContext &C, SourceLocation Loc, unsigned &DeviceID, unsigned &FileID, unsigned &LineNum)
 Obtain information that uniquely identifies a target entry. More...
 
static Address emitAddrOfVarFromArray (CodeGenFunction &CGF, Address Array, unsigned Index, const VarDecl *Var)
 Given an array of pointers to variables, project the address of a given variable. More...
 
static llvm::ValueemitCopyprivateCopyFunction (CodeGenModule &CGM, llvm::Type *ArgsType, ArrayRef< const Expr *> CopyprivateVars, ArrayRef< const Expr *> DestExprs, ArrayRef< const Expr *> SrcExprs, ArrayRef< const Expr *> AssignmentOps, SourceLocation Loc)
 
static OpenMPSchedType getRuntimeSchedule (OpenMPScheduleClauseKind ScheduleKind, bool Chunked, bool Ordered)
 Map the OpenMP loop schedule to the runtime enumeration. More...
 
static OpenMPSchedType getRuntimeSchedule (OpenMPDistScheduleClauseKind ScheduleKind, bool Chunked)
 Map the OpenMP distribute schedule to the runtime enumeration. More...
 
static int addMonoNonMonoModifier (OpenMPSchedType Schedule, OpenMPScheduleClauseModifier M1, OpenMPScheduleClauseModifier M2)
 
static void emitForStaticInitCall (CodeGenFunction &CGF, llvm::Value *UpdateLocation, llvm::Value *ThreadId, llvm::FunctionCallee ForStaticInitFunction, OpenMPSchedType Schedule, OpenMPScheduleClauseModifier M1, OpenMPScheduleClauseModifier M2, const CGOpenMPRuntime::StaticRTInput &Values)
 
static RecordDeclcreatePrivatesRecordDecl (CodeGenModule &CGM, ArrayRef< PrivateDataTy > Privates)
 
static RecordDeclcreateKmpTaskTRecordDecl (CodeGenModule &CGM, OpenMPDirectiveKind Kind, QualType KmpInt32Ty, QualType KmpRoutineEntryPointerQTy)
 
static RecordDeclcreateKmpTaskTWithPrivatesRecordDecl (CodeGenModule &CGM, QualType KmpTaskTQTy, ArrayRef< PrivateDataTy > Privates)
 
static llvm::Function * emitProxyTaskFunction (CodeGenModule &CGM, SourceLocation Loc, OpenMPDirectiveKind Kind, QualType KmpInt32Ty, QualType KmpTaskTWithPrivatesPtrQTy, QualType KmpTaskTWithPrivatesQTy, QualType KmpTaskTQTy, QualType SharedsPtrTy, llvm::Function *TaskFunction, llvm::Value *TaskPrivatesMap)
 Emit a proxy function which accepts kmp_task_t as the second argument. More...
 
static llvm::ValueemitDestructorsFunction (CodeGenModule &CGM, SourceLocation Loc, QualType KmpInt32Ty, QualType KmpTaskTWithPrivatesPtrQTy, QualType KmpTaskTWithPrivatesQTy)
 
static llvm::ValueemitTaskPrivateMappingFunction (CodeGenModule &CGM, SourceLocation Loc, ArrayRef< const Expr *> PrivateVars, ArrayRef< const Expr *> FirstprivateVars, ArrayRef< const Expr *> LastprivateVars, QualType PrivatesQTy, ArrayRef< PrivateDataTy > Privates)
 Emit a privates mapping function for correct handling of private and firstprivate variables. More...
 
static void emitPrivatesInit (CodeGenFunction &CGF, const OMPExecutableDirective &D, Address KmpTaskSharedsPtr, LValue TDBase, const RecordDecl *KmpTaskTWithPrivatesQTyRD, QualType SharedsTy, QualType SharedsPtrTy, const OMPTaskDataTy &Data, ArrayRef< PrivateDataTy > Privates, bool ForDup)
 Emit initialization for private variables in task-based directives. More...
 
static bool checkInitIsRequired (CodeGenFunction &CGF, ArrayRef< PrivateDataTy > Privates)
 Check if duplication function is required for taskloops. More...
 
static llvm::ValueemitTaskDupFunction (CodeGenModule &CGM, SourceLocation Loc, const OMPExecutableDirective &D, QualType KmpTaskTWithPrivatesPtrQTy, const RecordDecl *KmpTaskTWithPrivatesQTyRD, const RecordDecl *KmpTaskTQTyRD, QualType SharedsTy, QualType SharedsPtrTy, const OMPTaskDataTy &Data, ArrayRef< PrivateDataTy > Privates, bool WithLastIter)
 Emit task_dup function (for initialization of private/firstprivate/lastprivate vars and last_iter flag) More...
 
static bool checkDestructorsRequired (const RecordDecl *KmpTaskTWithPrivatesQTyRD)
 Checks if destructor function is required to be generated. More...
 
static void EmitOMPAggregateReduction (CodeGenFunction &CGF, QualType Type, const VarDecl *LHSVar, const VarDecl *RHSVar, const llvm::function_ref< void(CodeGenFunction &CGF, const Expr *, const Expr *, const Expr *)> &RedOpGen, const Expr *XExpr=nullptr, const Expr *EExpr=nullptr, const Expr *UpExpr=nullptr)
 Emit reduction operation for each element of array (required for array sections) LHS op = RHS. More...
 
static void emitReductionCombiner (CodeGenFunction &CGF, const Expr *ReductionOp)
 Emit reduction combiner. More...
 
static std::string generateUniqueName (CodeGenModule &CGM, StringRef Prefix, const Expr *Ref)
 Generates unique name for artificial threadprivate variables. More...
 
static llvm::ValueemitReduceInitFunction (CodeGenModule &CGM, SourceLocation Loc, ReductionCodeGen &RCG, unsigned N)
 Emits reduction initializer function: More...
 
static llvm::ValueemitReduceCombFunction (CodeGenModule &CGM, SourceLocation Loc, ReductionCodeGen &RCG, unsigned N, const Expr *ReductionOp, const Expr *LHS, const Expr *RHS, const Expr *PrivateRef)
 Emits reduction combiner function: More...
 
static llvm::ValueemitReduceFiniFunction (CodeGenModule &CGM, SourceLocation Loc, ReductionCodeGen &RCG, unsigned N)
 Emits reduction finalizer function: More...
 
static RTCancelKind getCancellationKind (OpenMPDirectiveKind CancelRegion)
 
static bool isTrivial (ASTContext &Ctx, const Expr *E)
 Checks if the expression is constant or does not have non-trivial function calls. More...
 
static llvm::ValueemitNumTeamsForTargetDirective (CodeGenFunction &CGF, const OMPExecutableDirective &D)
 Emit the number of teams for a target directive. More...
 
static llvm::ValuegetNumThreads (CodeGenFunction &CGF, const CapturedStmt *CS, llvm::Value *DefaultThreadLimitVal)
 
static llvm::ValueemitNumThreadsForTargetDirective (CodeGenFunction &CGF, const OMPExecutableDirective &D)
 Emit the number of threads for a target directive. More...
 
static void emitOffloadingArrays (CodeGenFunction &CGF, MappableExprsHandler::MapBaseValuesArrayTy &BasePointers, MappableExprsHandler::MapValuesArrayTy &Pointers, MappableExprsHandler::MapValuesArrayTy &Sizes, MappableExprsHandler::MapFlagsArrayTy &MapTypes, CGOpenMPRuntime::TargetDataInfo &Info)
 Emit the arrays used to pass the captures and map information to the offloading runtime library. More...
 
static void emitOffloadingArraysArgument (CodeGenFunction &CGF, llvm::Value *&BasePointersArrayArg, llvm::Value *&PointersArrayArg, llvm::Value *&SizesArrayArg, llvm::Value *&MapTypesArrayArg, CGOpenMPRuntime::TargetDataInfo &Info)
 Emit the arguments to be passed to the runtime library based on the arrays of pointers, sizes and map types. More...
 
static const OMPExecutableDirectivegetNestedDistributeDirective (ASTContext &Ctx, const OMPExecutableDirective &D)
 Check for inner distribute directive. More...
 
static unsigned evaluateCDTSize (const FunctionDecl *FD, ArrayRef< ParamAttrTy > ParamAttrs)
 
static void emitX86DeclareSimdFunction (const FunctionDecl *FD, llvm::Function *Fn, const llvm::APSInt &VLENVal, ArrayRef< ParamAttrTy > ParamAttrs, OMPDeclareSimdDeclAttr::BranchStateTy State)
 
static bool getAArch64MTV (QualType QT, ParamKindTy Kind)
 Maps To Vector (MTV), as defined in 3.1.1 of the AAVFABI. More...
 
static bool getAArch64PBV (QualType QT, ASTContext &C)
 Pass By Value (PBV), as defined in 3.1.2 of the AAVFABI. More...
 
static unsigned getAArch64LS (QualType QT, ParamKindTy Kind, ASTContext &C)
 Computes the lane size (LS) of a return type or of an input parameter, as defined by LS(P) in 3.2.1 of the AAVFABI. More...
 
static std::tuple< unsigned, unsigned, boolgetNDSWDS (const FunctionDecl *FD, ArrayRef< ParamAttrTy > ParamAttrs)
 
static std::string mangleVectorParameters (ArrayRef< ParamAttrTy > ParamAttrs)
 Mangle the parameter part of the vector function name according to their OpenMP classification. More...
 
template<typename T >
static void addAArch64VectorName (T VLEN, StringRef LMask, StringRef Prefix, char ISA, StringRef ParSeq, StringRef MangledName, bool OutputBecomesInput, llvm::Function *Fn)
 
static void addAArch64AdvSIMDNDSNames (unsigned NDS, StringRef Mask, StringRef Prefix, char ISA, StringRef ParSeq, StringRef MangledName, bool OutputBecomesInput, llvm::Function *Fn)
 
static void emitAArch64DeclareSimdFunction (CodeGenModule &CGM, const FunctionDecl *FD, unsigned UserVLEN, ArrayRef< ParamAttrTy > ParamAttrs, OMPDeclareSimdDeclAttr::BranchStateTy State, StringRef MangledName, char ISA, unsigned VecRegSize, llvm::Function *Fn, SourceLocation SLoc)
 Emit vector function attributes for AArch64, as defined in the AAVFABI. More...
 

Variables

 ident_t
 

Enumeration Type Documentation

◆ IdentFieldIndex

Enumerator
IdentField_Reserved_1 

might be used in Fortran

IdentField_Flags 

OMP_IDENT_xxx flags; OMP_IDENT_KMPC identifies this union member.

IdentField_Reserved_2 

Not really used in Fortran any more.

IdentField_Reserved_3 

Source[4] in Fortran, do not use for C++.

IdentField_PSource 

String describing the source location.

The string is composed of semi-colon separated fields which describe the source file, the function and a pair of line numbers that delimit the construct.

Definition at line 512 of file CGOpenMPRuntime.cpp.

◆ KmpTaskTFields

Indexes of fields for type kmp_task_t.

Definition at line 3741 of file CGOpenMPRuntime.cpp.

◆ OpenMPLocationFlags

enum OpenMPLocationFlags : unsigned

Values for bit flags used in the ident_t to describe the fields.

All enumeric elements are named and described in accordance with the code from https://github.com/llvm/llvm-project/blob/master/openmp/runtime/src/kmp.h

Definition at line 434 of file CGOpenMPRuntime.cpp.

◆ OpenMPOffloadingRequiresDirFlags

Values for bit flags for marking which requires clauses have been used.

Definition at line 463 of file CGOpenMPRuntime.cpp.

◆ OpenMPOffloadingReservedDeviceIDs

Definition at line 479 of file CGOpenMPRuntime.cpp.

◆ OpenMPRTLFunction

Enumerator
OMPRTL__kmpc_fork_call 

Call to void __kmpc_fork_call(ident_t *loc, kmp_int32 argc, kmpc_micro microtask, ...);.

OMPRTL__kmpc_threadprivate_cached 

Call to void *__kmpc_threadprivate_cached(ident_t *loc, kmp_int32 global_tid, void *data, size_t size, void ***cache);.

OMPRTL__kmpc_threadprivate_register 

Call to void __kmpc_threadprivate_register( ident_t *, void *data, kmpc_ctor ctor, kmpc_cctor cctor, kmpc_dtor dtor);.

OMPRTL__kmpc_global_thread_num 
OMPRTL__kmpc_critical 
OMPRTL__kmpc_critical_with_hint 
OMPRTL__kmpc_end_critical 
OMPRTL__kmpc_cancel_barrier 
OMPRTL__kmpc_barrier 
OMPRTL__kmpc_for_static_fini 
OMPRTL__kmpc_serialized_parallel 
OMPRTL__kmpc_end_serialized_parallel 
OMPRTL__kmpc_push_num_threads 
OMPRTL__kmpc_flush 
OMPRTL__kmpc_master 
OMPRTL__kmpc_end_master 
OMPRTL__kmpc_omp_taskyield 
OMPRTL__kmpc_single 
OMPRTL__kmpc_end_single 
OMPRTL__kmpc_omp_task_alloc 
OMPRTL__kmpc_omp_target_task_alloc 
OMPRTL__kmpc_omp_task 
OMPRTL__kmpc_copyprivate 
OMPRTL__kmpc_reduce 
OMPRTL__kmpc_reduce_nowait 
OMPRTL__kmpc_end_reduce 
OMPRTL__kmpc_end_reduce_nowait 
OMPRTL__kmpc_omp_task_begin_if0 
OMPRTL__kmpc_omp_task_complete_if0 
OMPRTL__kmpc_ordered 
OMPRTL__kmpc_end_ordered 
OMPRTL__kmpc_omp_taskwait 
OMPRTL__kmpc_taskgroup 
OMPRTL__kmpc_end_taskgroup 
OMPRTL__kmpc_push_proc_bind 
OMPRTL__kmpc_omp_task_with_deps 
OMPRTL__kmpc_omp_wait_deps 
OMPRTL__kmpc_cancellationpoint 
OMPRTL__kmpc_cancel 
OMPRTL__kmpc_push_num_teams 
OMPRTL__kmpc_fork_teams 
OMPRTL__kmpc_taskloop 
OMPRTL__kmpc_doacross_init 
OMPRTL__kmpc_doacross_fini 
OMPRTL__kmpc_doacross_post 
OMPRTL__kmpc_doacross_wait 
OMPRTL__kmpc_task_reduction_init 
OMPRTL__kmpc_task_reduction_get_th_data 
OMPRTL__kmpc_alloc 
OMPRTL__kmpc_free 
OMPRTL__kmpc_push_target_tripcount 
OMPRTL__tgt_target 
OMPRTL__tgt_target_nowait 
OMPRTL__tgt_target_teams 
OMPRTL__tgt_target_teams_nowait 
OMPRTL__tgt_register_requires 
OMPRTL__tgt_register_lib 
OMPRTL__tgt_unregister_lib 
OMPRTL__tgt_target_data_begin 
OMPRTL__tgt_target_data_begin_nowait 
OMPRTL__tgt_target_data_end 
OMPRTL__tgt_target_data_end_nowait 
OMPRTL__tgt_target_data_update 
OMPRTL__tgt_target_data_update_nowait 

Definition at line 559 of file CGOpenMPRuntime.cpp.

◆ OpenMPSchedType

Schedule types for 'omp for' loops (these enumerators are taken from the enum sched_type in kmp.h).

Enumerator
OMP_sch_lower 

Lower bound for default (unordered) versions.

OMP_sch_static_chunked 
OMP_sch_static 
OMP_sch_dynamic_chunked 
OMP_sch_guided_chunked 
OMP_sch_runtime 
OMP_sch_auto 
OMP_sch_static_balanced_chunked 

static with chunk adjustment (e.g., simd)

OMP_ord_lower 

Lower bound for 'ordered' versions.

OMP_ord_static_chunked 
OMP_ord_static 
OMP_ord_dynamic_chunked 
OMP_ord_guided_chunked 
OMP_ord_runtime 
OMP_ord_auto 
OMP_sch_default 
OMP_dist_sch_static_chunked 

dist_schedule types

OMP_dist_sch_static 
OMP_sch_modifier_monotonic 

Support for OpenMP 4.5 monotonic and nonmonotonic schedule modifiers.

Set if the monotonic schedule modifier was present.

OMP_sch_modifier_nonmonotonic 

Set if the nonmonotonic schedule modifier was present.

Definition at line 529 of file CGOpenMPRuntime.cpp.

◆ ParamKindTy

Kind of parameter in a function with 'declare simd' directive.

Definition at line 9781 of file CGOpenMPRuntime.cpp.

◆ RTCancelKind

Definition at line 6382 of file CGOpenMPRuntime.cpp.

Function Documentation

◆ addAArch64AdvSIMDNDSNames()

static void addAArch64AdvSIMDNDSNames ( unsigned  NDS,
StringRef  Mask,
StringRef  Prefix,
char  ISA,
StringRef  ParSeq,
StringRef  MangledName,
bool  OutputBecomesInput,
llvm::Function *  Fn 
)
static

Definition at line 10074 of file CGOpenMPRuntime.cpp.

References addAArch64VectorName().

Referenced by emitAArch64DeclareSimdFunction().

◆ addAArch64VectorName()

template<typename T >
static void addAArch64VectorName ( VLEN,
StringRef  LMask,
StringRef  Prefix,
char  ISA,
StringRef  ParSeq,
StringRef  MangledName,
bool  OutputBecomesInput,
llvm::Function *  Fn 
)
static

◆ addFieldToRecordDecl()

static FieldDecl* addFieldToRecordDecl ( ASTContext C,
DeclContext DC,
QualType  FieldTy 
)
static

◆ addMonoNonMonoModifier()

static int addMonoNonMonoModifier ( OpenMPSchedType  Schedule,
OpenMPScheduleClauseModifier  M1,
OpenMPScheduleClauseModifier  M2 
)
static

◆ buildStructValue()

static void buildStructValue ( ConstantStructBuilder Fields,
CodeGenModule CGM,
const RecordDecl RD,
const CGRecordLayout RL,
ArrayRef< llvm::Constant *>  Data 
)
static

◆ castToBase()

static Address castToBase ( CodeGenFunction CGF,
QualType  BaseTy,
QualType  ElTy,
llvm::Type *  BaseLVType,
CharUnits  BaseLVAlignment,
llvm::Value Addr 
)
static

◆ checkDestructorsRequired()

static bool checkDestructorsRequired ( const RecordDecl KmpTaskTWithPrivatesQTyRD)
static

Checks if destructor function is required to be generated.

Returns
true if cleanups are required, false otherwise.

Definition at line 4971 of file CGOpenMPRuntime.cpp.

References clang::RecordDecl::field_begin().

Referenced by clang::CodeGen::emitTaskInit().

◆ checkInitIsRequired()

static bool checkInitIsRequired ( CodeGenFunction CGF,
ArrayRef< PrivateDataTy >  Privates 
)
static

Check if duplication function is required for taskloops.

Definition at line 4874 of file CGOpenMPRuntime.cpp.

References clang::VarDecl::getAnyInitializer(), and clang::CodeGen::CodeGenFunction::isTrivialInitializer().

Referenced by clang::CodeGen::emitTaskInit().

◆ createConstantGlobalStructAndAddToParent()

template<typename T >
static void createConstantGlobalStructAndAddToParent ( CodeGenModule CGM,
QualType  Ty,
ArrayRef< llvm::Constant *>  Data,
T &  Parent 
)
static

◆ createGlobalStruct()

template<class... As>
static llvm::GlobalVariable* createGlobalStruct ( CodeGenModule CGM,
QualType  Ty,
bool  IsConstant,
ArrayRef< llvm::Constant *>  Data,
const Twine &  Name,
As &&...  Args 
)
static

◆ createKmpTaskTRecordDecl()

static RecordDecl* createKmpTaskTRecordDecl ( CodeGenModule CGM,
OpenMPDirectiveKind  Kind,
QualType  KmpInt32Ty,
QualType  KmpRoutineEntryPointerQTy 
)
static

◆ createKmpTaskTWithPrivatesRecordDecl()

static RecordDecl* createKmpTaskTWithPrivatesRecordDecl ( CodeGenModule CGM,
QualType  KmpTaskTQTy,
ArrayRef< PrivateDataTy >  Privates 
)
static

◆ createPrivatesRecordDecl()

static RecordDecl* createPrivatesRecordDecl ( CodeGenModule CGM,
ArrayRef< PrivateDataTy >  Privates 
)
static

◆ emitAArch64DeclareSimdFunction()

static void emitAArch64DeclareSimdFunction ( CodeGenModule CGM,
const FunctionDecl FD,
unsigned  UserVLEN,
ArrayRef< ParamAttrTy >  ParamAttrs,
OMPDeclareSimdDeclAttr::BranchStateTy  State,
StringRef  MangledName,
char  ISA,
unsigned  VecRegSize,
llvm::Function *  Fn,
SourceLocation  SLoc 
)
static

◆ emitAddrOfVarFromArray()

static Address emitAddrOfVarFromArray ( CodeGenFunction CGF,
Address  Array,
unsigned  Index,
const VarDecl Var 
)
static

Given an array of pointers to variables, project the address of a given variable.

Definition at line 3174 of file CGOpenMPRuntime.cpp.

◆ emitCombinerOrInitializer()

static llvm::Function* emitCombinerOrInitializer ( CodeGenModule CGM,
QualType  Ty,
const Expr CombinerInitializer,
const VarDecl In,
const VarDecl Out,
bool  IsCombiner 
)
static

◆ emitCopyprivateCopyFunction()

static llvm::Value* emitCopyprivateCopyFunction ( CodeGenModule CGM,
llvm::Type *  ArgsType,
ArrayRef< const Expr *>  CopyprivateVars,
ArrayRef< const Expr *>  DestExprs,
ArrayRef< const Expr *>  SrcExprs,
ArrayRef< const Expr *>  AssignmentOps,
SourceLocation  Loc 
)
static

◆ emitDestructorsFunction()

static llvm::Value* emitDestructorsFunction ( CodeGenModule CGM,
SourceLocation  Loc,
QualType  KmpInt32Ty,
QualType  KmpTaskTWithPrivatesPtrQTy,
QualType  KmpTaskTWithPrivatesQTy 
)
static

◆ emitForStaticInitCall()

static void emitForStaticInitCall ( CodeGenFunction CGF,
llvm::Value UpdateLocation,
llvm::Value ThreadId,
llvm::FunctionCallee  ForStaticInitFunction,
OpenMPSchedType  Schedule,
OpenMPScheduleClauseModifier  M1,
OpenMPScheduleClauseModifier  M2,
const CGOpenMPRuntime::StaticRTInput &  Values 
)
static

Definition at line 3544 of file CGOpenMPRuntime.cpp.

References addMonoNonMonoModifier(), clang::ASTContext::BoolTy, clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CGOpenMPRuntime::CGM, clang::CodeGen::StaticRTInput::Chunk, clang::CodeGen::createDispatchFiniFunction(), clang::CodeGen::createDispatchNextFunction(), clang::CodeGen::createForStaticInitFunction(), clang::CodeGen::createRuntimeFunction(), clang::CodeGen::emitDistributeStaticInit(), clang::CodeGen::emitFlush(), clang::CodeGen::emitForNext(), clang::CodeGen::emitForOrderedIterationEnd(), clang::CodeGen::emitForStaticFinish(), clang::CodeGen::emitForStaticInit(), clang::CodeGen::emitNumThreadsClause(), clang::CodeGen::emitProcBindClause(), clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), clang::CodeGen::CodeGenFunction::EmitScalarConversion(), clang::CodeGen::CGOpenMPRuntime::emitUpdateLocation(), clang::CodeGen::CodeGenFunction::getContext(), clang::ASTContext::getIntTypeForBitwidth(), clang::CodeGen::Address::getPointer(), getRuntimeSchedule(), clang::CodeGen::CGOpenMPRuntime::getThreadID(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), clang::CodeGen::CodeGenTypeCache::Int32Ty, clang::CodeGen::CodeGenTypeCache::IntTy, clang::isOpenMPDistributeDirective(), clang::isOpenMPLoopDirective(), clang::isOpenMPWorksharingDirective(), clang::CodeGen::StaticRTInput::IVSigned, clang::CodeGen::StaticRTInput::IVSize, clang::OpenMPScheduleTy::M1, clang::OpenMPScheduleTy::M2, OMP_dist_sch_static, OMP_dist_sch_static_chunked, OMP_ord_static, OMP_ord_static_chunked, OMP_sch_static, OMP_sch_static_balanced_chunked, OMP_sch_static_chunked, clang::OMPC_PROC_BIND_unknown, clang::OMPC_SCHEDULE_MODIFIER_unknown, OMPRTL__kmpc_flush, OMPRTL__kmpc_for_static_fini, OMPRTL__kmpc_push_num_threads, OMPRTL__kmpc_push_proc_bind, clang::CodeGen::StaticRTInput::Ordered, and clang::OpenMPScheduleTy::Schedule.

◆ emitInitWithReductionInitializer()

static void emitInitWithReductionInitializer ( CodeGenFunction CGF,
const OMPDeclareReductionDecl DRD,
const Expr InitOp,
Address  Private,
Address  Original,
QualType  Ty 
)
static

◆ emitNumTeamsForTargetDirective()

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

◆ emitNumThreadsForTargetDirective()

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

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

References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::EmitAutoVarAlloca(), clang::CodeGen::CodeGenFunction::EmitAutoVarCleanups(), clang::CodeGen::CodeGenFunction::EmitScalarExpr(), clang::CodeGen::CodeGenFunction::EmitVarDecl(), clang::Expr::EvaluateAsBooleanCondition(), clang::CodeGen::CodeGenFunction::EvaluateExprAsBool(), clang::CapturedStmt::getCapturedStmt(), clang::OMPExecutableDirective::getClausesOfKind(), clang::OMPIfClause::getCondition(), clang::CodeGen::CodeGenFunction::getContext(), clang::OMPExecutableDirective::getDirectiveKind(), clang::OMPExecutableDirective::getInnermostCapturedStmt(), clang::CodeGen::CodeGenFunction::getLangOpts(), getNumThreads(), clang::OMPExecutableDirective::getSingleClause(), clang::CodeGen::getSingleCompoundChild(), clang::OMPExecutableDirective::hasClausesOfKind(), clang::CodeGen::CodeGenTypeCache::Int32Ty, clang::CodeGen::Address::invalid(), clang::isOpenMPDistributeDirective(), clang::isOpenMPSimdDirective(), clang::isOpenMPTargetExecutionDirective(), clang::isOpenMPTeamsDirective(), clang::LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE(), clang::OMPD_unknown, and operator*().

Referenced by clang::CodeGen::emitTargetNumIterationsCall().

◆ emitOffloadingArrays()

static void emitOffloadingArrays ( CodeGenFunction CGF,
MappableExprsHandler::MapBaseValuesArrayTy BasePointers,
MappableExprsHandler::MapValuesArrayTy Pointers,
MappableExprsHandler::MapValuesArrayTy Sizes,
MappableExprsHandler::MapFlagsArrayTy MapTypes,
CGOpenMPRuntime::TargetDataInfo &  Info 
)
static

◆ emitOffloadingArraysArgument()

static void emitOffloadingArraysArgument ( CodeGenFunction CGF,
llvm::Value *&  BasePointersArrayArg,
llvm::Value *&  PointersArrayArg,
llvm::Value *&  SizesArrayArg,
llvm::Value *&  MapTypesArrayArg,
CGOpenMPRuntime::TargetDataInfo &  Info 
)
static

◆ EmitOMPAggregateInit()

static void EmitOMPAggregateInit ( CodeGenFunction CGF,
Address  DestAddr,
QualType  Type,
bool  EmitDeclareReductionInit,
const Expr Init,
const OMPDeclareReductionDecl DRD,
Address  SrcAddr = Address::invalid() 
)
static

◆ EmitOMPAggregateReduction()

static void EmitOMPAggregateReduction ( CodeGenFunction CGF,
QualType  Type,
const VarDecl LHSVar,
const VarDecl RHSVar,
const llvm::function_ref< void(CodeGenFunction &CGF, const Expr *, const Expr *, const Expr *)> &  RedOpGen,
const Expr XExpr = nullptr,
const Expr EExpr = nullptr,
const Expr UpExpr = nullptr 
)
static

Emit reduction operation for each element of array (required for array sections) LHS op = RHS.

Parameters
TypeType of array.
LHSVarVariable on the left side of the reduction operation (references element of array in original variable).
RHSVarVariable on the right side of the reduction operation (references element of array in original variable).
RedOpGenGenerator of reduction operation with use of LHSVar and RHSVar.

Definition at line 5488 of file CGOpenMPRuntime.cpp.

References clang::CharUnits::alignmentOfArrayElement(), clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::createBasicBlock(), clang::CodeGen::CodeGenFunction::emitArrayLength(), clang::CodeGen::CodeGenFunction::EmitBlock(), clang::CodeGen::CodeGenFunction::GetAddrOfLocalVar(), clang::CodeGen::Address::getAlignment(), clang::Type::getAsArrayTypeUnsafe(), clang::CodeGen::CodeGenFunction::getContext(), clang::CodeGen::Address::getPointer(), and clang::ASTContext::getTypeSizeInChars().

Referenced by clang::CodeGen::emitSingleReductionCombiner().

◆ emitParallelOrTeamsOutlinedFunction()

static llvm::Function* emitParallelOrTeamsOutlinedFunction ( CodeGenModule CGM,
const OMPExecutableDirective D,
const CapturedStmt CS,
const VarDecl ThreadIDVar,
OpenMPDirectiveKind  InnermostKind,
const StringRef  OutlinedHelperName,
const RegionCodeGenTy CodeGen 
)
static

◆ emitPrivatesInit()

static void emitPrivatesInit ( CodeGenFunction CGF,
const OMPExecutableDirective D,
Address  KmpTaskSharedsPtr,
LValue  TDBase,
const RecordDecl KmpTaskTWithPrivatesQTyRD,
QualType  SharedsTy,
QualType  SharedsPtrTy,
const OMPTaskDataTy Data,
ArrayRef< PrivateDataTy >  Privates,
bool  ForDup 
)
static

Emit initialization for private variables in task-based directives.

Definition at line 4769 of file CGOpenMPRuntime.cpp.

References clang::CodeGen::CodeGenFunction::OMPPrivateScope::addPrivate(), clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::ConvertTypeForMem(), clang::CodeGen::CGBuilderTy::CreatePointerBitCastOrAddrSpaceCast(), clang::CodeGen::Decl, clang::CodeGen::CodeGenFunction::EmitAggregateAssign(), clang::CodeGen::CodeGenFunction::EmitExprAsInit(), clang::CodeGen::CodeGenFunction::EmitLValueForField(), clang::CodeGen::CodeGenFunction::EmitOMPAggregateAssign(), clang::RecordDecl::field_begin(), clang::CodeGen::OMPTaskDataTy::FirstprivateVars, clang::CodeGen::LValue::getAddress(), clang::CodeGen::CodeGenFunction::GetAddrOfLocalVar(), clang::VarDecl::getAnyInitializer(), clang::OMPExecutableDirective::getCapturedStmt(), clang::CodeGen::CodeGenFunction::getContext(), clang::ASTContext::getDeclAlign(), clang::Decl::getDeclContext(), clang::OMPExecutableDirective::getDirectiveKind(), clang::CodeGen::LValue::getPointer(), clang::CodeGen::LValue::getTBAAInfo(), clang::CodeGen::LValue::getType(), clang::Type::isArrayType(), clang::isOpenMPTargetDataManagementDirective(), clang::isOpenMPTargetExecutionDirective(), clang::isOpenMPTaskLoopDirective(), clang::CodeGen::CodeGenFunction::isTrivialInitializer(), clang::CodeGen::Address::isValid(), clang::CodeGen::CodeGenFunction::CGCapturedStmtInfo::lookup(), clang::CodeGen::CodeGenFunction::MakeAddrLValue(), clang::CodeGen::CodeGenFunction::OMPPrivateScope::Privatize(), and clang::CodeGen::Type.

Referenced by emitTaskDupFunction(), and clang::CodeGen::emitTaskInit().

◆ emitProxyTaskFunction()

static llvm::Function* emitProxyTaskFunction ( CodeGenModule CGM,
SourceLocation  Loc,
OpenMPDirectiveKind  Kind,
QualType  KmpInt32Ty,
QualType  KmpTaskTWithPrivatesPtrQTy,
QualType  KmpTaskTWithPrivatesQTy,
QualType  KmpTaskTQTy,
QualType  SharedsPtrTy,
llvm::Function *  TaskFunction,
llvm::Value TaskPrivatesMap 
)
static

Emit a proxy function which accepts kmp_task_t as the second argument.

kmp_int32 .omp_task_entry.(kmp_int32 gtid, kmp_task_t *tt) {
TaskFunction(gtid, tt->part_id, &tt->privates, task_privates_map, tt,
For taskloops:
tt->task_data.lb, tt->task_data.ub, tt->task_data.st, tt->task_data.liter,
tt->reductions, tt->shareds);
return 0;
}

Definition at line 4517 of file CGOpenMPRuntime.cpp.

References clang::CodeGen::CodeGenTypes::arrangeBuiltinFunctionDeclaration(), clang::CodeGen::CodeGenFunction::Builder, clang::Type::castAs(), clang::CodeGen::CodeGenFunction::ConvertTypeForMem(), clang::Create(), clang::CodeGen::CGBuilderTy::CreatePointerBitCastOrAddrSpaceCast(), clang::CodeGen::CodeGenFunction::EmitLoadOfPointerLValue(), clang::CodeGen::CodeGenFunction::EmitLoadOfScalar(), clang::CodeGen::CodeGenFunction::EmitLValueForField(), clang::CodeGen::CodeGenFunction::EmitStoreThroughLValue(), clang::CodeGen::CodeGenFunction::FinishFunction(), clang::CodeGen::RValue::get(), clang::CodeGen::LValue::getAddress(), clang::CodeGen::CodeGenFunction::GetAddrOfLocalVar(), clang::Type::getAsTagDecl(), clang::CodeGen::CodeGenModule::getContext(), clang::CodeGen::CodeGenTypes::GetFunctionType(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::CodeGenModule::getOpenMPRuntime(), clang::CodeGen::LValue::getPointer(), clang::CodeGen::CodeGenModule::getTypes(), clang::InternalLinkage, clang::isOpenMPTaskLoopDirective(), clang::CodeGen::CodeGenFunction::MakeAddrLValue(), clang::ImplicitParamDecl::Other, clang::CodeGen::CodeGenFunction::ReturnValue, clang::CodeGen::CodeGenModule::SetInternalFunctionAttributes(), clang::CodeGen::CodeGenFunction::StartFunction(), clang::CodeGen::CodeGenTypeCache::VoidPtrTy, and clang::QualType::withRestrict().

Referenced by clang::CodeGen::emitTaskInit().

◆ emitReduceCombFunction()

static llvm::Value* emitReduceCombFunction ( CodeGenModule CGM,
SourceLocation  Loc,
ReductionCodeGen RCG,
unsigned  N,
const Expr ReductionOp,
const Expr LHS,
const Expr RHS,
const Expr PrivateRef 
)
static

Emits reduction combiner function:

void @.red_comb(void* %arg0, void* %arg1) {
%lhs = bitcast void* %arg0 to <type>*
%rhs = bitcast void* %arg1 to <type>*
%2 = <ReductionOp>(<type>* %lhs, <type>* %rhs)
store <type> %2, <type>* %lhs
ret void
}

Definition at line 6091 of file CGOpenMPRuntime.cpp.

References clang::CodeGen::CodeGenFunction::OMPPrivateScope::addPrivate(), clang::CodeGen::CodeGenTypes::arrangeBuiltinFunctionDeclaration(), clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::ConvertTypeForMem(), clang::Create(), clang::CodeGen::CGBuilderTy::CreateElementBitCast(), clang::CodeGen::ReductionCodeGen::emitAggregateType(), clang::CodeGen::CodeGenFunction::EmitLoadOfPointer(), clang::CodeGen::CodeGenFunction::EmitLoadOfScalar(), clang::CodeGen::CodeGenFunction::FinishFunction(), generateUniqueName(), clang::CodeGen::CodeGenFunction::GetAddrOfLocalVar(), clang::CodeGen::CodeGenModule::getContext(), clang::CodeGen::CodeGenTypes::GetFunctionType(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::CodeGenModule::getOpenMPRuntime(), clang::ASTContext::getPointerType(), clang::CodeGen::ReductionCodeGen::getRefExpr(), clang::CodeGen::ReductionCodeGen::getSizes(), clang::ASTContext::getSizeType(), clang::CodeGen::CodeGenModule::getTypes(), clang::InternalLinkage, clang::ImplicitParamDecl::Other, clang::CodeGen::CodeGenFunction::OMPPrivateScope::Privatize(), clang::CodeGen::CodeGenModule::SetInternalFunctionAttributes(), clang::CodeGen::CodeGenFunction::StartFunction(), clang::ASTContext::VoidPtrTy, and clang::ASTContext::VoidTy.

Referenced by emitReduceFiniFunction().

◆ emitReduceFiniFunction()

static llvm::Value* emitReduceFiniFunction ( CodeGenModule CGM,
SourceLocation  Loc,
ReductionCodeGen RCG,
unsigned  N 
)
static

Emits reduction finalizer function:

void @.red_fini(void* %arg) {
%0 = bitcast void* %arg to <type>*
<destroy>(<type>* %0)
ret void
}

Definition at line 6167 of file CGOpenMPRuntime.cpp.

References addFieldToRecordDecl(), clang::CodeGen::CodeGenTypes::arrangeBuiltinFunctionDeclaration(), clang::CodeGen::CodeGenFunction::Builder, clang::ASTContext::buildImplicitRecord(), clang::CodeGen::CodeGenFunction::CapturedStmtInfo, clang::CodeGen::CGOpenMPRuntime::CGM, clang::RecordDecl::completeDefinition(), clang::Create(), clang::CodeGen::CodeGenFunction::CreateMemTemp(), clang::CodeGen::CGBuilderTy::CreatePointerBitCastOrAddrSpaceCast(), clang::CodeGen::createRuntimeFunction(), clang::CodeGen::CGBuilderTy::CreateStore(), clang::CodeGen::ReductionCodeGen::emitAggregateType(), clang::CodeGen::CodeGenFunction::EmitCastToVoidPtr(), clang::CodeGen::CodeGenFunction::EmitCheckedInBoundsGEP(), clang::CodeGen::ReductionCodeGen::emitCleanups(), clang::CodeGen::CodeGenFunction::EmitLoadOfPointer(), clang::CodeGen::CodeGenFunction::EmitLoadOfScalar(), clang::CodeGen::CodeGenFunction::EmitLValueForField(), clang::CodeGen::CodeGenFunction::EmitNullInitialization(), emitReduceCombFunction(), emitReduceInitFunction(), clang::CodeGen::CodeGenFunction::EmitRuntimeCall(), clang::CodeGen::CodeGenFunction::EmitStoreOfScalar(), clang::CodeGen::emitTaskReductionFixups(), clang::CodeGen::emitTaskReductionInit(), clang::CodeGen::emitTaskwaitCall(), clang::CodeGen::CGOpenMPRuntime::emitUpdateLocation(), clang::CodeGen::CodeGenFunction::FinishFunction(), generateUniqueName(), clang::CodeGen::LValue::getAddress(), clang::CodeGen::getAddrOfArtificialThreadPrivate(), clang::CodeGen::CodeGenFunction::GetAddrOfLocalVar(), clang::CodeGen::LValue::getAlignment(), clang::ASTContext::getConstantArrayType(), clang::CodeGen::CodeGenModule::getContext(), clang::CodeGen::CodeGenTypes::GetFunctionType(), clang::ASTContext::getIntTypeForBitwidth(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::CodeGenModule::getOpenMPRuntime(), clang::CodeGen::Address::getPointer(), clang::CodeGen::LValue::getPointer(), clang::ASTContext::getPointerType(), clang::ASTContext::getRecordType(), clang::CodeGen::ReductionCodeGen::getRefExpr(), clang::CodeGen::ReductionCodeGen::getSharedLValue(), clang::CodeGen::ReductionCodeGen::getSizes(), clang::ASTContext::getSizeType(), clang::CodeGen::getTaskReductionItem(), clang::CodeGen::CGOpenMPRuntime::getThreadID(), clang::CodeGen::LValue::getType(), clang::CodeGen::CodeGenModule::getTypes(), clang::CodeGen::CodeGenFunction::HaveInsertPoint(), clang::CodeGen::CodeGenTypeCache::Int32Ty, clang::InternalLinkage, clang::CodeGen::CodeGenTypeCache::IntTy, clang::CodeGen::CodeGenFunction::MakeNaturalAlignAddrLValue(), clang::CodeGen::ReductionCodeGen::needCleanups(), clang::ArrayType::Normal, OMPRTL__kmpc_omp_taskwait, OMPRTL__kmpc_task_reduction_get_th_data, OMPRTL__kmpc_task_reduction_init, clang::ImplicitParamDecl::Other, clang::CodeGen::OMPTaskDataTy::ReductionCopies, clang::CodeGen::OMPTaskDataTy::ReductionOps, clang::CodeGen::OMPTaskDataTy::ReductionVars, clang::CodeGen::CodeGenModule::SetInternalFunctionAttributes(), clang::CodeGen::CodeGenTypeCache::SizeTy, clang::TagDecl::startDefinition(), clang::CodeGen::CodeGenFunction::StartFunction(), clang::CodeGen::ReductionCodeGen::usesReductionInitializer(), clang::CodeGen::CodeGenTypeCache::VoidPtrTy, clang::ASTContext::VoidPtrTy, and clang::ASTContext::VoidTy.

◆ emitReduceInitFunction()

static llvm::Value* emitReduceInitFunction ( CodeGenModule CGM,
SourceLocation  Loc,
ReductionCodeGen RCG,
unsigned  N 
)
static

Emits reduction initializer function:

void @.red_init(void* %arg) {
%0 = bitcast void* %arg to <type>*
store <type> <init>, <type>* %0
ret void
}

Definition at line 6022 of file CGOpenMPRuntime.cpp.

References clang::CodeGen::CodeGenTypes::arrangeBuiltinFunctionDeclaration(), clang::CanQual< T >::castAs(), clang::Create(), clang::CodeGen::ReductionCodeGen::emitAggregateType(), clang::CodeGen::ReductionCodeGen::emitInitialization(), clang::CodeGen::CodeGenFunction::EmitLoadOfPointer(), clang::CodeGen::CodeGenFunction::EmitLoadOfScalar(), clang::CodeGen::CodeGenFunction::FinishFunction(), generateUniqueName(), clang::CodeGen::CodeGenFunction::GetAddrOfLocalVar(), clang::CodeGen::CodeGenModule::getContext(), clang::CodeGen::CodeGenTypes::GetFunctionType(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::CodeGenModule::getOpenMPRuntime(), clang::ASTContext::getPointerType(), clang::CodeGen::ReductionCodeGen::getRefExpr(), clang::CodeGen::ReductionCodeGen::getSizes(), clang::ASTContext::getSizeType(), clang::CodeGen::CodeGenModule::getTypes(), clang::InternalLinkage, clang::CodeGen::CodeGenFunction::MakeAddrLValue(), clang::CodeGen::CodeGenFunction::MakeNaturalAlignAddrLValue(), clang::ImplicitParamDecl::Other, clang::CodeGen::CodeGenModule::SetInternalFunctionAttributes(), clang::CodeGen::CodeGenFunction::StartFunction(), clang::CodeGen::ReductionCodeGen::usesReductionInitializer(), clang::CodeGen::CodeGenTypeCache::VoidPtrTy, clang::ASTContext::VoidPtrTy, and clang::ASTContext::VoidTy.

Referenced by emitReduceFiniFunction().

◆ emitReductionCombiner()

static void emitReductionCombiner ( CodeGenFunction CGF,
const Expr ReductionOp 
)
static

◆ emitTaskDupFunction()

static llvm::Value* emitTaskDupFunction ( CodeGenModule CGM,
SourceLocation  Loc,
const OMPExecutableDirective D,
QualType  KmpTaskTWithPrivatesPtrQTy,
const RecordDecl KmpTaskTWithPrivatesQTyRD,
const RecordDecl KmpTaskTQTyRD,
QualType  SharedsTy,
QualType  SharedsPtrTy,
const OMPTaskDataTy Data,
ArrayRef< PrivateDataTy >  Privates,
bool  WithLastIter 
)
static

◆ emitTaskPrivateMappingFunction()

static llvm::Value* emitTaskPrivateMappingFunction ( CodeGenModule CGM,
SourceLocation  Loc,
ArrayRef< const Expr *>  PrivateVars,
ArrayRef< const Expr *>  FirstprivateVars,
ArrayRef< const Expr *>  LastprivateVars,
QualType  PrivatesQTy,
ArrayRef< PrivateDataTy >  Privates 
)
static

Emit a privates mapping function for correct handling of private and firstprivate variables.

void .omp_task_privates_map.(const .privates. *noalias privs, <ty1>
**noalias priv1,..., <tyn> **noalias privn) {
*priv1 = &.privates.priv1;
...;
*privn = &.privates.privn;
}

Definition at line 4680 of file CGOpenMPRuntime.cpp.

References clang::CodeGen::CodeGenTypes::arrangeBuiltinFunctionDeclaration(), clang::Type::castAs(), clang::ImplicitParamDecl::Create(), clang::Create(), clang::CodeGen::CodeGenFunction::EmitLoadOfPointerLValue(), clang::CodeGen::CodeGenFunction::EmitLValueForField(), clang::CodeGen::CodeGenFunction::EmitStoreOfScalar(), clang::CodeGen::CodeGenFunction::FinishFunction(), clang::CodeGen::LValue::getAddress(), clang::CodeGen::CodeGenFunction::GetAddrOfLocalVar(), clang::Type::getAsTagDecl(), clang::CodeGen::CodeGenModule::getContext(), clang::CodeGen::CodeGenTypes::GetFunctionType(), clang::CodeGen::CodeGenModule::getLangOpts(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::CodeGenModule::getOpenMPRuntime(), clang::CodeGen::LValue::getPointer(), clang::ASTContext::getPointerType(), clang::CodeGen::Address::getType(), clang::Expr::getType(), clang::CodeGen::LValue::getType(), clang::ValueDecl::getType(), clang::CodeGen::CodeGenModule::getTypes(), clang::InternalLinkage, clang::CodeGen::CodeGenFunction::MakeAddrLValue(), clang::ImplicitParamDecl::Other, clang::CodeGen::CodeGenModule::SetInternalFunctionAttributes(), clang::CodeGen::CodeGenFunction::StartFunction(), clang::ASTContext::VoidTy, clang::QualType::withConst(), and clang::QualType::withRestrict().

Referenced by clang::CodeGen::emitTaskInit().

◆ emitX86DeclareSimdFunction()

static void emitX86DeclareSimdFunction ( const FunctionDecl FD,
llvm::Function *  Fn,
const llvm::APSInt &  VLENVal,
ArrayRef< ParamAttrTy >  ParamAttrs,
OMPDeclareSimdDeclAttr::BranchStateTy  State 
)
static

Definition at line 9843 of file CGOpenMPRuntime.cpp.

References evaluateCDTSize().

Referenced by clang::CodeGen::emitDeclareSimdFunction().

◆ evaluateCDTSize()

static unsigned evaluateCDTSize ( const FunctionDecl FD,
ArrayRef< ParamAttrTy >  ParamAttrs 
)
static

◆ generateUniqueName()

static std::string generateUniqueName ( CodeGenModule CGM,
StringRef  Prefix,
const Expr Ref 
)
static

Generates unique name for artificial threadprivate variables.

Format is: <Prefix> "." <Decl_mangled_name> "_" "<Decl_start_loc_raw_enc>"

Definition at line 5998 of file CGOpenMPRuntime.cpp.

References getBaseDecl(), clang::VarDecl::getCanonicalDecl(), clang::CodeGen::CodeGenModule::getMangledName(), and clang::CodeGen::CodeGenModule::getOpenMPRuntime().

Referenced by emitReduceCombFunction(), emitReduceFiniFunction(), and emitReduceInitFunction().

◆ getAArch64LS()

static unsigned getAArch64LS ( QualType  QT,
ParamKindTy  Kind,
ASTContext C 
)
static

Computes the lane size (LS) of a return type or of an input parameter, as defined by LS(P) in 3.2.1 of the AAVFABI.

TODO: Add support for references, section 3.2.1, item 1.

Definition at line 9973 of file CGOpenMPRuntime.cpp.

References getAArch64MTV(), getAArch64PBV(), clang::QualType::getCanonicalType(), clang::Type::getPointeeType(), clang::ASTContext::getTypeSize(), clang::ASTContext::getUIntPtrType(), and clang::Type::isPointerType().

Referenced by getNDSWDS().

◆ getAArch64MTV()

static bool getAArch64MTV ( QualType  QT,
ParamKindTy  Kind 
)
static

Maps To Vector (MTV), as defined in 3.1.1 of the AAVFABI.

TODO: Need to implement the behavior for reference marked with a var or no linear modifiers (1.b in the section). For this, we need to extend ParamKindTy to support the linear modifiers.

Definition at line 9927 of file CGOpenMPRuntime.cpp.

References clang::QualType::getCanonicalType(), and clang::Type::isVoidType().

Referenced by getAArch64LS(), and getNDSWDS().

◆ getAArch64PBV()

static bool getAArch64PBV ( QualType  QT,
ASTContext C 
)
static

Pass By Value (PBV), as defined in 3.1.2 of the AAVFABI.

Definition at line 9948 of file CGOpenMPRuntime.cpp.

References clang::QualType::getCanonicalType(), clang::ASTContext::getTypeSize(), clang::Type::isFloatingType(), clang::Type::isIntegerType(), and clang::Type::isPointerType().

Referenced by getAArch64LS(), and getNDSWDS().

◆ getBaseDecl()

static const VarDecl* getBaseDecl ( const Expr Ref,
const DeclRefExpr *&  DE 
)
static

◆ getCancellationKind()

static RTCancelKind getCancellationKind ( OpenMPDirectiveKind  CancelRegion)
static

◆ getNDSWDS()

static std::tuple<unsigned, unsigned, bool> getNDSWDS ( const FunctionDecl FD,
ArrayRef< ParamAttrTy >  ParamAttrs 
)
static

◆ getNestedDistributeDirective()

static const OMPExecutableDirective* getNestedDistributeDirective ( ASTContext Ctx,
const OMPExecutableDirective D 
)
static

◆ getNumThreads()

static llvm::Value* getNumThreads ( CodeGenFunction CGF,
const CapturedStmt CS,
llvm::Value DefaultThreadLimitVal 
)
static

◆ getReductionInit()

static const OMPDeclareReductionDecl* getReductionInit ( const Expr ReductionOp)
static

Check if the combiner is a call to UDR combiner and if it is so return the UDR decl used for reduction.

Definition at line 787 of file CGOpenMPRuntime.cpp.

Referenced by clang::CodeGen::ReductionCodeGen::emitInitialization(), and clang::CodeGen::ReductionCodeGen::usesReductionInitializer().

◆ getRuntimeSchedule() [1/2]

static OpenMPSchedType getRuntimeSchedule ( OpenMPScheduleClauseKind  ScheduleKind,
bool  Chunked,
bool  Ordered 
)
static

◆ getRuntimeSchedule() [2/2]

static OpenMPSchedType getRuntimeSchedule ( OpenMPDistScheduleClauseKind  ScheduleKind,
bool  Chunked 
)
static

Map the OpenMP distribute schedule to the runtime enumeration.

Definition at line 3437 of file CGOpenMPRuntime.cpp.

References OMP_dist_sch_static, and OMP_dist_sch_static_chunked.

◆ getTargetEntryUniqueInfo()

static void getTargetEntryUniqueInfo ( ASTContext C,
SourceLocation  Loc,
unsigned &  DeviceID,
unsigned &  FileID,
unsigned &  LineNum 
)
static

Obtain information that uniquely identifies a target entry.

This consists of the file and device IDs as well as line number associated with the relevant entry source location.

Definition at line 2755 of file CGOpenMPRuntime.cpp.

References clang::SourceManager::getDiagnostics(), clang::SourceManager::getPresumedLoc(), clang::ASTContext::getSourceManager(), clang::SourceLocation::isValid(), clang::DiagnosticsEngine::Report(), and SM.

Referenced by clang::CodeGen::emitDeclareTargetVarDefinition(), clang::CodeGen::CGOpenMPRuntime::emitTargetOutlinedFunctionHelper(), and clang::CodeGen::registerTargetFirstprivateCopy().

◆ isTrivial()

static bool isTrivial ( ASTContext Ctx,
const Expr E 
)
static

◆ loadToBegin()

static LValue loadToBegin ( CodeGenFunction CGF,
QualType  BaseTy,
QualType  ElTy,
LValue  BaseLV 
)
static

◆ mangleVectorParameters()

static std::string mangleVectorParameters ( ArrayRef< ParamAttrTy >  ParamAttrs)
static

Mangle the parameter part of the vector function name according to their OpenMP classification.

The mangling function is defined in section 3.5 of the AAVFABI.

Definition at line 10025 of file CGOpenMPRuntime.cpp.

Referenced by emitAArch64DeclareSimdFunction().

Variable Documentation

◆ ident_t

ident_t

Definition at line 511 of file CGOpenMPRuntime.cpp.