summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic/Targets/WebAssembly.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Basic/Targets/WebAssembly.cpp')
-rw-r--r--clang/lib/Basic/Targets/WebAssembly.cpp14
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";
OpenPOWER on IntegriCloud