@@ -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)
6362 .Case (" multimemory" , HasMultiMemory)
6463 .Case (" multivalue" , HasMultivalue)
6564 .Case (" mutable-globals" , HasMutableGlobals)
6665 .Case (" nontrapping-fptoint" , HasNontrappingFPToInt)
6766 .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,8 +99,6 @@ 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__" );
104102 if (HasMultivalue)
105103 Builder.defineMacro (" __wasm_multivalue__" );
106104 if (HasMutableGlobals)
@@ -109,6 +107,8 @@ void WebAssemblyTargetInfo::getTargetDefines(const LangOptions &Opts,
109107 Builder.defineMacro (" __wasm_nontrapping_fptoint__" );
110108 if (HasReferenceTypes)
111109 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,7 +194,6 @@ bool WebAssemblyTargetInfo::initFeatureMap(
194194 Features[" exception-handling" ] = true ;
195195 Features[" extended-const" ] = true ;
196196 Features[" fp16" ] = true ;
197- Features[" gc" ] = true ;
198197 Features[" multimemory" ] = true ;
199198 Features[" tail-call" ] = true ;
200199 Features[" wide-arithmetic" ] = true ;
@@ -271,14 +270,6 @@ bool WebAssemblyTargetInfo::handleTargetFeatures(
271270 HasFP16 = false ;
272271 continue ;
273272 }
274- if (Feature == " +gc" ) {
275- HasGC = true ;
276- continue ;
277- }
278- if (Feature == " -gc" ) {
279- HasGC = false ;
280- continue ;
281- }
282273 if (Feature == " +multimemory" ) {
283274 HasMultiMemory = true ;
284275 continue ;
@@ -319,6 +310,14 @@ bool WebAssemblyTargetInfo::handleTargetFeatures(
319310 HasReferenceTypes = false ;
320311 continue ;
321312 }
313+ if (Feature == " +gc" ) {
314+ HasGC = true ;
315+ continue ;
316+ }
317+ if (Feature == " -gc" ) {
318+ HasGC = false ;
319+ continue ;
320+ }
322321 if (Feature == " +relaxed-simd" ) {
323322 SIMDLevel = std::max (SIMDLevel, RelaxedSIMD);
324323 continue ;
0 commit comments