diff options
author | Thomas Lively <tlively@google.com> | 2019-01-31 21:02:19 +0000 |
---|---|---|
committer | Thomas Lively <tlively@google.com> | 2019-01-31 21:02:19 +0000 |
commit | 88058d4e1e05eb873c1df358e94d4e7608007ab6 (patch) | |
tree | 93a6234540b2df03311bbcd4606d82e39d78300f /clang/lib/Basic/Targets/WebAssembly.cpp | |
parent | 0bed9e0453e1298f4323a3ec5d94a6e812d53612 (diff) | |
download | bcm5719-llvm-88058d4e1e05eb873c1df358e94d4e7608007ab6.tar.gz bcm5719-llvm-88058d4e1e05eb873c1df358e94d4e7608007ab6.zip |
[WebAssembly] Add bulk memory target feature
Summary: Also clean up some preexisting target feature code.
Reviewers: aheejin
Subscribers: dschuff, sbc100, jgravelle-google, hiraditya, sunfish, jfb
Differential Revision: https://reviews.llvm.org/D57495
llvm-svn: 352793
Diffstat (limited to 'clang/lib/Basic/Targets/WebAssembly.cpp')
-rw-r--r-- | clang/lib/Basic/Targets/WebAssembly.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/clang/lib/Basic/Targets/WebAssembly.cpp b/clang/lib/Basic/Targets/WebAssembly.cpp index 7e6a113868c..48edaded512 100644 --- a/clang/lib/Basic/Targets/WebAssembly.cpp +++ b/clang/lib/Basic/Targets/WebAssembly.cpp @@ -40,6 +40,7 @@ bool WebAssemblyTargetInfo::hasFeature(StringRef Feature) const { .Case("nontrapping-fptoint", HasNontrappingFPToInt) .Case("sign-ext", HasSignExt) .Case("exception-handling", HasExceptionHandling) + .Case("bulk-memory", HasBulkMemory) .Default(false); } @@ -59,6 +60,14 @@ void WebAssemblyTargetInfo::getTargetDefines(const LangOptions &Opts, Builder.defineMacro("__wasm_simd128__"); if (SIMDLevel >= UnimplementedSIMD128) Builder.defineMacro("__wasm_unimplemented_simd128__"); + if (HasNontrappingFPToInt) + Builder.defineMacro("__wasm_nontrapping_fptoint__"); + if (HasSignExt) + Builder.defineMacro("__wasm_sign_ext__"); + if (HasExceptionHandling) + Builder.defineMacro("__wasm_exception_handling__"); + if (HasBulkMemory) + Builder.defineMacro("__wasm_bulk_memory__"); } void WebAssemblyTargetInfo::setSIMDLevel(llvm::StringMap<bool> &Features, @@ -93,6 +102,8 @@ bool WebAssemblyTargetInfo::initFeatureMap( Features["sign-ext"] = true; if (HasExceptionHandling) Features["exception-handling"] = true; + if (HasBulkMemory) + Features["bulk-memory"] = true; return TargetInfo::initFeatureMap(Features, Diags, CPU, FeaturesVec); } @@ -140,6 +151,14 @@ bool WebAssemblyTargetInfo::handleTargetFeatures( HasExceptionHandling = false; continue; } + if (Feature == "+bulk-memory") { + HasBulkMemory = true; + continue; + } + if (Feature == "-bulk-memory") { + HasBulkMemory = false; + continue; + } Diags.Report(diag::err_opt_not_valid_with_opt) << Feature << "-target-feature"; |