@@ -62,6 +62,11 @@ class ReabstractionInfo {
6262 // / argument has a trivial type.
6363 SmallBitVector TrivialArgs;
6464
65+ // / A 1-bit means that the argument is a metatype argument. The argument is
66+ // / dropped and replaced by a `metatype` instruction in the entry block.
67+ // / Only used if `dropMetatypeArgs` is true.
68+ SmallBitVector droppedMetatypeArgs;
69+
6570 // / Set to true if the function has a re-abstracted (= converted from
6671 // / indirect to direct) resilient argument or return type. This can happen if
6772 // / the function is compiled within the type's resilience domain, i.e. in
@@ -79,6 +84,10 @@ class ReabstractionInfo {
7984 // / specializer.
8085 bool ConvertIndirectToDirect;
8186
87+ // / If true, drop metatype arguments.
88+ // / See `droppedMetatypeArgs`.
89+ bool dropMetatypeArgs = false ;
90+
8291 // / The first NumResults bits in Conversions refer to formal indirect
8392 // / out-parameters.
8493 unsigned NumFormalIndirectResults;
@@ -191,6 +200,7 @@ class ReabstractionInfo {
191200 SubstitutionMap ParamSubs,
192201 IsSerialized_t Serialized,
193202 bool ConvertIndirectToDirect = true ,
203+ bool dropMetatypeArgs = false ,
194204 OptRemark::Emitter *ORE = nullptr );
195205
196206 // / Constructs the ReabstractionInfo for generic function \p Callee with
@@ -243,6 +253,16 @@ class ReabstractionInfo {
243253 // / Returns true if there are any conversions from indirect to direct values.
244254 bool hasConversions () const { return Conversions.any (); }
245255
256+ // / Returns true if the argument at `ArgIdx` is a dropped metatype argument.
257+ // / See `droppedMetatypeArgs`.
258+ bool isDroppedMetatypeArg (unsigned ArgIdx) const {
259+ return droppedMetatypeArgs.test (ArgIdx);
260+ }
261+
262+ // / Returns true if there are any dropped metatype arguments.
263+ // / See `droppedMetatypeArgs`.
264+ bool hasDroppedMetatypeArgs () const { return droppedMetatypeArgs.any (); }
265+
246266 // / Remove the arguments of a partial apply, leaving the arguments for the
247267 // / partial apply result function.
248268 void prunePartialApplyArgs (unsigned numPartialApplyArgs) {
0 commit comments