@@ -160,6 +160,23 @@ class SILFunction
160
160
161
161
Identifier ObjCReplacementFor;
162
162
163
+ // / The function's set of semantics attributes.
164
+ // /
165
+ // / TODO: Why is this using a std::string? Why don't we use uniqued
166
+ // / StringRefs?
167
+ std::vector<std::string> SemanticsAttrSet;
168
+
169
+ // / The function's remaining set of specialize attributes.
170
+ std::vector<SILSpecializeAttr*> SpecializeAttrSet;
171
+
172
+ // / Has value if there's a profile for this function
173
+ // / Contains Function Entry Count
174
+ ProfileCounter EntryCount;
175
+
176
+ // / This is the number of uses of this SILFunction inside the SIL.
177
+ // / It does not include references from debug scopes.
178
+ unsigned RefCount = 0 ;
179
+
163
180
// / The function's bare attribute. Bare means that the function is SIL-only
164
181
// / and does not require debug info.
165
182
unsigned Bare : 1 ;
@@ -200,33 +217,9 @@ class SILFunction
200
217
// Whether the implementation can be dynamically replaced.
201
218
unsigned IsDynamicReplaceable : 1 ;
202
219
203
- // / If != OptimizationMode::NotSet, the optimization mode specified with an
204
- // / function attribute.
205
- OptimizationMode OptMode;
206
-
207
- // / This is the number of uses of this SILFunction inside the SIL.
208
- // / It does not include references from debug scopes.
209
- unsigned RefCount = 0 ;
210
-
211
- // / The function's set of semantics attributes.
212
- // /
213
- // / TODO: Why is this using a std::string? Why don't we use uniqued
214
- // / StringRefs?
215
- llvm::SmallVector<std::string, 1 > SemanticsAttrSet;
216
-
217
- // / The function's remaining set of specialize attributes.
218
- std::vector<SILSpecializeAttr*> SpecializeAttrSet;
219
-
220
- // / The function's effects attribute.
221
- EffectsKind EffectsKindAttr;
222
-
223
- // / Has value if there's a profile for this function
224
- // / Contains Function Entry Count
225
- ProfileCounter EntryCount;
226
-
227
220
// / True if this function is inlined at least once. This means that the
228
221
// / debug info keeps a pointer to this function.
229
- bool Inlined = false ;
222
+ unsigned Inlined : 1 ;
230
223
231
224
// / True if this function is a zombie function. This means that the function
232
225
// / is dead and not referenced from anywhere inside the SIL. But it is kept
@@ -235,28 +228,35 @@ class SILFunction
235
228
// / *) It is a dead method of a class which has higher visibility than the
236
229
// / method itself. In this case we need to create a vtable stub for it.
237
230
// / *) It is a function referenced by the specialization information.
238
- bool Zombie = false ;
231
+ unsigned Zombie : 1 ;
239
232
240
233
// / True if this function is in Ownership SSA form and thus must pass
241
234
// / ownership verification.
242
235
// /
243
236
// / This enables the verifier to easily prove that before the Ownership Model
244
237
// / Eliminator runs on a function, we only see a non-semantic-arc world and
245
238
// / after the pass runs, we only see a semantic-arc world.
246
- bool HasOwnership = true ;
239
+ unsigned HasOwnership : 1 ;
247
240
248
241
// / Set if the function body was deserialized from canonical SIL. This implies
249
242
// / that the function's home module performed SIL diagnostics prior to
250
243
// / serialization.
251
- bool WasDeserializedCanonical = false ;
244
+ unsigned WasDeserializedCanonical : 1 ;
252
245
253
246
// / True if this is a reabstraction thunk of escaping function type whose
254
247
// / single argument is a potentially non-escaping closure. This is an escape
255
248
// / hatch to allow non-escaping functions to be stored or passed as an
256
249
// / argument with escaping function type. The thunk argument's function type
257
250
// / is not necessarily @noescape. The only relevant aspect of the argument is
258
251
// / that it may have unboxed capture (i.e. @inout_aliasable parameters).
259
- bool IsWithoutActuallyEscapingThunk = false ;
252
+ unsigned IsWithoutActuallyEscapingThunk : 1 ;
253
+
254
+ // / If != OptimizationMode::NotSet, the optimization mode specified with an
255
+ // / function attribute.
256
+ unsigned OptMode : NumOptimizationModeBits;
257
+
258
+ // / The function's effects attribute.
259
+ unsigned EffectsKindAttr : NumEffectsKindBits;
260
260
261
261
static void
262
262
validateSubclassScope (SubclassScope scope, IsThunk_t isThunk,
@@ -650,13 +650,17 @@ class SILFunction
650
650
651
651
// / Get this function's optimization mode or OptimizationMode::NotSet if it is
652
652
// / not set for this specific function.
653
- OptimizationMode getOptimizationMode () const { return OptMode; }
653
+ OptimizationMode getOptimizationMode () const {
654
+ return OptimizationMode (OptMode);
655
+ }
654
656
655
657
// / Returns the optimization mode for the function. If no mode is set for the
656
658
// / function, returns the global mode, i.e. the mode of the module's options.
657
659
OptimizationMode getEffectiveOptimizationMode () const ;
658
660
659
- void setOptimizationMode (OptimizationMode mode) { OptMode = mode; }
661
+ void setOptimizationMode (OptimizationMode mode) {
662
+ OptMode = unsigned (mode);
663
+ }
660
664
661
665
// / \returns True if the function is optimizable (i.e. not marked as no-opt),
662
666
// / or is raw SIL (so that the mandatory passes still run).
@@ -726,16 +730,16 @@ class SILFunction
726
730
void setInlineStrategy (Inline_t inStr) { InlineStrategy = inStr; }
727
731
728
732
// / \return the function side effects information.
729
- EffectsKind getEffectsKind () const { return EffectsKindAttr; }
733
+ EffectsKind getEffectsKind () const { return EffectsKind ( EffectsKindAttr) ; }
730
734
731
735
// / \return True if the function is annotated with the @_effects attribute.
732
736
bool hasEffectsKind () const {
733
- return EffectsKindAttr != EffectsKind::Unspecified;
737
+ return EffectsKind ( EffectsKindAttr) != EffectsKind::Unspecified;
734
738
}
735
739
736
740
// / Set the function side effect information.
737
741
void setEffectsKind (EffectsKind E) {
738
- EffectsKindAttr = E ;
742
+ EffectsKindAttr = unsigned (E) ;
739
743
}
740
744
741
745
// / Get this function's global_init attribute.
0 commit comments