Changeset View
Changeset View
Standalone View
Standalone View
clang/lib/CodeGen/CGStmtOpenMP.cpp
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 1,551 Lines • ▼ Show 20 Lines | CGF.CGM.getOpenMPRuntime().checkAndEmitSharedLastprivateConditional( | ||||
CGF, S, PrivateDecls); | CGF, S, PrivateDecls); | ||||
} | } | ||||
static void emitCommonOMPParallelDirective( | static void emitCommonOMPParallelDirective( | ||||
CodeGenFunction &CGF, const OMPExecutableDirective &S, | CodeGenFunction &CGF, const OMPExecutableDirective &S, | ||||
OpenMPDirectiveKind InnermostKind, const RegionCodeGenTy &CodeGen, | OpenMPDirectiveKind InnermostKind, const RegionCodeGenTy &CodeGen, | ||||
const CodeGenBoundParametersTy &CodeGenBoundParameters) { | const CodeGenBoundParametersTy &CodeGenBoundParameters) { | ||||
const CapturedStmt *CS = S.getCapturedStmt(OMPD_parallel); | const CapturedStmt *CS = S.getCapturedStmt(OMPD_parallel); | ||||
llvm::Value *NumThreads = nullptr; | |||||
llvm::Function *OutlinedFn = | llvm::Function *OutlinedFn = | ||||
CGF.CGM.getOpenMPRuntime().emitParallelOutlinedFunction( | CGF.CGM.getOpenMPRuntime().emitParallelOutlinedFunction( | ||||
S, *CS->getCapturedDecl()->param_begin(), InnermostKind, CodeGen); | S, *CS->getCapturedDecl()->param_begin(), InnermostKind, CodeGen); | ||||
if (const auto *NumThreadsClause = S.getSingleClause<OMPNumThreadsClause>()) { | if (const auto *NumThreadsClause = S.getSingleClause<OMPNumThreadsClause>()) { | ||||
CodeGenFunction::RunCleanupsScope NumThreadsScope(CGF); | CodeGenFunction::RunCleanupsScope NumThreadsScope(CGF); | ||||
llvm::Value *NumThreads = | NumThreads = CGF.EmitScalarExpr(NumThreadsClause->getNumThreads(), | ||||
CGF.EmitScalarExpr(NumThreadsClause->getNumThreads(), | |||||
/*IgnoreResultAssign=*/true); | /*IgnoreResultAssign=*/true); | ||||
CGF.CGM.getOpenMPRuntime().emitNumThreadsClause( | CGF.CGM.getOpenMPRuntime().emitNumThreadsClause( | ||||
CGF, NumThreads, NumThreadsClause->getBeginLoc()); | CGF, NumThreads, NumThreadsClause->getBeginLoc()); | ||||
} | } | ||||
if (const auto *ProcBindClause = S.getSingleClause<OMPProcBindClause>()) { | if (const auto *ProcBindClause = S.getSingleClause<OMPProcBindClause>()) { | ||||
CodeGenFunction::RunCleanupsScope ProcBindScope(CGF); | CodeGenFunction::RunCleanupsScope ProcBindScope(CGF); | ||||
CGF.CGM.getOpenMPRuntime().emitProcBindClause( | CGF.CGM.getOpenMPRuntime().emitProcBindClause( | ||||
CGF, ProcBindClause->getProcBindKind(), ProcBindClause->getBeginLoc()); | CGF, ProcBindClause->getProcBindKind(), ProcBindClause->getBeginLoc()); | ||||
} | } | ||||
Show All 10 Lines | static void emitCommonOMPParallelDirective( | ||||
llvm::SmallVector<llvm::Value *, 16> CapturedVars; | llvm::SmallVector<llvm::Value *, 16> CapturedVars; | ||||
// Combining 'distribute' with 'for' requires sharing each 'distribute' chunk | // Combining 'distribute' with 'for' requires sharing each 'distribute' chunk | ||||
// lower and upper bounds with the pragma 'for' chunking mechanism. | // lower and upper bounds with the pragma 'for' chunking mechanism. | ||||
// The following lambda takes care of appending the lower and upper bound | // The following lambda takes care of appending the lower and upper bound | ||||
// parameters when necessary | // parameters when necessary | ||||
CodeGenBoundParameters(CGF, S, CapturedVars); | CodeGenBoundParameters(CGF, S, CapturedVars); | ||||
CGF.GenerateOpenMPCapturedVars(*CS, CapturedVars); | CGF.GenerateOpenMPCapturedVars(*CS, CapturedVars); | ||||
CGF.CGM.getOpenMPRuntime().emitParallelCall(CGF, S.getBeginLoc(), OutlinedFn, | CGF.CGM.getOpenMPRuntime().emitParallelCall(CGF, S.getBeginLoc(), OutlinedFn, | ||||
CapturedVars, IfCond); | CapturedVars, IfCond, NumThreads); | ||||
} | } | ||||
static bool isAllocatableDecl(const VarDecl *VD) { | static bool isAllocatableDecl(const VarDecl *VD) { | ||||
const VarDecl *CVD = VD->getCanonicalDecl(); | const VarDecl *CVD = VD->getCanonicalDecl(); | ||||
if (!CVD->hasAttr<OMPAllocateDeclAttr>()) | if (!CVD->hasAttr<OMPAllocateDeclAttr>()) | ||||
return false; | return false; | ||||
const auto *AA = CVD->getAttr<OMPAllocateDeclAttr>(); | const auto *AA = CVD->getAttr<OMPAllocateDeclAttr>(); | ||||
// Use the default allocation. | // Use the default allocation. | ||||
▲ Show 20 Lines • Show All 5,746 Lines • Show Last 20 Lines |