diff options
Diffstat (limited to 'clang/lib/Basic/Targets/WebAssembly.cpp')
-rw-r--r-- | clang/lib/Basic/Targets/WebAssembly.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/clang/lib/Basic/Targets/WebAssembly.cpp b/clang/lib/Basic/Targets/WebAssembly.cpp index af25d25..55ffe1d 100644 --- a/clang/lib/Basic/Targets/WebAssembly.cpp +++ b/clang/lib/Basic/Targets/WebAssembly.cpp @@ -59,6 +59,7 @@ bool WebAssemblyTargetInfo::hasFeature(StringRef Feature) const { .Case("exception-handling", HasExceptionHandling) .Case("extended-const", HasExtendedConst) .Case("fp16", HasFP16) + .Case("gc", HasGC) .Case("multimemory", HasMultiMemory) .Case("multivalue", HasMultivalue) .Case("mutable-globals", HasMutableGlobals) @@ -98,6 +99,8 @@ void WebAssemblyTargetInfo::getTargetDefines(const LangOptions &Opts, Builder.defineMacro("__wasm_multimemory__"); if (HasFP16) Builder.defineMacro("__wasm_fp16__"); + if (HasGC) + Builder.defineMacro("__wasm_gc__"); if (HasMultivalue) Builder.defineMacro("__wasm_multivalue__"); if (HasMutableGlobals) @@ -191,6 +194,7 @@ bool WebAssemblyTargetInfo::initFeatureMap( Features["exception-handling"] = true; Features["extended-const"] = true; Features["fp16"] = true; + Features["gc"] = true; Features["multimemory"] = true; Features["tail-call"] = true; Features["wide-arithmetic"] = true; @@ -267,6 +271,14 @@ bool WebAssemblyTargetInfo::handleTargetFeatures( HasFP16 = false; continue; } + if (Feature == "+gc") { + HasGC = true; + continue; + } + if (Feature == "-gc") { + HasGC = false; + continue; + } if (Feature == "+multimemory") { HasMultiMemory = true; continue; @@ -353,6 +365,11 @@ bool WebAssemblyTargetInfo::handleTargetFeatures( return false; } + // gc implies reference-types + if (HasGC) { + HasReferenceTypes = true; + } + // bulk-memory-opt is a subset of bulk-memory. if (HasBulkMemory) { HasBulkMemoryOpt = true; |