@@ -991,7 +991,7 @@ class OuterPackArgGenerator {
991
991
992
992
// / A CRTP helper class for classes that supervise a translation between
993
993
// / inner and outer signatures.
994
- template <class Impl >
994
+ template <class Impl , class InnerSlotType >
995
995
class ExpanderBase {
996
996
protected:
997
997
Impl &asImpl () { return static_cast <Impl&>(*this ); }
@@ -1037,7 +1037,7 @@ class ExpanderBase {
1037
1037
CanTupleType innerSubstType,
1038
1038
AbstractionPattern outerOrigType,
1039
1039
CanTupleType outerSubstType,
1040
- IndirectSlot innerAddr);
1040
+ InnerSlotType innerAddr);
1041
1041
void expandParallelTuplesOuterIndirect (AbstractionPattern innerOrigType,
1042
1042
CanTupleType innerSubstType,
1043
1043
AbstractionPattern outerOrigType,
@@ -1048,7 +1048,7 @@ class ExpanderBase {
1048
1048
CanType innerSubstType,
1049
1049
AbstractionPattern outerOrigType,
1050
1050
CanType outerSubstType,
1051
- IndirectSlot innerSlot);
1051
+ InnerSlotType innerSlot);
1052
1052
1053
1053
void expandOuterIndirect (AbstractionPattern innerOrigType,
1054
1054
CanType innerSubstType,
@@ -1214,7 +1214,8 @@ class ParamInfo {
1214
1214
// / we are emitting the body of that closure, and therefore the inputs
1215
1215
// / we receive are the parameters of that closure, matching the lowered
1216
1216
// / signature of the second function type.)
1217
- class TranslateArguments : public ExpanderBase <TranslateArguments> {
1217
+ class TranslateArguments :
1218
+ public ExpanderBase<TranslateArguments, ParamInfo> {
1218
1219
SmallVectorImpl<ManagedValue> &InnerArgs;
1219
1220
CanSILFunctionType InnerTypesFuncTy;
1220
1221
ArrayRef<SILParameterInfo> InnerTypes;
@@ -2735,7 +2736,7 @@ namespace {
2735
2736
// / - building a list of SILValues for each of the inner indirect results
2736
2737
// / - building a list of Operations to perform which will reabstract
2737
2738
// / the inner results to match the outer.
2738
- class ResultPlanner : public ExpanderBase <ResultPlanner> {
2739
+ class ResultPlanner : public ExpanderBase <ResultPlanner, IndirectSlot > {
2739
2740
// / A single result-translation operation.
2740
2741
struct Operation {
2741
2742
enum Kind {
@@ -3264,11 +3265,12 @@ class ResultPlanner : public ExpanderBase<ResultPlanner> {
3264
3265
3265
3266
// / The general case of translation, where we may need to
3266
3267
// / expand tuples.
3267
- template <class Impl >
3268
- void ExpanderBase<Impl>::expand(AbstractionPattern innerOrigType,
3269
- CanType innerSubstType,
3270
- AbstractionPattern outerOrigType,
3271
- CanType outerSubstType) {
3268
+ template <class Impl , class InnerSlotType >
3269
+ void ExpanderBase<Impl, InnerSlotType>::expand(
3270
+ AbstractionPattern innerOrigType,
3271
+ CanType innerSubstType,
3272
+ AbstractionPattern outerOrigType,
3273
+ CanType outerSubstType) {
3272
3274
// The substituted types must match up in tuple-ness and arity.
3273
3275
assert (
3274
3276
isa<TupleType>(innerSubstType) == isa<TupleType>(outerSubstType) ||
@@ -3337,8 +3339,8 @@ void ExpanderBase<Impl>::expand(AbstractionPattern innerOrigType,
3337
3339
}
3338
3340
}
3339
3341
3340
- template <class Impl >
3341
- void ExpanderBase<Impl>::expandOuterVanishingTuple(
3342
+ template <class Impl , class InnerSlotType >
3343
+ void ExpanderBase<Impl, InnerSlotType >::expandOuterVanishingTuple(
3342
3344
AbstractionPattern outerOrigType,
3343
3345
CanType outerSubstType,
3344
3346
llvm::function_ref<void (AbstractionPattern outerOrigEltType,
@@ -3372,8 +3374,8 @@ void ExpanderBase<Impl>::expandOuterVanishingTuple(
3372
3374
assert (foundSurvivor && " vanishing tuple had no surviving element?" );
3373
3375
}
3374
3376
3375
- template <class Impl >
3376
- void ExpanderBase<Impl>::expandInnerVanishingTuple(
3377
+ template <class Impl , class InnerSlotType >
3378
+ void ExpanderBase<Impl, InnerSlotType >::expandInnerVanishingTuple(
3377
3379
AbstractionPattern innerOrigType,
3378
3380
CanType innerSubstType,
3379
3381
llvm::function_ref<void (AbstractionPattern innerOrigEltType,
@@ -3409,8 +3411,8 @@ void ExpanderBase<Impl>::expandInnerVanishingTuple(
3409
3411
assert (foundSurvivor && " vanishing tuple had no surviving element?" );
3410
3412
}
3411
3413
3412
- template <class Impl >
3413
- void ExpanderBase<Impl>::expandParallelTuples(
3414
+ template <class Impl , class InnerSlotType >
3415
+ void ExpanderBase<Impl, InnerSlotType >::expandParallelTuples(
3414
3416
AbstractionPattern innerOrigType,
3415
3417
CanType innerSubstType,
3416
3418
AbstractionPattern outerOrigType,
@@ -3796,8 +3798,8 @@ void ResultPlanner::planSingle(AbstractionPattern innerOrigType,
3796
3798
}
3797
3799
3798
3800
// / Plan the emission of a call result into an outer result address.
3799
- template <class Impl >
3800
- void ExpanderBase<Impl>::expandOuterIndirect(
3801
+ template <class Impl , class InnerSlotType >
3802
+ void ExpanderBase<Impl, InnerSlotType >::expandOuterIndirect(
3801
3803
AbstractionPattern innerOrigType,
3802
3804
CanType innerSubstType,
3803
3805
AbstractionPattern outerOrigType,
@@ -3920,8 +3922,8 @@ ResultPlanner::expandInnerTupleOuterIndirect(AbstractionPattern innerOrigType,
3920
3922
outerResultAddrMV);
3921
3923
}
3922
3924
3923
- template <class Impl >
3924
- void ExpanderBase<Impl>::expandParallelTuplesOuterIndirect(
3925
+ template <class Impl , class InnerSlotType >
3926
+ void ExpanderBase<Impl, InnerSlotType >::expandParallelTuplesOuterIndirect(
3925
3927
AbstractionPattern innerOrigType,
3926
3928
CanTupleType innerSubstType,
3927
3929
AbstractionPattern outerOrigType,
@@ -4228,13 +4230,13 @@ ResultPlanner::planSingleIntoIndirect(AbstractionPattern innerOrigType,
4228
4230
}
4229
4231
4230
4232
// / Plan the emission of a call result from an inner result address.
4231
- template <class Impl >
4232
- ManagedValue
4233
- ExpanderBase<Impl>::expandInnerIndirect( AbstractionPattern innerOrigType,
4233
+ template <class Impl , class InnerSlotType >
4234
+ ManagedValue ExpanderBase<Impl, InnerSlotType>::expandInnerIndirect(
4235
+ AbstractionPattern innerOrigType,
4234
4236
CanType innerSubstType,
4235
4237
AbstractionPattern outerOrigType,
4236
4238
CanType outerSubstType,
4237
- IndirectSlot innerSlot) {
4239
+ InnerSlotType innerSlot) {
4238
4240
assert (!innerOrigType.isTuple ());
4239
4241
4240
4242
// If the outer pattern is scalar, stop expansion and delegate to the
@@ -4293,14 +4295,14 @@ ManagedValue ResultPlanner::expandOuterTupleInnerIndirect(
4293
4295
4294
4296
// / Expand outer tuple structure, given that the inner substituted type
4295
4297
// / is a tuple with parallel structured that's passed indirectly.
4296
- template <class Impl >
4298
+ template <class Impl , class InnerSlotType >
4297
4299
ManagedValue
4298
- ExpanderBase<Impl>::expandParallelTuplesInnerIndirect(
4300
+ ExpanderBase<Impl, InnerSlotType >::expandParallelTuplesInnerIndirect(
4299
4301
AbstractionPattern innerOrigType,
4300
4302
CanTupleType innerSubstType,
4301
4303
AbstractionPattern outerOrigType,
4302
4304
CanTupleType outerSubstType,
4303
- IndirectSlot innerTupleSlot) {
4305
+ InnerSlotType innerTupleSlot) {
4304
4306
assert (innerSubstType->getNumElements () == outerSubstType->getNumElements ());
4305
4307
assert (outerOrigType.isTuple ());
4306
4308
assert (!outerOrigType.doesTupleVanish ());
0 commit comments