From a63048e4fd2936e600a1268651a4f2ad981309d0 Mon Sep 17 00:00:00 2001 From: Alexey Bataev Date: Mon, 23 Mar 2015 06:18:07 +0000 Subject: [OPENMP] Codegen for 'copyprivate' clause ('single' directive). If there is at least one 'copyprivate' clause is associated with the single directive, the following code is generated: ``` i32 did_it = 0; \\ for 'copyprivate' clause if(__kmpc_single(ident_t *, gtid)) { SingleOpGen(); __kmpc_end_single(ident_t *, gtid); did_it = 1; \\ for 'copyprivate' clause } [0] = &var0; ... [n] = &varn; call __kmpc_copyprivate(ident_t *, gtid, , , , did_it); ... void(void *LHSArg, void *RHSArg) { Dst = (void * [n])(LHSArg); Src = (void * [n])(RHSArg); Dst[0] = Src[0]; ... Dst[n] = Src[n]; } ``` All list items from all 'copyprivate' clauses are gathered into single ( is a size in bytes of this list) and is used to propagate values of private or threadprivate variables from the 'single' region to other implicit threads from outer 'parallel' region. Differential Revision: http://reviews.llvm.org/D8410 llvm-svn: 232932 --- clang/tools/libclang/CIndex.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'clang/tools/libclang/CIndex.cpp') diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp index b47128785c8..0ce86728df2 100644 --- a/clang/tools/libclang/CIndex.cpp +++ b/clang/tools/libclang/CIndex.cpp @@ -2053,6 +2053,15 @@ void OMPClauseEnqueue::VisitOMPCopyinClause(const OMPCopyinClause *C) { void OMPClauseEnqueue::VisitOMPCopyprivateClause(const OMPCopyprivateClause *C) { VisitOMPClauseList(C); + for (auto *E : C->source_exprs()) { + Visitor->AddStmt(E); + } + for (auto *E : C->destination_exprs()) { + Visitor->AddStmt(E); + } + for (auto *E : C->assignment_ops()) { + Visitor->AddStmt(E); + } } void OMPClauseEnqueue::VisitOMPFlushClause(const OMPFlushClause *C) { VisitOMPClauseList(C); -- cgit v1.2.3