diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2014-07-07 13:01:15 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2014-07-07 13:01:15 +0000 |
commit | 4acb859fbdad4b5bc9208d3bfaea6847a682e26f (patch) | |
tree | 9e7b794b1f6f141bc4141dbb84cc0d9a1a9e830a /clang/lib/AST | |
parent | 8a8b850c98f392ec21d5b1e99338e0145d57fe69 (diff) | |
download | bcm5719-llvm-4acb859fbdad4b5bc9208d3bfaea6847a682e26f.tar.gz bcm5719-llvm-4acb859fbdad4b5bc9208d3bfaea6847a682e26f.zip |
[OPENMP] Added initial support for 'omp parallel for'.
llvm-svn: 212453
Diffstat (limited to 'clang/lib/AST')
-rw-r--r-- | clang/lib/AST/Stmt.cpp | 26 | ||||
-rw-r--r-- | clang/lib/AST/StmtPrinter.cpp | 5 | ||||
-rw-r--r-- | clang/lib/AST/StmtProfile.cpp | 5 |
3 files changed, 36 insertions, 0 deletions
diff --git a/clang/lib/AST/Stmt.cpp b/clang/lib/AST/Stmt.cpp index 102d14b475b..16e7d3c73f1 100644 --- a/clang/lib/AST/Stmt.cpp +++ b/clang/lib/AST/Stmt.cpp @@ -1478,3 +1478,29 @@ OMPSingleDirective *OMPSingleDirective::CreateEmpty(const ASTContext &C, return new (Mem) OMPSingleDirective(NumClauses); } +OMPParallelForDirective * +OMPParallelForDirective::Create(const ASTContext &C, SourceLocation StartLoc, + SourceLocation EndLoc, unsigned CollapsedNum, + ArrayRef<OMPClause *> Clauses, + Stmt *AssociatedStmt) { + unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPParallelForDirective), + llvm::alignOf<OMPClause *>()); + void *Mem = + C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *)); + OMPParallelForDirective *Dir = new (Mem) + OMPParallelForDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size()); + Dir->setClauses(Clauses); + Dir->setAssociatedStmt(AssociatedStmt); + return Dir; +} + +OMPParallelForDirective * +OMPParallelForDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses, + unsigned CollapsedNum, EmptyShell) { + unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPParallelForDirective), + llvm::alignOf<OMPClause *>()); + void *Mem = + C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *)); + return new (Mem) OMPParallelForDirective(CollapsedNum, NumClauses); +} + diff --git a/clang/lib/AST/StmtPrinter.cpp b/clang/lib/AST/StmtPrinter.cpp index 1d96c49c7bb..9e88ca91186 100644 --- a/clang/lib/AST/StmtPrinter.cpp +++ b/clang/lib/AST/StmtPrinter.cpp @@ -815,6 +815,11 @@ void StmtPrinter::VisitOMPSingleDirective(OMPSingleDirective *Node) { PrintOMPExecutableDirective(Node); } +void StmtPrinter::VisitOMPParallelForDirective(OMPParallelForDirective *Node) { + Indent() << "#pragma omp parallel for "; + PrintOMPExecutableDirective(Node); +} + //===----------------------------------------------------------------------===// // Expr printing methods. //===----------------------------------------------------------------------===// diff --git a/clang/lib/AST/StmtProfile.cpp b/clang/lib/AST/StmtProfile.cpp index f666be7008f..73ec8d733a6 100644 --- a/clang/lib/AST/StmtProfile.cpp +++ b/clang/lib/AST/StmtProfile.cpp @@ -380,6 +380,11 @@ void StmtProfiler::VisitOMPSingleDirective(const OMPSingleDirective *S) { VisitOMPExecutableDirective(S); } +void +StmtProfiler::VisitOMPParallelForDirective(const OMPParallelForDirective *S) { + VisitOMPExecutableDirective(S); +} + void StmtProfiler::VisitExpr(const Expr *S) { VisitStmt(S); } |