diff options
author | Arpith Chacko Jacob <acjacob@us.ibm.com> | 2016-01-26 18:48:41 +0000 |
---|---|---|
committer | Arpith Chacko Jacob <acjacob@us.ibm.com> | 2016-01-26 18:48:41 +0000 |
commit | e955b3d3fe12a05e7639aa336d6945fa9427c0dc (patch) | |
tree | 3423de8c95bccda8edcb7065c05cd525a8acc621 /clang/lib/AST | |
parent | 6ac3f739ca4cd90b41388cc50070a6bca85b6842 (diff) | |
download | bcm5719-llvm-e955b3d3fe12a05e7639aa336d6945fa9427c0dc.tar.gz bcm5719-llvm-e955b3d3fe12a05e7639aa336d6945fa9427c0dc.zip |
[OpenMP] Parsing + sema for target parallel directive.
Summary:
This patch adds parsing + sema for the target parallel directive and its clauses along with testcases.
Reviewers: ABataev
Differential Revision: http://reviews.llvm.org/D16553
Rebased to current trunk and updated test cases.
llvm-svn: 258832
Diffstat (limited to 'clang/lib/AST')
-rw-r--r-- | clang/lib/AST/StmtOpenMP.cpp | 24 | ||||
-rw-r--r-- | clang/lib/AST/StmtPrinter.cpp | 6 | ||||
-rw-r--r-- | clang/lib/AST/StmtProfile.cpp | 5 |
3 files changed, 35 insertions, 0 deletions
diff --git a/clang/lib/AST/StmtOpenMP.cpp b/clang/lib/AST/StmtOpenMP.cpp index 4ac2ca2abd0..ba0b93c78a0 100644 --- a/clang/lib/AST/StmtOpenMP.cpp +++ b/clang/lib/AST/StmtOpenMP.cpp @@ -694,6 +694,30 @@ OMPTargetDirective *OMPTargetDirective::CreateEmpty(const ASTContext &C, return new (Mem) OMPTargetDirective(NumClauses); } +OMPTargetParallelDirective *OMPTargetParallelDirective::Create( + const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, + ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) { + unsigned Size = llvm::alignTo(sizeof(OMPTargetParallelDirective), + llvm::alignOf<OMPClause *>()); + void *Mem = + C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *)); + OMPTargetParallelDirective *Dir = + new (Mem) OMPTargetParallelDirective(StartLoc, EndLoc, Clauses.size()); + Dir->setClauses(Clauses); + Dir->setAssociatedStmt(AssociatedStmt); + return Dir; +} + +OMPTargetParallelDirective * +OMPTargetParallelDirective::CreateEmpty(const ASTContext &C, + unsigned NumClauses, EmptyShell) { + unsigned Size = llvm::alignTo(sizeof(OMPTargetParallelDirective), + llvm::alignOf<OMPClause *>()); + void *Mem = + C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *)); + return new (Mem) OMPTargetParallelDirective(NumClauses); +} + OMPTargetDataDirective *OMPTargetDataDirective::Create( const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) { diff --git a/clang/lib/AST/StmtPrinter.cpp b/clang/lib/AST/StmtPrinter.cpp index d8f6fdb8632..7cc597dabe8 100644 --- a/clang/lib/AST/StmtPrinter.cpp +++ b/clang/lib/AST/StmtPrinter.cpp @@ -1083,6 +1083,12 @@ void StmtPrinter::VisitOMPTargetExitDataDirective( PrintOMPExecutableDirective(Node); } +void StmtPrinter::VisitOMPTargetParallelDirective( + OMPTargetParallelDirective *Node) { + Indent() << "#pragma omp target parallel "; + PrintOMPExecutableDirective(Node); +} + void StmtPrinter::VisitOMPTeamsDirective(OMPTeamsDirective *Node) { Indent() << "#pragma omp teams "; PrintOMPExecutableDirective(Node); diff --git a/clang/lib/AST/StmtProfile.cpp b/clang/lib/AST/StmtProfile.cpp index 0ddb928da27..f490a2aba33 100644 --- a/clang/lib/AST/StmtProfile.cpp +++ b/clang/lib/AST/StmtProfile.cpp @@ -594,6 +594,11 @@ void StmtProfiler::VisitOMPTargetExitDataDirective( VisitOMPExecutableDirective(S); } +void StmtProfiler::VisitOMPTargetParallelDirective( + const OMPTargetParallelDirective *S) { + VisitOMPExecutableDirective(S); +} + void StmtProfiler::VisitOMPTeamsDirective(const OMPTeamsDirective *S) { VisitOMPExecutableDirective(S); } |