@@ -991,7 +991,7 @@ class OuterPackArgGenerator {
991991
992992// / A CRTP helper class for classes that supervise a translation between
993993// / inner and outer signatures.
994- template <class Impl >
994+ template <class Impl , class InnerSlotType >
995995class ExpanderBase {
996996protected:
997997 Impl &asImpl () { return static_cast <Impl&>(*this ); }
@@ -1037,7 +1037,7 @@ class ExpanderBase {
10371037 CanTupleType innerSubstType,
10381038 AbstractionPattern outerOrigType,
10391039 CanTupleType outerSubstType,
1040- IndirectSlot innerAddr);
1040+ InnerSlotType innerAddr);
10411041 void expandParallelTuplesOuterIndirect (AbstractionPattern innerOrigType,
10421042 CanTupleType innerSubstType,
10431043 AbstractionPattern outerOrigType,
@@ -1048,7 +1048,7 @@ class ExpanderBase {
10481048 CanType innerSubstType,
10491049 AbstractionPattern outerOrigType,
10501050 CanType outerSubstType,
1051- IndirectSlot innerSlot);
1051+ InnerSlotType innerSlot);
10521052
10531053 void expandOuterIndirect (AbstractionPattern innerOrigType,
10541054 CanType innerSubstType,
@@ -1214,7 +1214,8 @@ class ParamInfo {
12141214// / we are emitting the body of that closure, and therefore the inputs
12151215// / we receive are the parameters of that closure, matching the lowered
12161216// / signature of the second function type.)
1217- class TranslateArguments : public ExpanderBase <TranslateArguments> {
1217+ class TranslateArguments :
1218+ public ExpanderBase<TranslateArguments, ParamInfo> {
12181219 SmallVectorImpl<ManagedValue> &InnerArgs;
12191220 CanSILFunctionType InnerTypesFuncTy;
12201221 ArrayRef<SILParameterInfo> InnerTypes;
@@ -2735,7 +2736,7 @@ namespace {
27352736// / - building a list of SILValues for each of the inner indirect results
27362737// / - building a list of Operations to perform which will reabstract
27372738// / the inner results to match the outer.
2738- class ResultPlanner : public ExpanderBase <ResultPlanner> {
2739+ class ResultPlanner : public ExpanderBase <ResultPlanner, IndirectSlot > {
27392740 // / A single result-translation operation.
27402741 struct Operation {
27412742 enum Kind {
@@ -3264,11 +3265,12 @@ class ResultPlanner : public ExpanderBase<ResultPlanner> {
32643265
32653266// / The general case of translation, where we may need to
32663267// / 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) {
32723274 // The substituted types must match up in tuple-ness and arity.
32733275 assert (
32743276 isa<TupleType>(innerSubstType) == isa<TupleType>(outerSubstType) ||
@@ -3337,8 +3339,8 @@ void ExpanderBase<Impl>::expand(AbstractionPattern innerOrigType,
33373339 }
33383340}
33393341
3340- template <class Impl >
3341- void ExpanderBase<Impl>::expandOuterVanishingTuple(
3342+ template <class Impl , class InnerSlotType >
3343+ void ExpanderBase<Impl, InnerSlotType >::expandOuterVanishingTuple(
33423344 AbstractionPattern outerOrigType,
33433345 CanType outerSubstType,
33443346 llvm::function_ref<void (AbstractionPattern outerOrigEltType,
@@ -3372,8 +3374,8 @@ void ExpanderBase<Impl>::expandOuterVanishingTuple(
33723374 assert (foundSurvivor && " vanishing tuple had no surviving element?" );
33733375}
33743376
3375- template <class Impl >
3376- void ExpanderBase<Impl>::expandInnerVanishingTuple(
3377+ template <class Impl , class InnerSlotType >
3378+ void ExpanderBase<Impl, InnerSlotType >::expandInnerVanishingTuple(
33773379 AbstractionPattern innerOrigType,
33783380 CanType innerSubstType,
33793381 llvm::function_ref<void (AbstractionPattern innerOrigEltType,
@@ -3409,8 +3411,8 @@ void ExpanderBase<Impl>::expandInnerVanishingTuple(
34093411 assert (foundSurvivor && " vanishing tuple had no surviving element?" );
34103412}
34113413
3412- template <class Impl >
3413- void ExpanderBase<Impl>::expandParallelTuples(
3414+ template <class Impl , class InnerSlotType >
3415+ void ExpanderBase<Impl, InnerSlotType >::expandParallelTuples(
34143416 AbstractionPattern innerOrigType,
34153417 CanType innerSubstType,
34163418 AbstractionPattern outerOrigType,
@@ -3796,8 +3798,8 @@ void ResultPlanner::planSingle(AbstractionPattern innerOrigType,
37963798}
37973799
37983800// / 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(
38013803 AbstractionPattern innerOrigType,
38023804 CanType innerSubstType,
38033805 AbstractionPattern outerOrigType,
@@ -3920,8 +3922,8 @@ ResultPlanner::expandInnerTupleOuterIndirect(AbstractionPattern innerOrigType,
39203922 outerResultAddrMV);
39213923}
39223924
3923- template <class Impl >
3924- void ExpanderBase<Impl>::expandParallelTuplesOuterIndirect(
3925+ template <class Impl , class InnerSlotType >
3926+ void ExpanderBase<Impl, InnerSlotType >::expandParallelTuplesOuterIndirect(
39253927 AbstractionPattern innerOrigType,
39263928 CanTupleType innerSubstType,
39273929 AbstractionPattern outerOrigType,
@@ -4228,13 +4230,13 @@ ResultPlanner::planSingleIntoIndirect(AbstractionPattern innerOrigType,
42284230}
42294231
42304232// / 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,
42344236 CanType innerSubstType,
42354237 AbstractionPattern outerOrigType,
42364238 CanType outerSubstType,
4237- IndirectSlot innerSlot) {
4239+ InnerSlotType innerSlot) {
42384240 assert (!innerOrigType.isTuple ());
42394241
42404242 // If the outer pattern is scalar, stop expansion and delegate to the
@@ -4293,14 +4295,14 @@ ManagedValue ResultPlanner::expandOuterTupleInnerIndirect(
42934295
42944296// / Expand outer tuple structure, given that the inner substituted type
42954297// / is a tuple with parallel structured that's passed indirectly.
4296- template <class Impl >
4298+ template <class Impl , class InnerSlotType >
42974299ManagedValue
4298- ExpanderBase<Impl>::expandParallelTuplesInnerIndirect(
4300+ ExpanderBase<Impl, InnerSlotType >::expandParallelTuplesInnerIndirect(
42994301 AbstractionPattern innerOrigType,
43004302 CanTupleType innerSubstType,
43014303 AbstractionPattern outerOrigType,
43024304 CanTupleType outerSubstType,
4303- IndirectSlot innerTupleSlot) {
4305+ InnerSlotType innerTupleSlot) {
43044306 assert (innerSubstType->getNumElements () == outerSubstType->getNumElements ());
43054307 assert (outerOrigType.isTuple ());
43064308 assert (!outerOrigType.doesTupleVanish ());
0 commit comments