clang 22.0.0git
CGStmtOpenMP.cpp File Reference
#include "CGCleanup.h"
#include "CGDebugInfo.h"
#include "CGOpenMPRuntime.h"
#include "CodeGenFunction.h"
#include "CodeGenModule.h"
#include "CodeGenPGO.h"
#include "TargetInfo.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/Attr.h"
#include "clang/AST/DeclOpenMP.h"
#include "clang/AST/OpenMPClause.h"
#include "clang/AST/Stmt.h"
#include "clang/AST/StmtOpenMP.h"
#include "clang/AST/StmtVisitor.h"
#include "clang/Basic/OpenMPKinds.h"
#include "clang/Basic/PrettyStackTrace.h"
#include "clang/Basic/SourceManager.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/Frontend/OpenMP/OMPConstants.h"
#include "llvm/Frontend/OpenMP/OMPIRBuilder.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Metadata.h"
#include "llvm/Support/AtomicOrdering.h"
#include "llvm/Support/Debug.h"
#include <optional>

Go to the source code of this file.

Macros

#define TTL_CODEGEN_TYPE   "target-teams-loop-codegen"

Typedefs

using EmittedClosureTy = std::pair<llvm::Function *, llvm::Value *>

Functions

static const VarDeclgetBaseDecl (const Expr *Ref)
static OpenMPDirectiveKind getEffectiveDirectiveKind (const OMPExecutableDirective &S)
static void emitCommonOMPTargetDirective (CodeGenFunction &CGF, const OMPExecutableDirective &S, const RegionCodeGenTy &CodeGen)
static Address castValueFromUintptr (CodeGenFunction &CGF, SourceLocation Loc, QualType DstType, StringRef Name, LValue AddrLV)
static QualType getCanonicalParamType (ASTContext &C, QualType T)
static llvm::Function * emitOutlinedFunctionPrologue (CodeGenFunction &CGF, FunctionArgList &Args, llvm::MapVector< const Decl *, std::pair< const VarDecl *, Address > > &LocalAddrs, llvm::DenseMap< const Decl *, std::pair< const Expr *, llvm::Value * > > &VLASizes, llvm::Value *&CXXThisValue, const FunctionOptions &FO)
static void emitPostUpdateForReductionClause (CodeGenFunction &CGF, const OMPExecutableDirective &D, const llvm::function_ref< llvm::Value *(CodeGenFunction &)> CondGen)
static void checkForLastprivateConditionalUpdate (CodeGenFunction &CGF, const OMPExecutableDirective &S)
static void emitCommonOMPParallelDirective (CodeGenFunction &CGF, const OMPExecutableDirective &S, OpenMPDirectiveKind InnermostKind, const RegionCodeGenTy &CodeGen, const CodeGenBoundParametersTy &CodeGenBoundParameters)
static bool isAllocatableDecl (const VarDecl *VD)
static void emitEmptyBoundParameters (CodeGenFunction &, const OMPExecutableDirective &, llvm::SmallVectorImpl< llvm::Value * > &)
static void emitOMPCopyinClause (CodeGenFunction &CGF, const OMPExecutableDirective &S)
static void emitBody (CodeGenFunction &CGF, const Stmt *S, const Stmt *NextLoop, int MaxLevel, int Level=0)
static EmittedClosureTy emitCapturedStmtFunc (CodeGenFunction &ParentCGF, const CapturedStmt *S)
 Emit a captured statement and return the function as well as its captured closure context.
static llvm::CallInst * emitCapturedStmtCall (CodeGenFunction &ParentCGF, EmittedClosureTy Cap, llvm::ArrayRef< llvm::Value * > Args)
 Emit a call to a previously captured closure.
static void emitAlignedClause (CodeGenFunction &CGF, const OMPExecutableDirective &D)
static void emitPreCond (CodeGenFunction &CGF, const OMPLoopDirective &S, const Expr *Cond, llvm::BasicBlock *TrueBlock, llvm::BasicBlock *FalseBlock, uint64_t TrueCount)
static void emitSimdlenSafelenClause (CodeGenFunction &CGF, const OMPExecutableDirective &D)
static bool hasOrderedDirective (const Stmt *S)
static void applyConservativeSimdOrderedDirective (const Stmt &AssociatedStmt, LoopInfoStack &LoopStack)
static void emitOMPLoopBodyWithStopPoint (CodeGenFunction &CGF, const OMPLoopDirective &S, CodeGenFunction::JumpDest LoopExit)
static LValue EmitOMPHelperVar (CodeGenFunction &CGF, const DeclRefExpr *Helper)
 Emit a helper variable and return corresponding lvalue.
