@@ -59,12 +59,12 @@ bool WebAssemblyTargetInfo::hasFeature(StringRef Feature) const {
5959 .Case (" exception-handling" , HasExceptionHandling)
6060 .Case (" extended-const" , HasExtendedConst)
6161 .Case (" fp16" , HasFP16)
62+ .Case (" gc" , HasGC)
6263 .Case (" multimemory" , HasMultiMemory)
6364 .Case (" multivalue" , HasMultivalue)
6465 .Case (" mutable-globals" , HasMutableGlobals)
6566 .Case (" nontrapping-fptoint" , HasNontrappingFPToInt)
6667 .Case (" reference-types" , HasReferenceTypes)
67- .Case (" gc" , HasGC)
6868 .Case (" relaxed-simd" , SIMDLevel >= RelaxedSIMD)
6969 .Case (" sign-ext" , HasSignExt)
7070 .Case (" simd128" , SIMDLevel >= SIMD128)
@@ -99,6 +99,8 @@ void WebAssemblyTargetInfo::getTargetDefines(const LangOptions &Opts,
9999 Builder.defineMacro (" __wasm_multimemory__" );
100100 if (HasFP16)
101101 Builder.defineMacro (" __wasm_fp16__" );
102+ if (HasGC)
103+ Builder.defineMacro (" __wasm_gc__" );
102104 if (HasMultivalue)
103105 Builder.defineMacro (" __wasm_multivalue__" );
104106 if (HasMutableGlobals)
@@ -107,8 +109,6 @@ void WebAssemblyTargetInfo::getTargetDefines(const LangOptions &Opts,
107109 Builder.defineMacro (" __wasm_nontrapping_fptoint__" );
108110 if (HasReferenceTypes)
109111 Builder.defineMacro (" __wasm_reference_types__" );
110- if (HasGC)
111- Builder.defineMacro (" __wasm_gc__" );
112112 if (SIMDLevel >= RelaxedSIMD)
113113 Builder.defineMacro (" __wasm_relaxed_simd__" );
114114 if (HasSignExt)
@@ -194,6 +194,7 @@ bool WebAssemblyTargetInfo::initFeatureMap(
194194 Features[" exception-handling" ] = true ;
195195 Features[" extended-const" ] = true ;
196196 Features[" fp16" ] = true ;
197+ Features[" gc" ] = true ;
197198 Features[" multimemory" ] = true ;
198199 Features[" tail-call" ] = true ;
199200 Features[" wide-arithmetic" ] = true ;
@@ -270,6 +271,14 @@ bool WebAssemblyTargetInfo::handleTargetFeatures(
270271 HasFP16 = false ;
271272 continue ;
272273 }
274+ if (Feature == " +gc" ) {
275+ HasGC = true ;
276+ continue ;
277+ }
278+ if (Feature == " -gc" ) {
279+ HasGC = false ;
280+ continue ;
281+ }
273282 if (Feature == " +multimemory" ) {
274283 HasMultiMemory = true ;
275284 continue ;
@@ -310,14 +319,6 @@ bool WebAssemblyTargetInfo::handleTargetFeatures(
310319 HasReferenceTypes = false ;
311320 continue ;
312321 }
313- if (Feature == " +gc" ) {
314- HasGC = true ;
315- continue ;
316- }
317- if (Feature == " -gc" ) {
318- HasGC = false ;
319- continue ;
320- }
321322 if (Feature == " +relaxed-simd" ) {
322323 SIMDLevel = std::max (SIMDLevel, RelaxedSIMD);
323324 continue ;
0 commit comments