diff options
author | Heejin Ahn <aheejin@gmail.com> | 2019-02-06 01:41:26 +0000 |
---|---|---|
committer | Heejin Ahn <aheejin@gmail.com> | 2019-02-06 01:41:26 +0000 |
commit | bab8597916bb314b937444d7e950e6d509b57bd0 (patch) | |
tree | 155048085d00f2043e6279ae0ed6c1068b0ddd97 /clang/lib/Basic/Targets/WebAssembly.cpp | |
parent | 7b3a0f17a518f3a593448d8f193e75e8cf05d097 (diff) | |
download | bcm5719-llvm-bab8597916bb314b937444d7e950e6d509b57bd0.tar.gz bcm5719-llvm-bab8597916bb314b937444d7e950e6d509b57bd0.zip |
[WebAssembly] Add atomics target option
Reviewers: tlively
Subscribers: dschuff, sbc100, jgravelle-google, sunfish, jfb, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D57798
llvm-svn: 353260
Diffstat (limited to 'clang/lib/Basic/Targets/WebAssembly.cpp')
-rw-r--r-- | clang/lib/Basic/Targets/WebAssembly.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/lib/Basic/Targets/WebAssembly.cpp b/clang/lib/Basic/Targets/WebAssembly.cpp index 48edaded512..4e22abaaa8b 100644 --- a/clang/lib/Basic/Targets/WebAssembly.cpp +++ b/clang/lib/Basic/Targets/WebAssembly.cpp @@ -41,6 +41,7 @@ bool WebAssemblyTargetInfo::hasFeature(StringRef Feature) const { .Case("sign-ext", HasSignExt) .Case("exception-handling", HasExceptionHandling) .Case("bulk-memory", HasBulkMemory) + .Case("atomics", HasAtomics) .Default(false); } @@ -68,6 +69,8 @@ void WebAssemblyTargetInfo::getTargetDefines(const LangOptions &Opts, Builder.defineMacro("__wasm_exception_handling__"); if (HasBulkMemory) Builder.defineMacro("__wasm_bulk_memory__"); + if (HasAtomics) + Builder.defineMacro("__wasm_atomics__"); } void WebAssemblyTargetInfo::setSIMDLevel(llvm::StringMap<bool> &Features, @@ -90,6 +93,7 @@ bool WebAssemblyTargetInfo::initFeatureMap( if (CPU == "bleeding-edge") { Features["nontrapping-fptoint"] = true; Features["sign-ext"] = true; + Features["atomics"] = true; setSIMDLevel(Features, SIMD128); } // Other targets do not consider user-configured features here, but while we @@ -104,6 +108,8 @@ bool WebAssemblyTargetInfo::initFeatureMap( Features["exception-handling"] = true; if (HasBulkMemory) Features["bulk-memory"] = true; + if (HasAtomics) + Features["atomics"] = true; return TargetInfo::initFeatureMap(Features, Diags, CPU, FeaturesVec); } @@ -159,6 +165,14 @@ bool WebAssemblyTargetInfo::handleTargetFeatures( HasBulkMemory = false; continue; } + if (Feature == "+atomics") { + HasAtomics = true; + continue; + } + if (Feature == "-atomics") { + HasAtomics = false; + continue; + } Diags.Report(diag::err_opt_not_valid_with_opt) << Feature << "-target-feature"; |