diff options
author | Thomas Lively <tlively@google.com> | 2019-05-23 17:26:47 +0000 |
---|---|---|
committer | Thomas Lively <tlively@google.com> | 2019-05-23 17:26:47 +0000 |
commit | eafe8ef6f2b44baf5a84658caca90c2f9c1849ca (patch) | |
tree | 38bdbf81421ed26bcfc1f748dba71f28cc2c9880 /clang/lib/Basic/Targets/WebAssembly.cpp | |
parent | 7b7683d7a6c4b3839629403a85dc0bd5b9a502b6 (diff) | |
download | bcm5719-llvm-eafe8ef6f2b44baf5a84658caca90c2f9c1849ca.tar.gz bcm5719-llvm-eafe8ef6f2b44baf5a84658caca90c2f9c1849ca.zip |
[WebAssembly] Add multivalue and tail-call target features
Summary:
These features will both be implemented soon, so I thought I would
save time by adding the boilerplate for both of them at the same time.
Reviewers: aheejin
Subscribers: dschuff, sbc100, jgravelle-google, hiraditya, sunfish, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D62047
llvm-svn: 361516
Diffstat (limited to 'clang/lib/Basic/Targets/WebAssembly.cpp')
-rw-r--r-- | clang/lib/Basic/Targets/WebAssembly.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/clang/lib/Basic/Targets/WebAssembly.cpp b/clang/lib/Basic/Targets/WebAssembly.cpp index 2fceed2ad1f..b16442b99b6 100644 --- a/clang/lib/Basic/Targets/WebAssembly.cpp +++ b/clang/lib/Basic/Targets/WebAssembly.cpp @@ -43,6 +43,8 @@ bool WebAssemblyTargetInfo::hasFeature(StringRef Feature) const { .Case("bulk-memory", HasBulkMemory) .Case("atomics", HasAtomics) .Case("mutable-globals", HasMutableGlobals) + .Case("multivalue", HasMultivalue) + .Case("tail-call", HasTailCall) .Default(false); } @@ -74,6 +76,10 @@ void WebAssemblyTargetInfo::getTargetDefines(const LangOptions &Opts, Builder.defineMacro("__wasm_atomics__"); if (HasMutableGlobals) Builder.defineMacro("__wasm_mutable_globals__"); + if (HasMultivalue) + Builder.defineMacro("__wasm_multivalue__"); + if (HasTailCall) + Builder.defineMacro("__wasm_tail_call__"); } void WebAssemblyTargetInfo::setSIMDLevel(llvm::StringMap<bool> &Features, @@ -116,6 +122,10 @@ bool WebAssemblyTargetInfo::initFeatureMap( Features["atomics"] = true; if (HasMutableGlobals) Features["mutable-globals"] = true; + if (HasMultivalue) + Features["multivalue"] = true; + if (HasTailCall) + Features["tail-call"] = true; return TargetInfo::initFeatureMap(Features, Diags, CPU, FeaturesVec); } @@ -187,6 +197,22 @@ bool WebAssemblyTargetInfo::handleTargetFeatures( HasMutableGlobals = false; continue; } + if (Feature == "+multivalue") { + HasMultivalue = true; + continue; + } + if (Feature == "-multivalue") { + HasMultivalue = false; + continue; + } + if (Feature == "+tail-call") { + HasTailCall = true; + continue; + } + if (Feature == "-tail-call") { + HasTailCall = false; + continue; + } Diags.Report(diag::err_opt_not_valid_with_opt) << Feature << "-target-feature"; |