|
@@ -2500,9 +2500,8 @@ StmtResult Sema::ActOnOpenMPExecutableDirective(
|
|
Res = ActOnOpenMPTaskwaitDirective(StartLoc, EndLoc);
|
|
Res = ActOnOpenMPTaskwaitDirective(StartLoc, EndLoc);
|
|
break;
|
|
break;
|
|
case OMPD_taskgroup:
|
|
case OMPD_taskgroup:
|
|
- assert(ClausesWithImplicit.empty() &&
|
|
|
|
- "No clauses are allowed for 'omp taskgroup' directive");
|
|
|
|
- Res = ActOnOpenMPTaskgroupDirective(AStmt, StartLoc, EndLoc);
|
|
|
|
|
|
+ Res = ActOnOpenMPTaskgroupDirective(ClausesWithImplicit, AStmt, StartLoc,
|
|
|
|
+ EndLoc);
|
|
break;
|
|
break;
|
|
case OMPD_flush:
|
|
case OMPD_flush:
|
|
assert(AStmt == nullptr &&
|
|
assert(AStmt == nullptr &&
|
|
@@ -5069,7 +5068,8 @@ StmtResult Sema::ActOnOpenMPTaskwaitDirective(SourceLocation StartLoc,
|
|
return OMPTaskwaitDirective::Create(Context, StartLoc, EndLoc);
|
|
return OMPTaskwaitDirective::Create(Context, StartLoc, EndLoc);
|
|
}
|
|
}
|
|
|
|
|
|
-StmtResult Sema::ActOnOpenMPTaskgroupDirective(Stmt *AStmt,
|
|
|
|
|
|
+StmtResult Sema::ActOnOpenMPTaskgroupDirective(ArrayRef<OMPClause *> Clauses,
|
|
|
|
+ Stmt *AStmt,
|
|
SourceLocation StartLoc,
|
|
SourceLocation StartLoc,
|
|
SourceLocation EndLoc) {
|
|
SourceLocation EndLoc) {
|
|
if (!AStmt)
|
|
if (!AStmt)
|
|
@@ -5079,7 +5079,8 @@ StmtResult Sema::ActOnOpenMPTaskgroupDirective(Stmt *AStmt,
|
|
|
|
|
|
getCurFunction()->setHasBranchProtectedScope();
|
|
getCurFunction()->setHasBranchProtectedScope();
|
|
|
|
|
|
- return OMPTaskgroupDirective::Create(Context, StartLoc, EndLoc, AStmt);
|
|
|
|
|
|
+ return OMPTaskgroupDirective::Create(Context, StartLoc, EndLoc, Clauses,
|
|
|
|
+ AStmt);
|
|
}
|
|
}
|
|
|
|
|
|
StmtResult Sema::ActOnOpenMPFlushDirective(ArrayRef<OMPClause *> Clauses,
|
|
StmtResult Sema::ActOnOpenMPFlushDirective(ArrayRef<OMPClause *> Clauses,
|
|
@@ -6851,6 +6852,7 @@ OMPClause *Sema::ActOnOpenMPSingleExprClause(OpenMPClauseKind Kind, Expr *Expr,
|
|
case OMPC_lastprivate:
|
|
case OMPC_lastprivate:
|
|
case OMPC_shared:
|
|
case OMPC_shared:
|
|
case OMPC_reduction:
|
|
case OMPC_reduction:
|
|
|
|
+ case OMPC_task_reduction:
|
|
case OMPC_linear:
|
|
case OMPC_linear:
|
|
case OMPC_aligned:
|
|
case OMPC_aligned:
|
|
case OMPC_copyin:
|
|
case OMPC_copyin:
|
|
@@ -7154,6 +7156,7 @@ static OpenMPDirectiveKind getOpenMPCaptureRegionForClause(
|
|
case OMPC_firstprivate:
|
|
case OMPC_firstprivate:
|
|
case OMPC_lastprivate:
|
|
case OMPC_lastprivate:
|
|
case OMPC_reduction:
|
|
case OMPC_reduction:
|
|
|
|
+ case OMPC_task_reduction:
|
|
case OMPC_linear:
|
|
case OMPC_linear:
|
|
case OMPC_default:
|
|
case OMPC_default:
|
|
case OMPC_proc_bind:
|
|
case OMPC_proc_bind:
|
|
@@ -7469,6 +7472,7 @@ OMPClause *Sema::ActOnOpenMPSimpleClause(
|
|
case OMPC_lastprivate:
|
|
case OMPC_lastprivate:
|
|
case OMPC_shared:
|
|
case OMPC_shared:
|
|
case OMPC_reduction:
|
|
case OMPC_reduction:
|
|
|
|
+ case OMPC_task_reduction:
|
|
case OMPC_linear:
|
|
case OMPC_linear:
|
|
case OMPC_aligned:
|
|
case OMPC_aligned:
|
|
case OMPC_copyin:
|
|
case OMPC_copyin:
|
|
@@ -7626,6 +7630,7 @@ OMPClause *Sema::ActOnOpenMPSingleExprWithArgClause(
|
|
case OMPC_lastprivate:
|
|
case OMPC_lastprivate:
|
|
case OMPC_shared:
|
|
case OMPC_shared:
|
|
case OMPC_reduction:
|
|
case OMPC_reduction:
|
|
|
|
+ case OMPC_task_reduction:
|
|
case OMPC_linear:
|
|
case OMPC_linear:
|
|
case OMPC_aligned:
|
|
case OMPC_aligned:
|
|
case OMPC_copyin:
|
|
case OMPC_copyin:
|
|
@@ -7823,6 +7828,7 @@ OMPClause *Sema::ActOnOpenMPClause(OpenMPClauseKind Kind,
|
|
case OMPC_lastprivate:
|
|
case OMPC_lastprivate:
|
|
case OMPC_shared:
|
|
case OMPC_shared:
|
|
case OMPC_reduction:
|
|
case OMPC_reduction:
|
|
|
|
+ case OMPC_task_reduction:
|
|
case OMPC_linear:
|
|
case OMPC_linear:
|
|
case OMPC_aligned:
|
|
case OMPC_aligned:
|
|
case OMPC_copyin:
|
|
case OMPC_copyin:
|
|
@@ -7935,6 +7941,11 @@ OMPClause *Sema::ActOnOpenMPVarListClause(
|
|
Res = ActOnOpenMPReductionClause(VarList, StartLoc, LParenLoc, ColonLoc,
|
|
Res = ActOnOpenMPReductionClause(VarList, StartLoc, LParenLoc, ColonLoc,
|
|
EndLoc, ReductionIdScopeSpec, ReductionId);
|
|
EndLoc, ReductionIdScopeSpec, ReductionId);
|
|
break;
|
|
break;
|
|
|
|
+ case OMPC_task_reduction:
|
|
|
|
+ Res = ActOnOpenMPTaskReductionClause(VarList, StartLoc, LParenLoc, ColonLoc,
|
|
|
|
+ EndLoc, ReductionIdScopeSpec,
|
|
|
|
+ ReductionId);
|
|
|
|
+ break;
|
|
case OMPC_linear:
|
|
case OMPC_linear:
|
|
Res = ActOnOpenMPLinearClause(VarList, TailExpr, StartLoc, LParenLoc,
|
|
Res = ActOnOpenMPLinearClause(VarList, TailExpr, StartLoc, LParenLoc,
|
|
LinKind, DepLinMapLoc, ColonLoc, EndLoc);
|
|
LinKind, DepLinMapLoc, ColonLoc, EndLoc);
|
|
@@ -8953,10 +8964,10 @@ struct ReductionData {
|
|
} // namespace
|
|
} // namespace
|
|
|
|
|
|
static bool ActOnOMPReductionKindClause(
|
|
static bool ActOnOMPReductionKindClause(
|
|
- Sema &S, DSAStackTy *Stack, ArrayRef<Expr *> VarList,
|
|
|
|
- SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc,
|
|
|
|
- SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec,
|
|
|
|
- const DeclarationNameInfo &ReductionId,
|
|
|
|
|
|
+ Sema &S, DSAStackTy *Stack, OpenMPClauseKind ClauseKind,
|
|
|
|
+ ArrayRef<Expr *> VarList, SourceLocation StartLoc, SourceLocation LParenLoc,
|
|
|
|
+ SourceLocation ColonLoc, SourceLocation EndLoc,
|
|
|
|
+ CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId,
|
|
ArrayRef<Expr *> UnresolvedReductions, ReductionData &RD) {
|
|
ArrayRef<Expr *> UnresolvedReductions, ReductionData &RD) {
|
|
auto DN = ReductionId.getName();
|
|
auto DN = ReductionId.getName();
|
|
auto OOK = DN.getCXXOverloadedOperator();
|
|
auto OOK = DN.getCXXOverloadedOperator();
|
|
@@ -9111,8 +9122,7 @@ static bool ActOnOMPReductionKindClause(
|
|
// A list item that appears in a reduction clause must not be
|
|
// A list item that appears in a reduction clause must not be
|
|
// const-qualified.
|
|
// const-qualified.
|
|
if (Type.getNonReferenceType().isConstant(Context)) {
|
|
if (Type.getNonReferenceType().isConstant(Context)) {
|
|
- S.Diag(ELoc, diag::err_omp_const_reduction_list_item)
|
|
|
|
- << getOpenMPClauseName(OMPC_reduction) << Type << ERange;
|
|
|
|
|
|
+ S.Diag(ELoc, diag::err_omp_const_reduction_list_item) << ERange;
|
|
if (!ASE && !OASE) {
|
|
if (!ASE && !OASE) {
|
|
bool IsDecl = !VD || VD->isThisDeclarationADefinition(Context) ==
|
|
bool IsDecl = !VD || VD->isThisDeclarationADefinition(Context) ==
|
|
VarDecl::DeclarationOnly;
|
|
VarDecl::DeclarationOnly;
|
|
@@ -9130,7 +9140,8 @@ static bool ActOnOMPReductionKindClause(
|
|
if (VD->getType()->isReferenceType() && VDDef && VDDef->hasInit()) {
|
|
if (VD->getType()->isReferenceType() && VDDef && VDDef->hasInit()) {
|
|
DSARefChecker Check(Stack);
|
|
DSARefChecker Check(Stack);
|
|
if (Check.Visit(VDDef->getInit())) {
|
|
if (Check.Visit(VDDef->getInit())) {
|
|
- S.Diag(ELoc, diag::err_omp_reduction_ref_type_arg) << ERange;
|
|
|
|
|
|
+ S.Diag(ELoc, diag::err_omp_reduction_ref_type_arg)
|
|
|
|
+ << getOpenMPClauseName(ClauseKind) << ERange;
|
|
S.Diag(VDDef->getLocation(), diag::note_defined_here) << VDDef;
|
|
S.Diag(VDDef->getLocation(), diag::note_defined_here) << VDDef;
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
@@ -9152,7 +9163,7 @@ static bool ActOnOMPReductionKindClause(
|
|
DVar = Stack->getTopDSA(D, false);
|
|
DVar = Stack->getTopDSA(D, false);
|
|
if (DVar.CKind == OMPC_reduction) {
|
|
if (DVar.CKind == OMPC_reduction) {
|
|
S.Diag(ELoc, diag::err_omp_once_referenced)
|
|
S.Diag(ELoc, diag::err_omp_once_referenced)
|
|
- << getOpenMPClauseName(OMPC_reduction);
|
|
|
|
|
|
+ << getOpenMPClauseName(ClauseKind);
|
|
if (DVar.RefExpr)
|
|
if (DVar.RefExpr)
|
|
S.Diag(DVar.RefExpr->getExprLoc(), diag::note_omp_referenced);
|
|
S.Diag(DVar.RefExpr->getExprLoc(), diag::note_omp_referenced);
|
|
} else if (DVar.CKind != OMPC_unknown) {
|
|
} else if (DVar.CKind != OMPC_unknown) {
|
|
@@ -9216,7 +9227,7 @@ static bool ActOnOMPReductionKindClause(
|
|
!(Type->isScalarType() ||
|
|
!(Type->isScalarType() ||
|
|
(S.getLangOpts().CPlusPlus && Type->isArithmeticType()))) {
|
|
(S.getLangOpts().CPlusPlus && Type->isArithmeticType()))) {
|
|
S.Diag(ELoc, diag::err_omp_clause_not_arithmetic_type_arg)
|
|
S.Diag(ELoc, diag::err_omp_clause_not_arithmetic_type_arg)
|
|
- << S.getLangOpts().CPlusPlus;
|
|
|
|
|
|
+ << getOpenMPClauseName(ClauseKind) << S.getLangOpts().CPlusPlus;
|
|
if (!ASE && !OASE) {
|
|
if (!ASE && !OASE) {
|
|
bool IsDecl = !VD || VD->isThisDeclarationADefinition(Context) ==
|
|
bool IsDecl = !VD || VD->isThisDeclarationADefinition(Context) ==
|
|
VarDecl::DeclarationOnly;
|
|
VarDecl::DeclarationOnly;
|
|
@@ -9228,7 +9239,8 @@ static bool ActOnOMPReductionKindClause(
|
|
}
|
|
}
|
|
if ((BOK == BO_OrAssign || BOK == BO_AndAssign || BOK == BO_XorAssign) &&
|
|
if ((BOK == BO_OrAssign || BOK == BO_AndAssign || BOK == BO_XorAssign) &&
|
|
!S.getLangOpts().CPlusPlus && Type->isFloatingType()) {
|
|
!S.getLangOpts().CPlusPlus && Type->isFloatingType()) {
|
|
- S.Diag(ELoc, diag::err_omp_clause_floating_type_arg);
|
|
|
|
|
|
+ S.Diag(ELoc, diag::err_omp_clause_floating_type_arg)
|
|
|
|
+ << getOpenMPClauseName(ClauseKind);
|
|
if (!ASE && !OASE) {
|
|
if (!ASE && !OASE) {
|
|
bool IsDecl = !VD || VD->isThisDeclarationADefinition(Context) ==
|
|
bool IsDecl = !VD || VD->isThisDeclarationADefinition(Context) ==
|
|
VarDecl::DeclarationOnly;
|
|
VarDecl::DeclarationOnly;
|
|
@@ -9481,6 +9493,8 @@ static bool ActOnOMPReductionKindClause(
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ // All reduction items are still marked as reduction (to do not increase
|
|
|
|
+ // code base size).
|
|
Stack->addDSA(D, RefExpr->IgnoreParens(), OMPC_reduction, Ref);
|
|
Stack->addDSA(D, RefExpr->IgnoreParens(), OMPC_reduction, Ref);
|
|
RD.push(VarsExpr, PrivateDRE, LHSDRE, RHSDRE, ReductionOp.get());
|
|
RD.push(VarsExpr, PrivateDRE, LHSDRE, RHSDRE, ReductionOp.get());
|
|
}
|
|
}
|
|
@@ -9494,9 +9508,10 @@ OMPClause *Sema::ActOnOpenMPReductionClause(
|
|
ArrayRef<Expr *> UnresolvedReductions) {
|
|
ArrayRef<Expr *> UnresolvedReductions) {
|
|
ReductionData RD(VarList.size());
|
|
ReductionData RD(VarList.size());
|
|
|
|
|
|
- if (ActOnOMPReductionKindClause(*this, DSAStack, VarList, StartLoc, LParenLoc,
|
|
|
|
- ColonLoc, EndLoc, ReductionIdScopeSpec,
|
|
|
|
- ReductionId, UnresolvedReductions, RD))
|
|
|
|
|
|
+ if (ActOnOMPReductionKindClause(*this, DSAStack, OMPC_reduction, VarList,
|
|
|
|
+ StartLoc, LParenLoc, ColonLoc, EndLoc,
|
|
|
|
+ ReductionIdScopeSpec, ReductionId,
|
|
|
|
+ UnresolvedReductions, RD))
|
|
return nullptr;
|
|
return nullptr;
|
|
|
|
|
|
return OMPReductionClause::Create(
|
|
return OMPReductionClause::Create(
|
|
@@ -9507,6 +9522,27 @@ OMPClause *Sema::ActOnOpenMPReductionClause(
|
|
buildPostUpdate(*this, RD.ExprPostUpdates));
|
|
buildPostUpdate(*this, RD.ExprPostUpdates));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+OMPClause *Sema::ActOnOpenMPTaskReductionClause(
|
|
|
|
+ ArrayRef<Expr *> VarList, SourceLocation StartLoc, SourceLocation LParenLoc,
|
|
|
|
+ SourceLocation ColonLoc, SourceLocation EndLoc,
|
|
|
|
+ CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId,
|
|
|
|
+ ArrayRef<Expr *> UnresolvedReductions) {
|
|
|
|
+ ReductionData RD(VarList.size());
|
|
|
|
+
|
|
|
|
+ if (ActOnOMPReductionKindClause(*this, DSAStack, OMPC_task_reduction,
|
|
|
|
+ VarList, StartLoc, LParenLoc, ColonLoc,
|
|
|
|
+ EndLoc, ReductionIdScopeSpec, ReductionId,
|
|
|
|
+ UnresolvedReductions, RD))
|
|
|
|
+ return nullptr;
|
|
|
|
+
|
|
|
|
+ return OMPTaskReductionClause::Create(
|
|
|
|
+ Context, StartLoc, LParenLoc, ColonLoc, EndLoc, RD.Vars,
|
|
|
|
+ ReductionIdScopeSpec.getWithLocInContext(Context), ReductionId,
|
|
|
|
+ RD.Privates, RD.LHSs, RD.RHSs, RD.ReductionOps,
|
|
|
|
+ buildPreInits(Context, RD.ExprCaptures),
|
|
|
|
+ buildPostUpdate(*this, RD.ExprPostUpdates));
|
|
|
|
+}
|
|
|
|
+
|
|
bool Sema::CheckOpenMPLinearModifier(OpenMPLinearClauseKind LinKind,
|
|
bool Sema::CheckOpenMPLinearModifier(OpenMPLinearClauseKind LinKind,
|
|
SourceLocation LinLoc) {
|
|
SourceLocation LinLoc) {
|
|
if ((!LangOpts.CPlusPlus && LinKind != OMPC_LINEAR_val) ||
|
|
if ((!LangOpts.CPlusPlus && LinKind != OMPC_LINEAR_val) ||
|