[PATCH] D10753: [OpenMP] Add TLS-based implementation for threadprivate directive

Samuel Antao sfantao at us.ibm.com
Fri Jul 10 07:22:40 PDT 2015


sfantao added inline comments.

================
Comment at: lib/AST/Decl.cpp:1818
@@ -1813,3 +1817,3 @@
   case TSCS__Thread_local:
-      return TLS_Static;
+    return TLS_Static;
   case TSCS_thread_local:
----------------
Done!

================
Comment at: lib/Driver/Tools.cpp:3952-3970
@@ -3951,11 +3951,21 @@
       CmdArgs.push_back("-fopenmp");
+
+      // If no option regarding the use of TLS in OpenMP codegeneration is
+      // given, decide a default based on the target. Otherwise rely on the
+      // options and pass the right information to the frontend.
+      if (!Args.hasFlag(options::OPT_fopenmp_use_tls,
+                        options::OPT_fnoopenmp_use_tls,
+                        getToolChain().getArch() == llvm::Triple::ppc ||
+                            getToolChain().getArch() == llvm::Triple::ppc64 ||
+                            getToolChain().getArch() == llvm::Triple::ppc64le))
+        CmdArgs.push_back("-fnoopenmp-use-tls");
       break;
     default:
       // By default, if Clang doesn't know how to generate useful OpenMP code
       // for a specific runtime library, we just don't pass the '-fopenmp' flag
       // down to the actual compilation.
       // FIXME: It would be better to have a mode which *only* omits IR
       // generation based on the OpenMP support so that we get consistent
       // semantic analysis, etc.
       break;
     }
----------------
Done!


http://reviews.llvm.org/D10753







More information about the cfe-commits mailing list