@@ -59,12 +59,12 @@ bool WebAssemblyTargetInfo::hasFeature(StringRef Feature) const {
59
59
.Case (" exception-handling" , HasExceptionHandling)
60
60
.Case (" extended-const" , HasExtendedConst)
61
61
.Case (" fp16" , HasFP16)
62
+ .Case (" gc" , HasGC)
62
63
.Case (" multimemory" , HasMultiMemory)
63
64
.Case (" multivalue" , HasMultivalue)
64
65
.Case (" mutable-globals" , HasMutableGlobals)
65
66
.Case (" nontrapping-fptoint" , HasNontrappingFPToInt)
66
67
.Case (" reference-types" , HasReferenceTypes)
67
- .Case (" gc" , HasGC)
68
68
.Case (" relaxed-simd" , SIMDLevel >= RelaxedSIMD)
69
69
.Case (" sign-ext" , HasSignExt)
70
70
.Case (" simd128" , SIMDLevel >= SIMD128)
@@ -99,6 +99,8 @@ void WebAssemblyTargetInfo::getTargetDefines(const LangOptions &Opts,
99
99
Builder.defineMacro (" __wasm_multimemory__" );
100
100
if (HasFP16)
101
101
Builder.defineMacro (" __wasm_fp16__" );
102
+ if (HasGC)
103
+ Builder.defineMacro (" __wasm_gc__" );
102
104
if (HasMultivalue)
103
105
Builder.defineMacro (" __wasm_multivalue__" );
104
106
if (HasMutableGlobals)
@@ -107,8 +109,6 @@ void WebAssemblyTargetInfo::getTargetDefines(const LangOptions &Opts,
107
109
Builder.defineMacro (" __wasm_nontrapping_fptoint__" );
108
110
if (HasReferenceTypes)
109
111
Builder.defineMacro (" __wasm_reference_types__" );
110
- if (HasGC)
111
- Builder.defineMacro (" __wasm_gc__" );
112
112
if (SIMDLevel >= RelaxedSIMD)
113
113
Builder.defineMacro (" __wasm_relaxed_simd__" );
114
114
if (HasSignExt)
@@ -194,6 +194,7 @@ bool WebAssemblyTargetInfo::initFeatureMap(
194
194
Features[" exception-handling" ] = true ;
195
195
Features[" extended-const" ] = true ;
196
196
Features[" fp16" ] = true ;
197
+ Features[" gc" ] = true ;
197
198
Features[" multimemory" ] = true ;
198
199
Features[" tail-call" ] = true ;
199
200
Features[" wide-arithmetic" ] = true ;
@@ -270,6 +271,14 @@ bool WebAssemblyTargetInfo::handleTargetFeatures(
270
271
HasFP16 = false ;
271
272
continue ;
272
273
}
274
+ if (Feature == " +gc" ) {
275
+ HasGC = true ;
276
+ continue ;
277
+ }
278
+ if (Feature == " -gc" ) {
279
+ HasGC = false ;
280
+ continue ;
281
+ }
273
282
if (Feature == " +multimemory" ) {
274
283
HasMultiMemory = true ;
275
284
continue ;
@@ -310,14 +319,6 @@ bool WebAssemblyTargetInfo::handleTargetFeatures(
310
319
HasReferenceTypes = false ;
311
320
continue ;
312
321
}
313
- if (Feature == " +gc" ) {
314
- HasGC = true ;
315
- continue ;
316
- }
317
- if (Feature == " -gc" ) {
318
- HasGC = false ;
319
- continue ;
320
- }
321
322
if (Feature == " +relaxed-simd" ) {
322
323
SIMDLevel = std::max (SIMDLevel, RelaxedSIMD);
323
324
continue ;
0 commit comments