summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaOpenMP.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Sema/SemaOpenMP.cpp')
-rw-r--r--clang/lib/Sema/SemaOpenMP.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index fee9b1d2ce4..63b64801fe3 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -699,6 +699,10 @@ StmtResult Sema::ActOnOpenMPExecutableDirective(OpenMPDirectiveKind Kind,
Res = ActOnOpenMPParallelDirective(ClausesWithImplicit, AStmt,
StartLoc, EndLoc);
break;
+ case OMPD_simd:
+ Res = ActOnOpenMPSimdDirective(ClausesWithImplicit, AStmt,
+ StartLoc, EndLoc);
+ break;
case OMPD_threadprivate:
case OMPD_task:
llvm_unreachable("OpenMP Directive is not allowed");
@@ -721,6 +725,29 @@ StmtResult Sema::ActOnOpenMPParallelDirective(ArrayRef<OMPClause *> Clauses,
Clauses, AStmt));
}
+StmtResult Sema::ActOnOpenMPSimdDirective(ArrayRef<OMPClause *> Clauses,
+ Stmt *AStmt,
+ SourceLocation StartLoc,
+ SourceLocation EndLoc) {
+ Stmt *CStmt = AStmt;
+ while (CapturedStmt *CS = dyn_cast_or_null<CapturedStmt>(CStmt))
+ CStmt = CS->getCapturedStmt();
+ while (AttributedStmt *AS = dyn_cast_or_null<AttributedStmt>(CStmt))
+ CStmt = AS->getSubStmt();
+ ForStmt *For = dyn_cast<ForStmt>(CStmt);
+ if (!For) {
+ Diag(CStmt->getLocStart(), diag::err_omp_not_for)
+ << getOpenMPDirectiveName(OMPD_simd);
+ return StmtError();
+ }
+
+ // FIXME: Checking loop canonical form, collapsing etc.
+
+ getCurFunction()->setHasBranchProtectedScope();
+ return Owned(OMPSimdDirective::Create(Context, StartLoc, EndLoc,
+ Clauses, AStmt));
+}
+
OMPClause *Sema::ActOnOpenMPSingleExprClause(OpenMPClauseKind Kind,
Expr *Expr,
SourceLocation StartLoc,
OpenPOWER on IntegriCloud