@@ -165,6 +165,23 @@ class SILFunction
165
165
166
166
Identifier ObjCReplacementFor;
167
167
168
+ // / The function's set of semantics attributes.
169
+ // /
170
+ // / TODO: Why is this using a std::string? Why don't we use uniqued
171
+ // / StringRefs?
172
+ std::vector<std::string> SemanticsAttrSet;
173
+
174
+ // / The function's remaining set of specialize attributes.
175
+ std::vector<SILSpecializeAttr*> SpecializeAttrSet;
176
+
177
+ // / Has value if there's a profile for this function
178
+ // / Contains Function Entry Count
179
+ ProfileCounter EntryCount;
180
+
181
+ // / This is the number of uses of this SILFunction inside the SIL.
182
+ // / It does not include references from debug scopes.
183
+ unsigned RefCount = 0 ;
184
+
168
185
// / The function's bare attribute. Bare means that the function is SIL-only
169
186
// / and does not require debug info.
170
187
unsigned Bare : 1 ;
@@ -209,33 +226,9 @@ class SILFunction
209
226
// / invoked with a `self` argument of the exact base class type.
210
227
unsigned ExactSelfClass : 1 ;
211
228
212
- // / If != OptimizationMode::NotSet, the optimization mode specified with an
213
- // / function attribute.
214
- OptimizationMode OptMode;
215
-
216
- // / This is the number of uses of this SILFunction inside the SIL.
217
- // / It does not include references from debug scopes.
218
- unsigned RefCount = 0 ;
219
-
220
- // / The function's set of semantics attributes.
221
- // /
222
- // / TODO: Why is this using a std::string? Why don't we use uniqued
223
- // / StringRefs?
224
- llvm::SmallVector<std::string, 1 > SemanticsAttrSet;
225
-
226
- // / The function's remaining set of specialize attributes.
227
- std::vector<SILSpecializeAttr*> SpecializeAttrSet;
228
-
229
- // / The function's effects attribute.
230
- EffectsKind EffectsKindAttr;
231
-
232
- // / Has value if there's a profile for this function
233
- // / Contains Function Entry Count
234
- ProfileCounter EntryCount;
235
-
236
229
// / True if this function is inlined at least once. This means that the
237
230
// / debug info keeps a pointer to this function.
238
- bool Inlined = false ;
231
+ unsigned Inlined : 1 ;
239
232
240
233
// / True if this function is a zombie function. This means that the function
241
234
// / is dead and not referenced from anywhere inside the SIL. But it is kept
@@ -244,28 +237,35 @@ class SILFunction
244
237
// / *) It is a dead method of a class which has higher visibility than the
245
238
// / method itself. In this case we need to create a vtable stub for it.
246
239
// / *) It is a function referenced by the specialization information.
247
- bool Zombie = false ;
240
+ unsigned Zombie : 1 ;
248
241
249
242
// / True if this function is in Ownership SSA form and thus must pass
250
243
// / ownership verification.
251
244
// /
252
245
// / This enables the verifier to easily prove that before the Ownership Model
253
246
// / Eliminator runs on a function, we only see a non-semantic-arc world and
254
247
// / after the pass runs, we only see a semantic-arc world.
255
- bool HasOwnership = true ;
248
+ unsigned HasOwnership : 1 ;
256
249
257
250
// / Set if the function body was deserialized from canonical SIL. This implies
258
251
// / that the function's home module performed SIL diagnostics prior to
259
252
// / serialization.
260
- bool WasDeserializedCanonical = false ;
253
+ unsigned WasDeserializedCanonical : 1 ;
261
254
262
255
// / True if this is a reabstraction thunk of escaping function type whose
263
256
// / single argument is a potentially non-escaping closure. This is an escape
264
257
// / hatch to allow non-escaping functions to be stored or passed as an
265
258
// / argument with escaping function type. The thunk argument's function type
266
259
// / is not necessarily @noescape. The only relevant aspect of the argument is
267
260
// / that it may have unboxed capture (i.e. @inout_aliasable parameters).
268
- bool IsWithoutActuallyEscapingThunk = false ;
261
+ unsigned IsWithoutActuallyEscapingThunk : 1 ;
262
+
263
+ // / If != OptimizationMode::NotSet, the optimization mode specified with an
264
+ // / function attribute.
265
+ unsigned OptMode : NumOptimizationModeBits;
266
+
267
+ // / The function's effects attribute.
268
+ unsigned EffectsKindAttr : NumEffectsKindBits;
269
269
270
270
static void
271
271
validateSubclassScope (SubclassScope scope, IsThunk_t isThunk,
@@ -671,13 +671,17 @@ class SILFunction
671
671
672
672
// / Get this function's optimization mode or OptimizationMode::NotSet if it is
673
673
// / not set for this specific function.
674
- OptimizationMode getOptimizationMode () const { return OptMode; }
674
+ OptimizationMode getOptimizationMode () const {
675
+ return OptimizationMode (OptMode);
676
+ }
675
677
676
678
// / Returns the optimization mode for the function. If no mode is set for the
677
679
// / function, returns the global mode, i.e. the mode of the module's options.
678
680
OptimizationMode getEffectiveOptimizationMode () const ;
679
681
680
- void setOptimizationMode (OptimizationMode mode) { OptMode = mode; }
682
+ void setOptimizationMode (OptimizationMode mode) {
683
+ OptMode = unsigned (mode);
684
+ }
681
685
682
686
// / \returns True if the function is optimizable (i.e. not marked as no-opt),
683
687
// / or is raw SIL (so that the mandatory passes still run).
@@ -755,16 +759,16 @@ class SILFunction
755
759
void setInlineStrategy (Inline_t inStr) { InlineStrategy = inStr; }
756
760
757
761
// / \return the function side effects information.
758
- EffectsKind getEffectsKind () const { return EffectsKindAttr; }
762
+ EffectsKind getEffectsKind () const { return EffectsKind ( EffectsKindAttr) ; }
759
763
760
764
// / \return True if the function is annotated with the @_effects attribute.
761
765
bool hasEffectsKind () const {
762
- return EffectsKindAttr != EffectsKind::Unspecified;
766
+ return EffectsKind ( EffectsKindAttr) != EffectsKind::Unspecified;
763
767
}
764
768
765
769
// / Set the function side effect information.
766
770
void setEffectsKind (EffectsKind E) {
767
- EffectsKindAttr = E ;
771
+ EffectsKindAttr = unsigned (E) ;
768
772
}
769
773
770
774
// / Get this function's global_init attribute.
0 commit comments