summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Gohman <dan433584@gmail.com>2017-11-27 21:39:16 +0000
committerDan Gohman <dan433584@gmail.com>2017-11-27 21:39:16 +0000
commit1384ee936e46816f348bc3756704aeaff92e86fe (patch)
tree958c12897050f324469eb41a6f920ff32a35d58b
parentc8477b82341bdaad43ba9d334c798e918438b2f3 (diff)
downloadbcm5719-llvm-1384ee936e46816f348bc3756704aeaff92e86fe.tar.gz
bcm5719-llvm-1384ee936e46816f348bc3756704aeaff92e86fe.zip
[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 llvm-svn: 319101
-rw-r--r--clang/lib/Driver/ToolChains/WebAssembly.cpp8
-rw-r--r--clang/lib/Driver/ToolChains/WebAssembly.h1
2 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/Driver/ToolChains/WebAssembly.cpp b/clang/lib/Driver/ToolChains/WebAssembly.cpp
index 1464c150c9c..d00d833fbb0 100644
--- a/clang/lib/Driver/ToolChains/WebAssembly.cpp
+++ b/clang/lib/Driver/ToolChains/WebAssembly.cpp
@@ -135,6 +135,14 @@ void WebAssembly::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs,
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);
}
diff --git a/clang/lib/Driver/ToolChains/WebAssembly.h b/clang/lib/Driver/ToolChains/WebAssembly.h
index 7524361d516..8784e12dfb0 100644
--- a/clang/lib/Driver/ToolChains/WebAssembly.h
+++ b/clang/lib/Driver/ToolChains/WebAssembly.h
@@ -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";
OpenPOWER on IntegriCloud