@@ -40,21 +40,15 @@ struct FeatureSet {
4040 Multivalue = 1 << 9 ,
4141 GC = 1 << 10 ,
4242 Memory64 = 1 << 11 ,
43- // TODO: Remove this feature when the wasm spec stabilizes.
44- GCNNLocals = 1 << 12 ,
45- RelaxedSIMD = 1 << 13 ,
46- ExtendedConst = 1 << 14 ,
47- Strings = 1 << 15 ,
48- MultiMemory = 1 << 16 ,
43+ RelaxedSIMD = 1 << 12 ,
44+ ExtendedConst = 1 << 13 ,
45+ Strings = 1 << 14 ,
46+ MultiMemory = 1 << 15 ,
4947 MVP = None,
5048 // Keep in sync with llvm default features:
5149 // https://github.com/llvm/llvm-project/blob/c7576cb89d6c95f03968076e902d3adfd1996577/clang/lib/Basic/Targets/WebAssembly.cpp#L150-L153
5250 Default = SignExt | MutableGlobals,
53- // GCNNLocals are opt-in: merely asking for "All" does not apply them. To
54- // get all possible values use AllPossible. See setAll() below for more
55- // details.
56- All = ((1 << 17 ) - 1 ) & ~GCNNLocals,
57- AllPossible = (1 << 17 ) - 1 ,
51+ All = (1 << 16 ) - 1 ,
5852 };
5953
6054 static std::string toString (Feature f) {
@@ -83,8 +77,6 @@ struct FeatureSet {
8377 return " gc" ;
8478 case Memory64:
8579 return " memory64" ;
86- case GCNNLocals:
87- return " gc-nn-locals" ;
8880 case RelaxedSIMD:
8981 return " relaxed-simd" ;
9082 case ExtendedConst:
@@ -101,7 +93,7 @@ struct FeatureSet {
10193 std::string toString () const {
10294 std::string ret;
10395 uint32_t x = 1 ;
104- while (x & Feature::AllPossible ) {
96+ while (x & Feature::All ) {
10597 if (features & x) {
10698 if (!ret.empty ()) {
10799 ret += " , " ;
@@ -133,12 +125,11 @@ struct FeatureSet {
133125 bool hasMultivalue () const { return (features & Multivalue) != 0 ; }
134126 bool hasGC () const { return (features & GC) != 0 ; }
135127 bool hasMemory64 () const { return (features & Memory64) != 0 ; }
136- bool hasGCNNLocals () const { return (features & GCNNLocals) != 0 ; }
137128 bool hasRelaxedSIMD () const { return (features & RelaxedSIMD) != 0 ; }
138129 bool hasExtendedConst () const { return (features & ExtendedConst) != 0 ; }
139130 bool hasStrings () const { return (features & Strings) != 0 ; }
140131 bool hasMultiMemory () const { return (features & MultiMemory) != 0 ; }
141- bool hasAll () const { return (features & AllPossible ) != 0 ; }
132+ bool hasAll () const { return (features & All ) != 0 ; }
142133
143134 void set (FeatureSet f, bool v = true ) {
144135 features = v ? (features | f) : (features & ~f);
@@ -155,34 +146,18 @@ struct FeatureSet {
155146 void setMultivalue (bool v = true ) { set (Multivalue, v); }
156147 void setGC (bool v = true ) { set (GC, v); }
157148 void setMemory64 (bool v = true ) { set (Memory64, v); }
158- void setGCNNLocals (bool v = true ) { set (GCNNLocals, v); }
159149 void setRelaxedSIMD (bool v = true ) { set (RelaxedSIMD, v); }
160150 void setExtendedConst (bool v = true ) { set (ExtendedConst, v); }
161151 void setStrings (bool v = true ) { set (Strings, v); }
162152 void setMultiMemory (bool v = true ) { set (MultiMemory, v); }
163153 void setMVP () { features = MVP; }
164- void setAll () {
165- // Do not set GCNNLocals, which forces the user to opt in to that feature
166- // explicitly. That is, wasm-opt -all will enable GC but *not* enable
167- // non-nullable locals. To get them, do wasm-opt -all --enable-gc-nn-locals
168- // FIXME: When the wasm spec stabilizes, this feature will go away, as the
169- // non-nullable locals experiment will either become the standard,
170- // or it will go away.
171- // Leave the old GCNNLocals value unmodified. This makes things like
172- // --enable-gc-nn-locals -all work (that is, if we enable the feature,
173- // then -all does not disable it; it simply does not enable it by itself).
174- auto oldGCNNLocals = hasGCNNLocals ();
175- features = AllPossible;
176- setGCNNLocals (oldGCNNLocals);
177- }
154+ void setAll () { features = All; }
178155
179156 void enable (const FeatureSet& other) { features |= other.features ; }
180- void disable (const FeatureSet& other) {
181- features = features & ~other.features & AllPossible;
182- }
157+ void disable (const FeatureSet& other) { features &= ~other.features ; }
183158
184159 template <typename F> void iterFeatures (F f) const {
185- for (uint32_t feature = MVP + 1 ; feature < AllPossible ; feature <<= 1 ) {
160+ for (uint32_t feature = MVP + 1 ; feature < All ; feature <<= 1 ) {
186161 if (has (feature)) {
187162 f (static_cast <Feature>(feature));
188163 }
0 commit comments