static void emitCommonSimdLoop (CodeGenFunction &CGF, const OMPLoopDirective &S, const RegionCodeGenTy &SimdInitGen, const RegionCodeGenTy &BodyCodeGen)
static void emitOMPSimdRegion (CodeGenFunction &CGF, const OMPLoopDirective &S, PrePostActionTy &Action)
static bool isSimdSupportedByOpenMPIRBuilder (const OMPLoopDirective &S)
static llvm::MapVector< llvm::Value *, llvm::Value * > GetAlignedMapping (const OMPLoopDirective &S, CodeGenFunction &CGF)
static void emitOMPSimdDirective (const OMPLoopDirective &S, CodeGenFunction &CGF, CodeGenModule &CGM)
static void emitEmptyOrdered (CodeGenFunction &, SourceLocation Loc, const unsigned IVSize, const bool IVSigned)
static std::pair< LValue, LValue > emitDistributeParallelForInnerBounds (CodeGenFunction &CGF, const OMPExecutableDirective &S)
static std::pair< llvm::Value *, llvm::Value * > emitDistributeParallelForDispatchBounds (CodeGenFunction &CGF, const OMPExecutableDirective &S, Address LB, Address UB)
 if the 'for' loop has a dispatch schedule (e.g.
static void emitDistributeParallelForDistributeInnerBoundParams (CodeGenFunction &CGF, const OMPExecutableDirective &S, llvm::SmallVectorImpl< llvm::Value * > &CapturedVars)
static void emitInnerParallelForWhenCombined (CodeGenFunction &CGF, const OMPLoopDirective &S, CodeGenFunction::JumpDest LoopExit)
static std::pair< LValue, LValue > emitForLoopBounds (CodeGenFunction &CGF, const OMPExecutableDirective &S)
 The following two functions generate expressions for the loop lower and upper bounds in case of static and dynamic (dispatch) schedule of the associated 'for' or 'distribute' loop.
static std::pair< llvm::Value *, llvm::Value * > emitDispatchForLoopBounds (CodeGenFunction &CGF, const OMPExecutableDirective &S, Address LB, Address UB)
 When dealing with dispatch schedules (e.g.
static void emitScanBasedDirectiveDecls (CodeGenFunction &CGF, const OMPLoopDirective &S, llvm::function_ref< llvm::Value *(CodeGenFunction &)> NumIteratorsGen)
 Emits internal temp array declarations for the directive with inscan reductions.
static void emitScanBasedDirectiveFinals (CodeGenFunction &CGF, const OMPLoopDirective &S, llvm::function_ref< llvm::Value *(CodeGenFunction &)> NumIteratorsGen)
 Copies final inscan reductions values to the original variables.
static void emitScanBasedDirective (CodeGenFunction &CGF, const OMPLoopDirective &S, llvm::function_ref< llvm::Value *(CodeGenFunction &)> NumIteratorsGen, llvm::function_ref< void(CodeGenFunction &)> FirstGen, llvm::function_ref< void(CodeGenFunction &)> SecondGen)
 Emits the code for the directive with inscan reductions.
static bool emitWorksharingDirective (CodeGenFunction &CGF, const OMPLoopDirective &S, bool HasCancel)
static bool isForSupportedByOpenMPIRBuilder (const OMPLoopDirective &S, bool HasCancel)
static llvm::omp::ScheduleKind convertClauseKindToSchedKind (OpenMPScheduleClauseKind ScheduleClauseKind)
static void emitOMPForDirective (const OMPLoopDirective &S, CodeGenFunction &CGF, CodeGenModule &CGM, bool HasCancel)
static LValue createSectionLVal (CodeGenFunction &CGF, QualType Ty, const Twine &Name, llvm::Value *Init=nullptr)
static void emitMaster (CodeGenFunction &CGF, const OMPExecutableDirective &S)
static void emitMasked (CodeGenFunction &CGF, const OMPExecutableDirective &S)
static void buildDependences (const OMPExecutableDirective &S, OMPTaskDataTy &Data)
static ImplicitParamDeclcreateImplicitFirstprivateForType (ASTContext &C, OMPTaskDataTy &Data, QualType Ty, CapturedDecl *CD, SourceLocation Loc)
static bool isSupportedByOpenMPIRBuilder (const OMPTaskgroupDirective &T)
static void emitOMPDistributeDirective (const OMPLoopDirective &S, CodeGenFunction &CGF, CodeGenModule &CGM)
static llvm::Function * emitOutlinedOrderedFunction (CodeGenModule &CGM, const CapturedStmt *S, const OMPExecutableDirective &D)
template<typename T>
static void emitRestoreIP (CodeGenFunction &CGF, const T *C, llvm::OpenMPIRBuilder::InsertPointTy AllocaIP, llvm::OpenMPIRBuilder &OMPBuilder)
static llvm::ValueconvertToScalarValue (CodeGenFunction &CGF, RValue Val, QualType SrcType, QualType DestType, SourceLocation Loc)
static CodeGenFunction::ComplexPairTy convertToComplexValue (CodeGenFunction &CGF, RValue Val, QualType SrcType, QualType DestType, SourceLocation Loc)
static void emitSimpleAtomicStore (CodeGenFunction &CGF, llvm::AtomicOrdering AO, LValue LVal, RValue RVal)
static RValue emitSimpleAtomicLoad (CodeGenFunction &CGF, llvm::AtomicOrdering AO, LValue LVal, SourceLocation Loc)
static void emitOMPAtomicReadExpr (CodeGenFunction &CGF, llvm::AtomicOrdering AO, const Expr *X, const Expr *V, SourceLocation Loc)
static void emitOMPAtomicWriteExpr (CodeGenFunction &CGF, llvm::AtomicOrdering AO, const Expr *X, const Expr *E, SourceLocation Loc)
static std::pair< bool, RValueemitOMPAtomicRMW (CodeGenFunction &CGF, LValue X, RValue Update, BinaryOperatorKind BO, llvm::AtomicOrdering AO, bool IsXLHSInRHSPart)
static void emitOMPAtomicUpdateExpr (CodeGenFunction &CGF, llvm::AtomicOrdering AO, const Expr *X, const Expr *E, const Expr *UE, bool IsXLHSInRHSPart, SourceLocation Loc)
static RValue convertToType (CodeGenFunction &CGF, RValue Value, QualType SourceType, QualType ResType, SourceLocation Loc)
static void emitOMPAtomicCaptureExpr (CodeGenFunction &CGF, llvm::AtomicOrdering AO, bool IsPostfixUpdate, const Expr *V, const Expr *X, const Expr *E, const Expr *UE, bool IsXLHSInRHSPart, SourceLocation Loc)
static void emitOMPAtomicCompareExpr (CodeGenFunction &CGF, llvm::AtomicOrdering AO, llvm::AtomicOrdering FailAO, const Expr *X, const Expr *V, const Expr *R, const Expr *E, const Expr *D, const Expr *CE, bool IsXBinopExpr, bool IsPostfixUpdate, bool IsFailOnly, SourceLocation Loc)
static void emitOMPAtomicExpr (CodeGenFunction &CGF, OpenMPClauseKind Kind, llvm::AtomicOrdering AO, llvm::AtomicOrdering FailAO, bool IsPostfixUpdate, const Expr *X, const Expr *V, const Expr *R, const Expr *E, const Expr *UE, const Expr *D, const Expr *CE, bool IsXLHSInRHSPart, bool IsFailOnly, SourceLocation Loc)
static void emitTargetRegion (CodeGenFunction &CGF, const OMPTargetDirective &S, PrePostActionTy &Action)
static void emitCommonOMPTeamsDirective (CodeGenFunction &CGF, const OMPExecutableDirective &S, OpenMPDirectiveKind InnermostKind, const RegionCodeGenTy &CodeGen)
static void emitTargetTeamsRegion (CodeGenFunction &CGF, PrePostActionTy &Action, const OMPTargetTeamsDirective &S)
static void emitTargetTeamsDistributeRegion (CodeGenFunction &CGF, PrePostActionTy &Action, const OMPTargetTeamsDistributeDirective &S)
static void emitTargetTeamsDistributeSimdRegion (CodeGenFunction &CGF, PrePostActionTy &Action, const OMPTargetTeamsDistributeSimdDirective &S)
static void emitTargetTeamsDistributeParallelForRegion (CodeGenFunction &CGF, const OMPTargetTeamsDistributeParallelForDirective &S, PrePostActionTy &Action)
static void emitTargetTeamsDistributeParallelForSimdRegion (CodeGenFunction &CGF, const OMPTargetTeamsDistributeParallelForSimdDirective &S, PrePostActionTy &Action)
static void emitTargetParallelRegion (CodeGenFunction &CGF, const OMPTargetParallelDirective &S, PrePostActionTy &Action)
static void emitTargetParallelForRegion (CodeGenFunction &CGF, const OMPTargetParallelForDirective &S, PrePostActionTy &Action)
static void emitTargetParallelForSimdRegion (CodeGenFunction &CGF, const OMPTargetParallelForSimdDirective &S, PrePostActionTy &Action)
static void mapParam (CodeGenFunction &CGF, const DeclRefExpr *Helper, const ImplicitParamDecl *PVD, CodeGenFunction::OMPPrivateScope &Privates)
 Emit a helper variable and return corresponding lvalue.
static void emitTargetTeamsLoopCodegenStatus (CodeGenFunction &CGF, std::string StatusMsg, const OMPExecutableDirective &D)
static void emitTargetTeamsGenericLoopRegionAsParallel (CodeGenFunction &CGF, PrePostActionTy &Action, const OMPTargetTeamsGenericLoopDirective &S)
static void emitTargetTeamsGenericLoopRegionAsDistribute (CodeGenFunction &CGF, PrePostActionTy &Action, const OMPTargetTeamsGenericLoopDirective &S)
static void emitTargetParallelGenericLoopRegion (CodeGenFunction &CGF, const OMPTargetParallelGenericLoopDirective &S, PrePostActionTy &Action)

Macro Definition Documentation

◆ TTL_CODEGEN_TYPE

#define TTL_CODEGEN_TYPE   "target-teams-loop-codegen"

Typedef Documentation

◆ EmittedClosureTy

using EmittedClosureTy = std::pair<llvm::Function *, llvm::Value *>

Definition at line 2044 of file CGStmtOpenMP.cpp.

Function Documentation

◆ applyConservativeSimdOrderedDirective()

void applyConservativeSimdOrderedDirective ( const Stmt & AssociatedStmt,
LoopInfoStack & LoopStack )
static

◆ buildDependences()

◆ castValueFromUintptr()

◆ checkForLastprivateConditionalUpdate()

◆ convertClauseKindToSchedKind()

llvm::omp::ScheduleKind convertClauseKindToSchedKind ( OpenMPScheduleClauseKind ScheduleClauseKind)
static

Definition at line 4086 of file CGStmtOpenMP.cpp.

References clang::OMPC_SCHEDULE_unknown.

Referenced by emitOMPForDirective().

◆ convertToComplexValue()

◆ convertToScalarValue()

◆ convertToType()

◆ createImplicitFirstprivateForType()

◆ createSectionLVal()

◆ emitAlignedClause()

◆ emitBody()

◆ emitCapturedStmtCall()

llvm::CallInst * emitCapturedStmtCall ( CodeGenFunction & ParentCGF,
EmittedClosureTy Cap,
llvm::ArrayRef< llvm::Value * > Args )
static

Emit a call to a previously captured closure.

Definition at line 2062 of file CGStmtOpenMP.cpp.

References clang::CodeGen::CodeGenFunction::Builder, and clang::CodeGen::CodeGenFunction::ParentCGF.

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

◆ emitCapturedStmtFunc()

EmittedClosureTy emitCapturedStmtFunc ( CodeGenFunction & ParentCGF,
const CapturedStmt * S )
static

◆ emitCommonOMPParallelDirective()

void emitCommonOMPParallelDirective ( CodeGenFunction & CGF,
const OMPExecutableDirective & S,
OpenMPDirectiveKind InnermostKind,
const RegionCodeGenTy & CodeGen,
const CodeGenBoundParametersTy & CodeGenBoundParameters )
static

Definition at line 1614 of file CGStmtOpenMP.cpp.

References clang::C, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CGOpenMPRuntime::emitNumThreadsClause(), clang::CodeGen::CGOpenMPRuntime::emitParallelCall(), clang::CodeGen::CGOpenMPRuntime::emitParallelOutlinedFunction(), clang::CodeGen::CGOpenMPRuntime::emitProcBindClause(), clang::CodeGen::CodeGenFunction::EmitScalarExpr(), clang::CodeGen::CodeGenFunction::GenerateOpenMPCapturedVars(), clang::CapturedStmt::getCapturedDecl(), clang::CodeGen::CodeGenModule::getOpenMPRuntime(), clang::OMPC_NUMTHREADS_unknown, and clang::CapturedDecl::param_begin().

Referenced by emitInnerParallelForWhenCombined(), clang::CodeGen::CodeGenFunction::EmitOMPParallelDirective(), clang::CodeGen::CodeGenFunction::EmitOMPParallelForDirective(), clang::CodeGen::CodeGenFunction::EmitOMPParallelForSimdDirective(), clang::CodeGen::CodeGenFunction::EmitOMPParallelGenericLoopDirective(), clang::CodeGen::CodeGenFunction::EmitOMPParallelMaskedDirective(), clang::CodeGen::CodeGenFunction::EmitOMPParallelMaskedTaskLoopDirective(), clang::CodeGen::CodeGenFunction::EmitOMPParallelMaskedTaskLoopSimdDirective(), clang::CodeGen::CodeGenFunction::EmitOMPParallelMasterDirective(), clang::CodeGen::CodeGenFunction::EmitOMPParallelMasterTaskLoopDirective(), clang::CodeGen::CodeGenFunction::EmitOMPParallelMasterTaskLoopSimdDirective(), clang::CodeGen::CodeGenFunction::EmitOMPParallelSectionsDirective(), emitTargetParallelForRegion(), emitTargetParallelForSimdRegion(), emitTargetParallelGenericLoopRegion(), and emitTargetParallelRegion().

◆ emitCommonOMPTargetDirective()

void emitCommonOMPTargetDirective ( CodeGenFunction & CGF,
const OMPExecutableDirective & S,
const RegionCodeGenTy & CodeGen )
static

Definition at line 6899 of file CGStmtOpenMP.cpp.

References clang::CodeGen::CodeGenFunction::Builder, clang::C, clang::cast(), clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::ConstantFoldsToSimpleInteger(), clang::Ctor_Complete, clang::CodeGen::CodeGenFunction::CurFuncDecl, clang::Device, clang::CodeGen::CGOpenMPRuntime::LastprivateConditionalRAII::disable(), clang::Dtor_Complete, clang::CodeGen::CGOpenMPRuntime::emitInlinedDirective(), clang::CodeGen::CodeGenFunction::EmitScalarExpr(), clang::CodeGen::CodeGenFunction::EmitStmt(), clang::CodeGen::CGOpenMPRuntime::emitTargetCall(), clang::CodeGen::CGOpenMPRuntime::emitTargetOutlinedFunction(), clang::DiagnosticsEngine::Error, clang::DiagnosticsEngine::getCustomDiagID(), clang::CodeGen::CodeGenModule::getDiags(), clang::CodeGen::CodeGenModule::getLangOpts(), clang::CodeGen::CodeGenModule::getMangledName(), clang::CodeGen::CodeGenModule::getOpenMPRuntime(), clang::CodeGen::CodeGenTypeCache::Int64Ty, clang::isOpenMPTargetExecutionDirective(), clang::OMPC_DEVICE_unknown, clang::LangOptions::OMPTargetTriples, and clang::DiagnosticsEngine::Report().

Referenced by clang::CodeGen::CodeGenFunction::EmitOMPTargetDirective(), clang::CodeGen::CodeGenFunction::EmitOMPTargetParallelDirective(), clang::CodeGen::CodeGenFunction::EmitOMPTargetParallelForDirective(), clang::CodeGen::CodeGenFunction::EmitOMPTargetParallelForSimdDirective(), clang::CodeGen::CodeGenFunction::EmitOMPTargetParallelGenericLoopDirective(), clang::CodeGen::CodeGenFunction::EmitOMPTargetSimdDirective(), clang::CodeGen::CodeGenFunction::EmitOMPTargetTeamsDirective(), clang::CodeGen::CodeGenFunction::EmitOMPTargetTeamsDistributeDirective(), clang::CodeGen::CodeGenFunction::EmitOMPTargetTeamsDistributeParallelForDirective(), clang::CodeGen::CodeGenFunction::EmitOMPTargetTeamsDistributeParallelForSimdDirective(), clang::CodeGen::CodeGenFunction::EmitOMPTargetTeamsDistributeSimdDirective(), and clang::CodeGen::CodeGenFunction::EmitOMPTargetTeamsGenericLoopDirective().

◆ emitCommonOMPTeamsDirective()

◆ emitCommonSimdLoop()

◆ emitDispatchForLoopBounds()

std::pair< llvm::Value *, llvm::Value * > emitDispatchForLoopBounds ( CodeGenFunction & CGF,
const OMPExecutableDirective & S,
Address LB,
Address UB )
static

When dealing with dispatch schedules (e.g.

dynamic, guided) we do not consider the lower and upper bound expressions generated by the worksharing loop support, but we use 0 and the iteration space size as constants

Definition at line 3732 of file CGStmtOpenMP.cpp.

References clang::CodeGen::CodeGenFunction::Builder, clang::cast(), clang::CodeGen::CodeGenFunction::EmitScalarExpr(), clang::CodeGen::CodeGenFunction::getContext(), clang::Expr::getType(), and clang::ASTContext::getTypeSize().

Referenced by emitTargetParallelForRegion(), emitTargetParallelForSimdRegion(), emitTargetParallelGenericLoopRegion(), and emitWorksharingDirective().

◆ emitDistributeParallelForDispatchBounds()

std::pair< llvm::Value *, llvm::Value * > emitDistributeParallelForDispatchBounds ( CodeGenFunction & CGF,
const OMPExecutableDirective & S,
Address LB,
Address UB )
static

if the 'for' loop has a dispatch schedule (e.g.

dynamic, guided) then we need to use the LB and UB expressions generated by the worksharing code generation support, whereas in non combined situations we would just emit 0 and the LastIteration expression This function is necessary due to the difference of the LB and UB types for the RT emission routines for 'for_static_init' and 'for_dispatch_init'

Definition at line 3347 of file CGStmtOpenMP.cpp.

References clang::cast(), clang::CodeGen::CodeGenFunction::EmitLoadOfScalar(), and clang::Expr::getType().

Referenced by emitInnerParallelForWhenCombined().

◆ emitDistributeParallelForDistributeInnerBoundParams()

◆ emitDistributeParallelForInnerBounds()

◆ emitEmptyBoundParameters()

◆ emitEmptyOrdered()

void emitEmptyOrdered ( CodeGenFunction & ,
SourceLocation Loc,
const unsigned IVSize,
const bool IVSigned )
static

Definition at line 3238 of file CGStmtOpenMP.cpp.

◆ emitForLoopBounds()

std::pair< LValue, LValue > emitForLoopBounds ( CodeGenFunction & CGF,
const OMPExecutableDirective & S )
static

The following two functions generate expressions for the loop lower and upper bounds in case of static and dynamic (dispatch) schedule of the associated 'for' or 'distribute' loop.

Definition at line 3718 of file CGStmtOpenMP.cpp.

References clang::cast(), and EmitOMPHelperVar().

Referenced by emitTargetParallelForRegion(), emitTargetParallelForSimdRegion(), emitTargetParallelGenericLoopRegion(), and emitWorksharingDirective().

◆ emitInnerParallelForWhenCombined()

◆ emitMasked()

◆ emitMaster()

◆ emitOMPAtomicCaptureExpr()

◆ emitOMPAtomicCompareExpr()

◆ emitOMPAtomicExpr()

void emitOMPAtomicExpr ( CodeGenFunction & CGF,
OpenMPClauseKind Kind,
llvm::AtomicOrdering AO,
llvm::AtomicOrdering FailAO,
bool IsPostfixUpdate,
const Expr * X,
const Expr * V,
const Expr * R,
const Expr * E,
const Expr * UE,
const Expr * D,
const Expr * CE,
bool IsXLHSInRHSPart,
bool IsFailOnly,
SourceLocation Loc )
static

◆ emitOMPAtomicReadExpr()

◆ emitOMPAtomicRMW()

◆ emitOMPAtomicUpdateExpr()

◆ emitOMPAtomicWriteExpr()

◆ emitOMPCopyinClause()

◆ emitOMPDistributeDirective()

◆ emitOMPForDirective()

◆ EmitOMPHelperVar()

◆ emitOMPLoopBodyWithStopPoint()

◆ emitOMPSimdDirective()

◆ emitOMPSimdRegion()

void emitOMPSimdRegion ( CodeGenFunction & CGF,
const OMPLoopDirective & S,
PrePostActionTy & Action )
static

Definition at line 2681 of file CGStmtOpenMP.cpp.

References clang::CodeGen::CGOpenMPRuntime::adjustTargetSpecificDataForLambdas(), clang::cast(), clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::ConstantFoldsToSimpleInteger(), clang::CodeGen::CodeGenFunction::createBasicBlock(), emitAlignedClause(), clang::CodeGen::CodeGenFunction::EmitBlock(), clang::CodeGen::CodeGenFunction::EmitBranch(), emitCommonSimdLoop(), clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(), clang::CodeGen::CodeGenFunction::EmitLValue(), EmitOMPHelperVar(), clang::CodeGen::CodeGenFunction::EmitOMPInnerLoop(), clang::CodeGen::CodeGenFunction::EmitOMPLastprivateClauseFinal(), clang::CodeGen::CodeGenFunction::EmitOMPLastprivateClauseInit(), clang::CodeGen::CodeGenFunction::EmitOMPLinearClause(), clang::CodeGen::CodeGenFunction::EmitOMPLinearClauseFinal(), clang::CodeGen::CodeGenFunction::EmitOMPLinearClauseInit(), clang::CodeGen::CodeGenFunction::EmitOMPPrivateClause(), clang::CodeGen::CodeGenFunction::EmitOMPPrivateLoopCounters(), clang::CodeGen::CodeGenFunction::EmitOMPReductionClauseFinal(), clang::CodeGen::CodeGenFunction::EmitOMPReductionClauseInit(), clang::CodeGen::CodeGenFunction::EmitOMPSimdFinal(), clang::CodeGen::CodeGenFunction::EmitOMPSimdInit(), emitPostUpdateForReductionClause(), emitPreCond(), clang::CodeGen::CodeGenFunction::EmitVarDecl(), clang::CodeGen::PrePostActionTy::Enter(), getEffectiveDirectiveKind(), clang::CodeGen::CodeGenModule::getOpenMPRuntime(), clang::CodeGen::CodeGenFunction::getProfileCount(), clang::CodeGen::CodeGenFunction::incrementProfileCounter(), clang::isOpenMPDistributeDirective(), clang::isOpenMPGenericLoopDirective(), clang::isOpenMPTargetExecutionDirective(), clang::isOpenMPTaskLoopDirective(), clang::isOpenMPWorksharingDirective(), clang::CodeGen::CodeGenFunction::OMPPrivateScope::Privatize(), clang::CodeGen::CodeGenFunction::RunCleanupsScope::requiresCleanups(), and clang::CodeGen::CodeGenFunction::OMPPrivateScope::restoreMap().

Referenced by emitOMPSimdDirective(), clang::CodeGen::CodeGenFunction::EmitOMPTargetSimdDeviceFunction(), clang::CodeGen::CodeGenFunction::EmitOMPTargetSimdDirective(), and clang::CodeGen::CodeGenFunction::EmitSimpleOMPExecutableDirective().

◆ emitOutlinedFunctionPrologue()

llvm::Function * emitOutlinedFunctionPrologue ( CodeGenFunction & CGF,
FunctionArgList & Args,
llvm::MapVector< const Decl *, std::pair< const VarDecl *, Address > > & LocalAddrs,
llvm::DenseMap< const Decl *, std::pair< const Expr *, llvm::Value * > > & VLASizes,
llvm::Value *& CXXThisValue,
const FunctionOptions & FO )
static

Definition at line 484 of file CGStmtOpenMP.cpp.

References clang::CodeGen::CodeGenTypes::arrangeBuiltinFunctionDeclaration(), clang::CodeGen::CodeGenTypes::arrangeDeviceKernelCallerDeclaration(), clang::CapturedStmt::captures(), castValueFromUintptr(), clang::CodeGen::CodeGenFunction::CGM, clang::FunctionDecl::Create(), clang::ImplicitParamDecl::Create(), clang::ParmVarDecl::Create(), clang::CodeGen::Decl, clang::CodeGen::CodeGenFunction::EmitLoadOfPointer(), clang::CodeGen::CodeGenFunction::EmitLoadOfReference(), clang::CodeGen::CodeGenFunction::EmitLoadOfScalar(), clang::RecordDecl::fields(), clang::IdentifierTable::get(), clang::CodeGen::CodeGenFunction::GetAddrOfLocalVar(), clang::CapturedStmt::getBeginLoc(), clang::DeclaratorDecl::getBeginLoc(), clang::Stmt::getBeginLoc(), clang::CapturedDecl::getBody(), getCanonicalParamType(), clang::CapturedStmt::getCapturedDecl(), clang::CapturedStmt::getCapturedRecordDecl(), clang::CodeGen::CodeGenModule::getCodeGenOpts(), clang::CodeGen::CodeGenModule::getContext(), clang::CapturedDecl::getContextParamPosition(), clang::ASTContext::getDeclAlign(), clang::CodeGen::CodeGenTypes::GetFunctionType(), clang::ASTContext::getFunctionType(), clang::NamedDecl::getIdentifier(), clang::Decl::getLocation(), clang::CodeGen::CodeGenModule::getModule(), clang::CodeGen::CodeGenModule::getOpenMPRuntime(), clang::CodeGen::CGOpenMPRuntime::getParameterAddress(), clang::VariableArrayType::getSizeExpr(), clang::VarDecl::getTLSKind(), clang::ASTContext::getTranslationUnitDecl(), clang::ASTContext::getTrivialTypeSourceInfo(), clang::CodeGen::Address::getType(), clang::ValueDecl::getType(), getType(), clang::CodeGen::CodeGenModule::getTypes(), clang::ASTContext::getUIntPtrType(), clang::Decl::hasBody(), clang::ASTContext::Idents, clang::CodeGen::Address::invalid(), clang::CapturedDecl::isNothrow(), clang::Type::isPointerType(), clang::Type::isVariablyModifiedType(), clang::CodeGen::CodeGenFunction::MakeAddrLValue(), clang::Other, clang::CapturedDecl::param_begin(), clang::CapturedDecl::param_end(), clang::SC_None, clang::SC_Static, clang::CodeGen::CodeGenModule::SetInternalFunctionAttributes(), clang::CodeGen::CodeGenFunction::StartFunction(), clang::ThreadPrivateVar, clang::VarDecl::TLS_None, clang::CodeGen::CGOpenMPRuntime::translateParameter(), clang::ASTContext::VoidTy, and clang::CodeGen::Address::withAlignment().

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

◆ emitOutlinedOrderedFunction()

◆ emitPostUpdateForReductionClause()

void emitPostUpdateForReductionClause ( CodeGenFunction & CGF,
const OMPExecutableDirective & D,
const llvm::function_ref< llvm::Value *(CodeGenFunction &)> CondGen )
static

◆ emitPreCond()

◆ emitRestoreIP()

◆ emitScanBasedDirective()

void emitScanBasedDirective ( CodeGenFunction & CGF,
const OMPLoopDirective & S,
llvm::function_ref< llvm::Value *(CodeGenFunction &)> NumIteratorsGen,
llvm::function_ref< void(CodeGenFunction &)> FirstGen,
llvm::function_ref< void(CodeGenFunction &)> SecondGen )
static

Emits the code for the directive with inscan reductions.

The code is the following:

#pragma omp ...
for (i: 0..<num_iters>) {
<input phase>;
buffer[i] = red;
}
#pragma omp master // in parallel region
for (int k = 0; k != ceil(log2(num_iters)); ++k)
for (size cnt = last_iter; cnt >= pow(2, k); --k)
buffer[i] op= buffer[i-pow(2,k)];
#pragma omp barrier // in parallel region
#pragma omp ...
for (0..<num_iters>) {
red = InclusiveScan ? buffer[i] : buffer[i-1];
<scan phase>;
}
#define log2(__x)
Definition tgmath.h:970
#define pow(__x, __y)
Definition tgmath.h:490
#define ceil(__x)
Definition tgmath.h:601

Definition at line 3865 of file CGStmtOpenMP.cpp.

References clang::CodeGen::CodeGenFunction::OMPPrivateScope::addPrivate(), clang::CodeGen::CodeGenFunction::Builder, clang::C, clang::cast(), clang::CodeGen::ApplyDebugLocation::CreateDefaultArtificial(), clang::CodeGen::RValue::get(), clang::CodeGen::Address::invalid(), Next, clang::CodeGen::CodeGenFunction::OMPFirstScanLoop, clang::CodeGen::CodeGenFunction::OMPPrivateScope::Privatize(), and clang::CodeGen::CodeGenTypeCache::SizeTy.

Referenced by emitWorksharingDirective().

◆ emitScanBasedDirectiveDecls()

void emitScanBasedDirectiveDecls ( CodeGenFunction & CGF,
const OMPLoopDirective & S,
llvm::function_ref< llvm::Value *(CodeGenFunction &)> NumIteratorsGen )
static

◆ emitScanBasedDirectiveFinals()

void emitScanBasedDirectiveFinals ( CodeGenFunction & CGF,
const OMPLoopDirective & S,
llvm::function_ref< llvm::Value *(CodeGenFunction &)> NumIteratorsGen )
static

◆ emitSimdlenSafelenClause()

◆ emitSimpleAtomicLoad()

RValue emitSimpleAtomicLoad ( CodeGenFunction & CGF,
llvm::AtomicOrdering AO,
LValue LVal,
SourceLocation Loc )
static

◆ emitSimpleAtomicStore()

void emitSimpleAtomicStore ( CodeGenFunction & CGF,
llvm::AtomicOrdering AO,
LValue LVal,
RValue RVal )
static

◆ emitTargetParallelForRegion()

◆ emitTargetParallelForSimdRegion()

◆ emitTargetParallelGenericLoopRegion()

◆ emitTargetParallelRegion()

◆ emitTargetRegion()

◆ emitTargetTeamsDistributeParallelForRegion()

◆ emitTargetTeamsDistributeParallelForSimdRegion()

◆ emitTargetTeamsDistributeRegion()

◆ emitTargetTeamsDistributeSimdRegion()

◆ emitTargetTeamsGenericLoopRegionAsDistribute()

◆ emitTargetTeamsGenericLoopRegionAsParallel()

◆ emitTargetTeamsLoopCodegenStatus()

◆ emitTargetTeamsRegion()

◆ emitWorksharingDirective()

◆ GetAlignedMapping()

◆ getBaseDecl()

const VarDecl * getBaseDecl ( const Expr * Ref)
static

Definition at line 7560 of file CGStmtOpenMP.cpp.

References clang::cast(), and clang::Expr::IgnoreParenImpCasts().

◆ getCanonicalParamType()

QualType getCanonicalParamType ( ASTContext & C,
QualType T )
static

Definition at line 443 of file CGStmtOpenMP.cpp.

References clang::C, getCanonicalParamType(), and clang::T.

Referenced by emitOutlinedFunctionPrologue(), and getCanonicalParamType().

◆ getEffectiveDirectiveKind()

◆ hasOrderedDirective()

◆ isAllocatableDecl()

bool isAllocatableDecl ( const VarDecl * VD)
static

◆ isForSupportedByOpenMPIRBuilder()

bool isForSupportedByOpenMPIRBuilder ( const OMPLoopDirective & S,
bool HasCancel )
static

◆ isSimdSupportedByOpenMPIRBuilder()

bool isSimdSupportedByOpenMPIRBuilder ( const OMPLoopDirective & S)
static

◆ isSupportedByOpenMPIRBuilder()

bool isSupportedByOpenMPIRBuilder ( const OMPTaskgroupDirective & T)
static

Definition at line 5589 of file CGStmtOpenMP.cpp.

References clang::T.

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

◆ mapParam()