r319101 - [WebAssemby] Enable "-mthread-model single" by default, for now.

Dan Gohman via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 27 13:39:16 PST 2017


Author: djg
Date: Mon Nov 27 13:39:16 2017
New Revision: 319101

URL: http://llvm.org/viewvc/llvm-project?rev=319101&view=rev
Log:
[WebAssemby] Enable "-mthread-model single" by default, for now.

The WebAssembly standard does not yet have threads, and while it's in the
process of being standardized, it'll take some time for it to make it
through and be available in all popular implementations. With increasing
numbers of people using the LLVM wasm backend through LLVM directly rather
than through Emscripten, it's increasingly important to have friendly
defaults.

See also https://bugs.llvm.org/show_bug.cgi?id=35411

Modified:
    cfe/trunk/lib/Driver/ToolChains/WebAssembly.cpp
    cfe/trunk/lib/Driver/ToolChains/WebAssembly.h

Modified: cfe/trunk/lib/Driver/ToolChains/WebAssembly.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/WebAssembly.cpp?rev=319101&r1=319100&r2=319101&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/WebAssembly.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/WebAssembly.cpp Mon Nov 27 13:39:16 2017
@@ -135,6 +135,14 @@ void WebAssembly::AddClangCXXStdlibInclu
                      getDriver().SysRoot + "/include/c++/v1");
 }
 
+std::string WebAssembly::getThreadModel() const {
+  // The WebAssembly MVP does not yet support threads; for now, use the
+  // "single" threading model, which lowers atomics to non-atomic operations.
+  // When threading support is standardized and implemented in popular engines,
+  // this override should be removed.
+  return "single";
+}
+
 Tool *WebAssembly::buildLinker() const {
   return new tools::wasm::Linker(*this);
 }

Modified: cfe/trunk/lib/Driver/ToolChains/WebAssembly.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/WebAssembly.h?rev=319101&r1=319100&r2=319101&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/WebAssembly.h (original)
+++ cfe/trunk/lib/Driver/ToolChains/WebAssembly.h Mon Nov 27 13:39:16 2017
@@ -62,6 +62,7 @@ private:
   void AddClangCXXStdlibIncludeArgs(
       const llvm::opt::ArgList &DriverArgs,
       llvm::opt::ArgStringList &CC1Args) const override;
+  std::string getThreadModel() const override;
 
   const char *getDefaultLinker() const override {
     return "lld";




More information about the cfe-commits mailing list