summaryrefslogtreecommitdiffstats
path: root/clang/tools/libclang/CIndex.cpp
diff options
context:
space:
mode:
authorCarlo Bertolli <cbertol@us.ibm.com>2016-06-24 18:53:35 +0000
committerCarlo Bertolli <cbertol@us.ibm.com>2016-06-24 18:53:35 +0000
commite77d6e0e4d3989b8cfe6d4be69df4a5c26edde5f (patch)
tree4b85960833663018d1ee108716ed45573ef83d82 /clang/tools/libclang/CIndex.cpp
parent88ae09e9be07d61d0c31024510a18d8ef6f15102 (diff)
downloadbcm5719-llvm-e77d6e0e4d3989b8cfe6d4be69df4a5c26edde5f.tar.gz
bcm5719-llvm-e77d6e0e4d3989b8cfe6d4be69df4a5c26edde5f.zip
[OpenMP] Initial implementation of parse and sema for composite pragma 'distribute parallel for'
http://reviews.llvm.org/D21564 This patch is an initial implementation for #distribute parallel for. The main differences that affect other pragmas are: The implementation of 'distribute parallel for' requires blocking of the associated loop, where blocks are "distributed" to different teams and iterations within each block are scheduled to parallel threads within each team. To implement blocking, sema creates two additional worksharing directive fields that are used to pass the team assigned block lower and upper bounds through the outlined function resulting from 'parallel'. In this way, scheduling for 'for' to threads can use those bounds. As a consequence of blocking, the stride of 'distribute' is not 1 but it is equal to the blocking size. This is returned by the runtime and sema prepares a DistIncrExpr variable to hold that value. As a consequence of blocking, the global upper bound (EnsureUpperBound) expression of the 'for' is not the original loop upper bound (e.g. in for(i = 0 ; i < N; i++) this is 'N') but it is the team-assigned block upper bound. Sema creates a new expression holding the calculation of the actual upper bound for 'for' as UB = min(UB, PrevUB), where UB is the loop upper bound, and PrevUB is the team-assigned block upper bound. llvm-svn: 273705
Diffstat (limited to 'clang/tools/libclang/CIndex.cpp')
-rw-r--r--clang/tools/libclang/CIndex.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp
index a0bb7d52cb5..43d8edc3fea 100644
--- a/clang/tools/libclang/CIndex.cpp
+++ b/clang/tools/libclang/CIndex.cpp
@@ -1959,6 +1959,8 @@ public:
void VisitOMPTaskLoopDirective(const OMPTaskLoopDirective *D);
void VisitOMPTaskLoopSimdDirective(const OMPTaskLoopSimdDirective *D);
void VisitOMPDistributeDirective(const OMPDistributeDirective *D);
+ void VisitOMPDistributeParallelForDirective(
+ const OMPDistributeParallelForDirective *D);
private:
void AddDeclarationNameInfo(const Stmt *S);
@@ -2712,6 +2714,11 @@ void EnqueueVisitor::VisitOMPDistributeDirective(
VisitOMPLoopDirective(D);
}
+void EnqueueVisitor::VisitOMPDistributeParallelForDirective(
+ const OMPDistributeParallelForDirective *D) {
+ VisitOMPLoopDirective(D);
+}
+
void CursorVisitor::EnqueueWorkList(VisitorWorkList &WL, const Stmt *S) {
EnqueueVisitor(WL, MakeCXCursor(S, StmtParent, TU,RegionOfInterest)).Visit(S);
}
@@ -4825,6 +4832,8 @@ CXString clang_getCursorKindSpelling(enum CXCursorKind Kind) {
return cxstring::createRef("OMPTaskLoopSimdDirective");
case CXCursor_OMPDistributeDirective:
return cxstring::createRef("OMPDistributeDirective");
+ case CXCursor_OMPDistributeParallelForDirective:
+ return cxstring::createRef("OMPDistributeParallelForDirective");
case CXCursor_OverloadCandidate:
return cxstring::createRef("OverloadCandidate");
case CXCursor_TypeAliasTemplateDecl:
OpenPOWER on IntegriCloud