clang 22.0.0git
CGOpenMPRuntime.cpp File Reference
#include "CGOpenMPRuntime.h"
#include "ABIInfoImpl.h"
#include "CGCXXABI.h"
#include "CGCleanup.h"
#include "CGDebugInfo.h"
#include "CGRecordLayout.h"
#include "CodeGenFunction.h"
#include "TargetInfo.h"
#include "clang/AST/APValue.h"
#include "clang/AST/Attr.h"
#include "clang/AST/Decl.h"
#include "clang/AST/OpenMPClause.h"
#include "clang/AST/StmtOpenMP.h"
#include "clang/AST/StmtVisitor.h"
#include "clang/Basic/OpenMPKinds.h"
#include "clang/Basic/SourceManager.h"
#include "clang/CodeGen/ConstantInitBuilder.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Bitcode/BitcodeReader.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/InstrTypes.h"
#include "llvm/IR/Value.h"
#include "llvm/Support/AtomicOrdering.h"
#include "llvm/Support/raw_ostream.h"
#include <cassert>
#include <cstdint>
#include <numeric>
#include <optional>

Go to the source code of this file.

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.
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.
static LValue loadToBegin (CodeGenFunction &CGF, QualType BaseTy, QualType ElTy, LValue BaseLV)
static Address castToBase (CodeGenFunction &CGF, QualType BaseTy, QualType ElTy, Address OriginalBaseAddress, 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 StringRef getIdentStringFromSourceLocation (CodeGenFunction &CGF, SourceLocation Loc, SmallString< 128 > &Buffer)
static llvm::OffloadEntriesInfoManager::OMPTargetDeviceClauseKind convertDeviceClause (const VarDecl *VD)
static llvm::OffloadEntriesInfoManager::OMPTargetGlobalVarEntryKind convertCaptureClause (const VarDecl *VD)
static llvm::TargetRegionEntryInfo getEntryInfoFromPresumedLoc (CodeGenModule &CGM, llvm::OpenMPIRBuilder &OMPBuilder, SourceLocation BeginLoc, llvm::StringRef ParentName="")
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.
static llvm::ValueemitCopyprivateCopyFunction (CodeGenModule &CGM, llvm::Type *ArgsElemType, 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.
static OpenMPSchedType getRuntimeSchedule (OpenMPDistScheduleClauseKind ScheduleKind, bool Chunked)
 Map the OpenMP distribute schedule to the runtime enumeration.
static int addMonoNonMonoModifier (CodeGenModule &CGM, 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 bool isAllocatableDecl (const VarDecl *VD)
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.
static llvm::ValueemitDestructorsFunction (CodeGenModule &CGM, SourceLocation Loc, QualType KmpInt32Ty, QualType KmpTaskTWithPrivatesPtrQTy, QualType KmpTaskTWithPrivatesQTy)
static llvm::ValueemitTaskPrivateMappingFunction (CodeGenModule &CGM, SourceLocation Loc, const OMPTaskDataTy &Data, QualType PrivatesQTy, ArrayRef< PrivateDataTy > Privates)
 Emit a privates mapping function for correct handling of private and firstprivate variables.
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.
static bool checkInitIsRequired (CodeGenFunction &CGF, ArrayRef< PrivateDataTy > Privates)
 Check if duplication function is required for taskloops.
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)
static bool checkDestructorsRequired (const RecordDecl *KmpTaskTWithPrivatesQTyRD, ArrayRef< PrivateDataTy > Privates)
 Checks if destructor function is required to be generated.
static std::pair< llvm::Value *, llvm::Value * > getPointerAndSize (CodeGenFunction &CGF, const Expr *E)
static void getKmpAffinityType (ASTContext &C, QualType &KmpTaskAffinityInfoTy)
 Builds kmp_depend_info, if it is not built yet, and builds flags type.
static RTLDependenceKindTy translateDependencyKind (OpenMPDependClauseKind K)
 Translates internal dependency kind into the runtime kind.
static void getDependTypes (ASTContext &C, QualType &KmpDependInfoTy, QualType &FlagsTy)
 Builds kmp_depend_info, if it is not built yet, and builds flags type.
static void emitDependData (CodeGenFunction &CGF, QualType &KmpDependInfoTy, llvm::PointerUnion< unsigned *, LValue * > Pos, const OMPTaskDataTy::DependData &Data, Address DependenciesArray)
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.
static void emitReductionCombiner (CodeGenFunction &CGF, const Expr *ReductionOp)
 Emit reduction combiner.
static std::string generateUniqueName (CodeGenModule &CGM, llvm::StringRef Prefix, const Expr *Ref)
static std::string generateUniqueName (CodeGenModule &CGM, StringRef Prefix, const Expr *Ref)
 Generates unique name for artificial threadprivate variables.
static llvm::ValueemitReduceInitFunction (CodeGenModule &CGM, SourceLocation Loc, ReductionCodeGen &RCG, unsigned N)
 Emits reduction initializer function:
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:
static llvm::ValueemitReduceFiniFunction (CodeGenModule &CGM, SourceLocation Loc, ReductionCodeGen &RCG, unsigned N)
 Emits reduction finalizer function:
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.
static void getNumThreads (CodeGenFunction &CGF, const CapturedStmt *CS, const Expr **E, int32_t &UpperBound, bool UpperBoundOnly, llvm::Value **CondVal)
 Check for a num threads constant value (stored in DefaultVal), or expression (stored in E).
static ValueDeclgetDeclFromThisExpr (const Expr *E)
static llvm::Constant * emitMappingInformation (CodeGenFunction &CGF, llvm::OpenMPIRBuilder &OMPBuilder, MappableExprsHandler::MappingExprInfo &MapExprs)
 Emit a string constant containing the names of the values mapped to the offloading runtime library.
static void emitOffloadingArraysAndArgs (CodeGenFunction &CGF, MappableExprsHandler::MapCombinedInfoTy &CombinedInfo, CGOpenMPRuntime::TargetDataInfo &Info, llvm::OpenMPIRBuilder &OMPBuilder, bool IsNonContiguous=false, bool ForEndCall=false)
 Emit the arrays used to pass the captures and map information to the offloading runtime library.
static const OMPExecutableDirectivegetNestedDistributeDirective (ASTContext &Ctx, const OMPExecutableDirective &D)
 Check for inner distribute directive.
static void emitTargetCallFallback (CGOpenMPRuntime *OMPRuntime, llvm::Function *OutlinedFn, const OMPExecutableDirective &D, llvm::SmallVectorImpl< llvm::Value * > &CapturedVars, bool RequiresOuterTask, const CapturedStmt &CS, bool OffloadingMandatory, CodeGenFunction &CGF)
static llvm::ValueemitDeviceID (llvm::PointerIntPair< const Expr *, 2, OpenMPDeviceClauseModifier > Device, CodeGenFunction &CGF)
static llvm::ValueemitDynCGGroupMem (const OMPExecutableDirective &D, CodeGenFunction &CGF)
static void genMapInfoForCaptures (MappableExprsHandler &MEHandler, CodeGenFunction &CGF, const CapturedStmt &CS, llvm::SmallVectorImpl< llvm::Value * > &CapturedVars, llvm::OpenMPIRBuilder &OMPBuilder, llvm::DenseSet< CanonicalDeclPtr< const Decl > > &MappedVarSet, MappableExprsHandler::MapCombinedInfoTy &CombinedInfo)
static void genMapInfo (MappableExprsHandler &MEHandler, CodeGenFunction &CGF, MappableExprsHandler::MapCombinedInfoTy &CombinedInfo, llvm::OpenMPIRBuilder &OMPBuilder, const llvm::DenseSet< CanonicalDeclPtr< const Decl > > &SkippedVarSet=llvm::DenseSet< CanonicalDeclPtr< const Decl > >())
static void genMapInfo (const OMPExecutableDirective &D, CodeGenFunction &CGF, const CapturedStmt &CS, llvm::SmallVectorImpl< llvm::Value * > &CapturedVars, llvm::OpenMPIRBuilder &OMPBuilder, MappableExprsHandler::MapCombinedInfoTy &CombinedInfo)
template<typename ClauseTy>
static void emitClauseForBareTargetDirective (CodeGenFunction &CGF, const OMPExecutableDirective &D, llvm::SmallVectorImpl< llvm::Value * > &Values)
static void emitTargetCallKernelLaunch (CGOpenMPRuntime *OMPRuntime, llvm::Function *OutlinedFn, const OMPExecutableDirective &D, llvm::SmallVectorImpl< llvm::Value * > &CapturedVars, bool RequiresOuterTask, const CapturedStmt &CS, bool OffloadingMandatory, llvm::PointerIntPair< const Expr *, 2, OpenMPDeviceClauseModifier > Device, llvm::Value *OutlinedFnID, CodeGenFunction::OMPTargetDataInfo &InputInfo, llvm::Value *&MapTypesArray, llvm::Value *&MapNamesArray, llvm::function_ref< llvm::Value *(CodeGenFunction &CGF, const OMPLoopDirective &D)> SizeEmitter, CodeGenFunction &CGF, CodeGenModule &CGM)
static void emitTargetCallElse (CGOpenMPRuntime *OMPRuntime, llvm::Function *OutlinedFn, const OMPExecutableDirective &D, llvm::SmallVectorImpl< llvm::Value * > &CapturedVars, bool RequiresOuterTask, const CapturedStmt &CS, bool OffloadingMandatory, CodeGenFunction &CGF)
static bool isAssumedToBeNotEmitted (const ValueDecl *VD, bool IsDevice)
static unsigned evaluateCDTSize (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.
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 4.1.1 of the AAVFABI (2021Q1).
static bool getAArch64PBV (QualType QT, ASTContext &C)
 Pass By Value (PBV), as defined in 3.1.2 of the AAVFABI.
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.
static std::tuple< unsigned, unsigned, boolgetNDSWDS (const FunctionDecl *FD, ArrayRef< ParamAttrTy > ParamAttrs)
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.
template<typename T>
static void EmitDoacrossOrdered (CodeGenFunction &CGF, CodeGenModule &CGM, const T *C, llvm::Value *ULoc, llvm::Value *ThreadID)
static llvm::ValuegetAllocatorVal (CodeGenFunction &CGF, const Expr *Allocator)
 Return allocator value from expression, or return a null allocator (default when no allocator specified).
static llvm::ValuegetAlignmentValue (CodeGenModule &CGM, const VarDecl *VD)
 Return the alignment from an allocate directive if present.

Function Documentation

◆ addAArch64AdvSIMDNDSNames()

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

Definition at line 11003 of file CGOpenMPRuntime.cpp.

References addAArch64VectorName().

Referenced by emitAArch64DeclareSimdFunction().

◆ addAArch64VectorName()

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

Definition at line 10988 of file CGOpenMPRuntime.cpp.

References clang::T.

Referenced by addAArch64AdvSIMDNDSNames(), and emitAArch64DeclareSimdFunction().

◆ addFieldToRecordDecl()

◆ addMonoNonMonoModifier()

◆ castToBase()

◆ checkDestructorsRequired()

bool checkDestructorsRequired ( const RecordDecl * KmpTaskTWithPrivatesQTyRD,
ArrayRef< PrivateDataTy > Privates )
static

Checks if destructor function is required to be generated.

Returns
true if cleanups are required, false otherwise.

Definition at line 3485 of file CGOpenMPRuntime.cpp.

References clang::QualType::isDestructedType().

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

◆ checkInitIsRequired()

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

Check if duplication function is required for taskloops.

Definition at line 3386 of file CGOpenMPRuntime.cpp.

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

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

◆ convertCaptureClause()

llvm::OffloadEntriesInfoManager::OMPTargetGlobalVarEntryKind convertCaptureClause ( const VarDecl * VD)
static

◆ convertDeviceClause()

llvm::OffloadEntriesInfoManager::OMPTargetDeviceClauseKind convertDeviceClause ( const VarDecl * VD)
static

◆ createKmpTaskTRecordDecl()

◆ createKmpTaskTWithPrivatesRecordDecl()

◆ createPrivatesRecordDecl()

◆ emitAArch64DeclareSimdFunction()

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

◆ emitClauseForBareTargetDirective()

template<typename ClauseTy>
void emitClauseForBareTargetDirective ( CodeGenFunction & CGF,
const OMPExecutableDirective & D,
llvm::SmallVectorImpl< llvm::Value * > & Values )
static

◆ emitCombinerOrInitializer()

◆ emitCopyprivateCopyFunction()

◆ emitDependData()

◆ emitDestructorsFunction()

◆ emitDeviceID()

◆ EmitDoacrossOrdered()

◆ emitDynCGGroupMem()

◆ emitForStaticInitCall()

◆ emitInitWithReductionInitializer()

◆ emitMappingInformation()

◆ emitOffloadingArraysAndArgs()

void emitOffloadingArraysAndArgs ( CodeGenFunction & CGF,
MappableExprsHandler::MapCombinedInfoTy & CombinedInfo,
CGOpenMPRuntime::TargetDataInfo & Info,
llvm::OpenMPIRBuilder & OMPBuilder,
bool IsNonContiguous = false,
bool ForEndCall = false )
static

◆ EmitOMPAggregateInit()

◆ EmitOMPAggregateReduction()

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

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

Referenced by clang::CodeGen::CGOpenMPRuntime::emitReduction(), clang::CodeGen::CGOpenMPRuntime::emitReductionFunction(), and clang::CodeGen::CGOpenMPRuntime::emitSingleReductionCombiner().

◆ emitParallelOrTeamsOutlinedFunction()

◆ emitPrivatesInit()

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

◆ emitProxyTaskFunction()

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

References clang::CodeGen::CodeGenTypes::arrangeBuiltinFunctionDeclaration(), clang::CodeGen::CodeGenFunction::Builder, clang::C, clang::Type::castAs(), clang::Type::castAsRecordDecl(), clang::CodeGen::CodeGenFunction::ConvertTypeForMem(), clang::CodeGen::CGBuilderTy::CreatePointerBitCastOrAddrSpaceCast(), clang::CodeGen::CodeGenFunction::EmitLoadOfPointerLValue(), clang::CodeGen::CodeGenFunction::EmitLoadOfScalar(), clang::CodeGen::CodeGenFunction::EmitLValueForField(), clang::CodeGen::CGOpenMPRuntime::emitOutlinedFunctionCall(), clang::CodeGen::Address::emitRawPointer(), clang::CodeGen::CodeGenFunction::EmitStoreThroughLValue(), clang::CodeGen::CodeGenFunction::FinishFunction(), clang::CodeGen::RValue::get(), clang::CodeGen::CodeGenFunction::GetAddrOfLocalVar(), clang::CodeGen::CodeGenModule::getContext(), clang::CodeGen::CodeGenTypes::GetFunctionType(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::CGOpenMPRuntime::getName(), clang::CodeGen::CodeGenModule::getOpenMPRuntime(), clang::CodeGen::CodeGenModule::getTypes(), clang::CodeGen::CodeGenTypeCache::Int8Ty, clang::isOpenMPTaskLoopDirective(), clang::CodeGen::CodeGenFunction::MakeAddrLValue(), clang::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::CGOpenMPRuntime::emitTaskInit().

◆ emitReduceCombFunction()

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
}
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.

Definition at line 5607 of file CGOpenMPRuntime.cpp.

References clang::CodeGen::CodeGenFunction::OMPPrivateScope::addPrivate(), clang::CodeGen::CodeGenTypes::arrangeBuiltinFunctionDeclaration(), clang::CodeGen::CodeGenFunction::Builder, clang::C, clang::cast(), clang::CodeGen::ReductionCodeGen::emitAggregateType(), clang::CodeGen::CodeGenFunction::EmitLoadOfPointer(), clang::CodeGen::CodeGenFunction::EmitLoadOfScalar(), clang::CodeGen::CGOpenMPRuntime::emitSingleReductionCombiner(), clang::CodeGen::CodeGenFunction::FinishFunction(), generateUniqueName(), clang::CodeGen::CGOpenMPRuntime::getAddrOfArtificialThreadPrivate(), clang::CodeGen::CodeGenFunction::GetAddrOfLocalVar(), clang::CodeGen::CodeGenModule::getContext(), clang::CodeGen::CodeGenTypes::GetFunctionType(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::CGOpenMPRuntime::getName(), clang::CodeGen::CodeGenModule::getOpenMPRuntime(), clang::CodeGen::ReductionCodeGen::getRefExpr(), clang::CodeGen::ReductionCodeGen::getSizes(), clang::ASTContext::getSizeType(), clang::CodeGen::CodeGenModule::getTypes(), clang::Other, clang::CodeGen::CodeGenFunction::OMPPrivateScope::Privatize(), clang::CodeGen::CodeGenModule::SetInternalFunctionAttributes(), clang::CodeGen::CodeGenFunction::StartFunction(), and clang::CodeGen::Address::withElementType().

Referenced by clang::CodeGen::CGOpenMPRuntime::emitTaskReductionInit().

◆ emitReduceFiniFunction()

◆ emitReduceInitFunction()

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

Emits reduction initializer function:

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

Definition at line 5540 of file CGOpenMPRuntime.cpp.

References clang::QualType::addRestrict(), clang::CodeGen::CodeGenTypes::arrangeBuiltinFunctionDeclaration(), clang::CodeGen::CodeGenFunction::Builder, clang::C, clang::CanQual< T >::castAs(), clang::CodeGen::ReductionCodeGen::emitAggregateType(), clang::CodeGen::ReductionCodeGen::emitInitialization(), clang::CodeGen::CodeGenFunction::EmitLoadOfPointer(), clang::CodeGen::CodeGenFunction::EmitLoadOfScalar(), clang::CodeGen::CodeGenFunction::FinishFunction(), generateUniqueName(), clang::CodeGen::CGOpenMPRuntime::getAddrOfArtificialThreadPrivate(), clang::CodeGen::CodeGenFunction::GetAddrOfLocalVar(), clang::CodeGen::CodeGenModule::getContext(), clang::CodeGen::CodeGenTypes::GetFunctionType(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::CGOpenMPRuntime::getName(), clang::CodeGen::CodeGenModule::getOpenMPRuntime(), clang::CodeGen::ReductionCodeGen::getPrivateType(), clang::CodeGen::ReductionCodeGen::getRefExpr(), clang::CodeGen::ReductionCodeGen::getSizes(), clang::ASTContext::getSizeType(), clang::CodeGen::CodeGenModule::getTypes(), clang::CodeGen::Address::invalid(), clang::Other, clang::CodeGen::CodeGenModule::SetInternalFunctionAttributes(), clang::CodeGen::CodeGenFunction::StartFunction(), clang::CodeGen::ReductionCodeGen::usesReductionInitializer(), clang::ASTContext::VoidPtrTy, and clang::CodeGen::Address::withElementType().

Referenced by clang::CodeGen::CGOpenMPRuntime::emitTaskReductionInit().

◆ emitReductionCombiner()

◆ emitTargetCallElse()

void emitTargetCallElse ( CGOpenMPRuntime * OMPRuntime,
llvm::Function * OutlinedFn,
const OMPExecutableDirective & D,
llvm::SmallVectorImpl< llvm::Value * > & CapturedVars,
bool RequiresOuterTask,
const CapturedStmt & CS,
bool OffloadingMandatory,
CodeGenFunction & CGF )
static

◆ emitTargetCallFallback()

void emitTargetCallFallback ( CGOpenMPRuntime * OMPRuntime,
llvm::Function * OutlinedFn,
const OMPExecutableDirective & D,
llvm::SmallVectorImpl< llvm::Value * > & CapturedVars,
bool RequiresOuterTask,
const CapturedStmt & CS,
bool OffloadingMandatory,
CodeGenFunction & CGF )
static

◆ emitTargetCallKernelLaunch()

void emitTargetCallKernelLaunch ( CGOpenMPRuntime * OMPRuntime,
llvm::Function * OutlinedFn,
const OMPExecutableDirective & D,
llvm::SmallVectorImpl< llvm::Value * > & CapturedVars,
bool RequiresOuterTask,
const CapturedStmt & CS,
bool OffloadingMandatory,
llvm::PointerIntPair< const Expr *, 2, OpenMPDeviceClauseModifier > Device,
llvm::Value * OutlinedFnID,
CodeGenFunction::OMPTargetDataInfo & InputInfo,
llvm::Value *& MapTypesArray,
llvm::Value *& MapNamesArray,
llvm::function_ref< llvm::Value *(CodeGenFunction &CGF, const OMPLoopDirective &D)> SizeEmitter,
CodeGenFunction & CGF,
CodeGenModule & CGM )
static

◆ emitTaskDupFunction()

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

llvm::Value * emitTaskPrivateMappingFunction ( CodeGenModule & CGM,
SourceLocation Loc,
const OMPTaskDataTy & Data,
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 3168 of file CGOpenMPRuntime.cpp.

References clang::CodeGen::CodeGenTypes::arrangeBuiltinFunctionDeclaration(), clang::C, clang::cast(), clang::Type::castAs(), clang::Type::castAsRecordDecl(), clang::ImplicitParamDecl::Create(), clang::Data, clang::CodeGen::CodeGenFunction::EmitLoadOfPointerLValue(), clang::CodeGen::CodeGenFunction::EmitLValueForField(), clang::CodeGen::CodeGenFunction::EmitStoreOfScalar(), clang::CodeGen::CodeGenFunction::FinishFunction(), clang::CodeGen::CodeGenFunction::GetAddrOfLocalVar(), clang::CodeGen::CodeGenModule::getCodeGenOpts(), clang::CodeGen::CodeGenModule::getContext(), clang::CodeGen::CodeGenTypes::GetFunctionType(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::CGOpenMPRuntime::getName(), clang::QualType::getNonReferenceType(), clang::CodeGen::CodeGenModule::getOpenMPRuntime(), clang::Expr::getType(), clang::ValueDecl::getType(), clang::CodeGen::CodeGenModule::getTypes(), isAllocatableDecl(), clang::Type::isLValueReferenceType(), clang::CodeGen::CodeGenFunction::MakeAddrLValue(), clang::Other, clang::CodeGen::CodeGenModule::SetInternalFunctionAttributes(), and clang::CodeGen::CodeGenFunction::StartFunction().

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

◆ emitX86DeclareSimdFunction()

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

◆ evaluateCDTSize()

◆ generateUniqueName() [1/2]

◆ generateUniqueName() [2/2]

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

◆ genMapInfo() [1/2]

void genMapInfo ( const OMPExecutableDirective & D,
CodeGenFunction & CGF,
const CapturedStmt & CS,
llvm::SmallVectorImpl< llvm::Value * > & CapturedVars,
llvm::OpenMPIRBuilder & OMPBuilder,
MappableExprsHandler::MapCombinedInfoTy & CombinedInfo )
static

Definition at line 9717 of file CGOpenMPRuntime.cpp.

References genMapInfo(), and genMapInfoForCaptures().

◆ genMapInfo() [2/2]

void genMapInfo ( MappableExprsHandler & MEHandler,
CodeGenFunction & CGF,
MappableExprsHandler::MapCombinedInfoTy & CombinedInfo,
llvm::OpenMPIRBuilder & OMPBuilder,
const llvm::DenseSet< CanonicalDeclPtr< const Decl > > & SkippedVarSet = llvm::DenseSet<CanonicalDeclPtr<const Decl>>() )
static

◆ genMapInfoForCaptures()

◆ getAArch64LS()

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

References clang::C, getAArch64MTV(), getAArch64PBV(), clang::QualType::getCanonicalType(), clang::Type::getPointeeType(), and clang::Type::isPointerType().

Referenced by getNDSWDS().

◆ getAArch64MTV()

bool getAArch64MTV ( QualType QT,
ParamKindTy Kind )
static

Maps To Vector (MTV), as defined in 4.1.1 of the AAVFABI (2021Q1).

Definition at line 10891 of file CGOpenMPRuntime.cpp.

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

Referenced by getAArch64LS(), and getNDSWDS().

◆ getAArch64PBV()

bool getAArch64PBV ( QualType QT,
ASTContext & C )
static

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

Definition at line 10911 of file CGOpenMPRuntime.cpp.

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

Referenced by getAArch64LS(), and getNDSWDS().

◆ getAlignmentValue()

llvm::Value * getAlignmentValue ( CodeGenModule & CGM,
const VarDecl * VD )
static

◆ getAllocatorVal()

◆ getBaseDecl()

◆ getCancellationKind()

RTCancelKind getCancellationKind ( OpenMPDirectiveKind CancelRegion)
static

◆ getDeclFromThisExpr()

ValueDecl * getDeclFromThisExpr ( const Expr * E)
static

Definition at line 9249 of file CGOpenMPRuntime.cpp.

References clang::Expr::IgnoreParenCasts().

Referenced by emitMappingInformation().

◆ getDependTypes()

◆ getEntryInfoFromPresumedLoc()

◆ getIdentStringFromSourceLocation()

◆ getKmpAffinityType()

void getKmpAffinityType ( ASTContext & C,
QualType & KmpTaskAffinityInfoTy )
static

Builds kmp_depend_info, if it is not built yet, and builds flags type.

Definition at line 3610 of file CGOpenMPRuntime.cpp.

References addFieldToRecordDecl(), clang::C, clang::RecordDecl::completeDefinition(), clang::QualType::isNull(), and clang::TagDecl::startDefinition().

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

◆ getNDSWDS()

◆ getNestedDistributeDirective()

◆ getNumThreads()

◆ getPointerAndSize()

◆ getReductionInit()

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

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

◆ getRuntimeSchedule() [1/2]

OpenMPSchedType getRuntimeSchedule ( OpenMPDistScheduleClauseKind ScheduleKind,
bool Chunked )
static

Map the OpenMP distribute schedule to the runtime enumeration.

Definition at line 2413 of file CGOpenMPRuntime.cpp.

◆ getRuntimeSchedule() [2/2]

◆ isAllocatableDecl()

◆ isAssumedToBeNotEmitted()

bool isAssumedToBeNotEmitted ( const ValueDecl * VD,
bool IsDevice )
static

◆ isTrivial()

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

◆ loadToBegin()

◆ mangleVectorParameters()

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 4.5 of the AAVFABI(2021Q1).

Definition at line 10786 of file CGOpenMPRuntime.cpp.

References clang::Vector.

Referenced by emitAArch64DeclareSimdFunction(), and emitX86DeclareSimdFunction().

◆ translateDependencyKind()

RTLDependenceKindTy translateDependencyKind ( OpenMPDependClauseKind K)
static

Translates internal dependency kind into the runtime kind.

Definition at line 4013 of file CGOpenMPRuntime.cpp.

References clang::OMPC_DEPEND_unknown.

Referenced by emitDependData(), and clang::CodeGen::CGOpenMPRuntime::emitUpdateClause().