[PATCH] [OPENMP] Codegen for 'firstprivate' clause in 'parallel' directive

Alexey Bataev a.bataev at hotmail.com
Mon Sep 1 00:10:39 PDT 2014


Hi doug.gregor, fraggamuffin, rsmith, rjmccall, hfinkel, ejstotzer,

This patch generates some helper variables that used as a private copies of the corresponding original variables inside an OpenMP 'parallel' directive. These generated variables are initialized by copy using values of the original variables(with the copy constructor, if any). For arrays initializator is generated for single element and in the codegen procedure this initial value is automatically propagated between all elements of the private copy.
In outlined function references to original variables are replaced by the references to these private helper variables. At the end of the initialization of the private variables an implicit barier is generated by calling __kmpc_barrier(...) runtime function to be sure that all threads were initialized using original values of the variables.

http://reviews.llvm.org/D5140

Files:
  include/clang/AST/DataRecursiveASTVisitor.h
  include/clang/AST/OpenMPClause.h
  include/clang/AST/RecursiveASTVisitor.h
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/AST/Stmt.cpp
  lib/AST/StmtProfile.cpp
  lib/CodeGen/CGDecl.cpp
  lib/CodeGen/CGExpr.cpp
  lib/CodeGen/CGOpenMPRuntime.cpp
  lib/CodeGen/CGOpenMPRuntime.h
  lib/CodeGen/CGStmtOpenMP.cpp
  lib/CodeGen/CodeGenFunction.h
  lib/Sema/SemaOpenMP.cpp
  lib/Serialization/ASTReaderStmt.cpp
  lib/Serialization/ASTWriterStmt.cpp
  test/OpenMP/for_firstprivate_messages.cpp
  test/OpenMP/parallel_codegen.cpp
  test/OpenMP/parallel_firstprivate_codegen.cpp
  test/OpenMP/parallel_firstprivate_messages.cpp
  test/OpenMP/parallel_for_firstprivate_messages.cpp
  test/OpenMP/parallel_sections_firstprivate_messages.cpp
  test/OpenMP/sections_firstprivate_messages.cpp
  test/OpenMP/single_firstprivate_messages.cpp
  test/OpenMP/task_firstprivate_messages.cpp
  test/OpenMP/task_messages.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D5140.13135.patch
Type: text/x-patch
Size: 75941 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140901/677ee1a1/attachment.bin>


More information about the cfe-commits mailing list