39
39
using namespace swift ;
40
40
using namespace Lowering ;
41
41
42
+ // ===----------------------------------------------------------------------===//
43
+ // Utility Functions
44
+ // ===----------------------------------------------------------------------===//
45
+
42
46
// / Return the abstraction pattern to use when calling a function value.
43
47
static AbstractionPattern
44
48
getIndirectApplyAbstractionPattern (SILGenFunction &SGF,
@@ -219,6 +223,10 @@ static void convertOwnershipConventionsGivenParamInfos(
219
223
});
220
224
}
221
225
226
+ // ===----------------------------------------------------------------------===//
227
+ // Callee
228
+ // ===----------------------------------------------------------------------===//
229
+
222
230
namespace {
223
231
224
232
// / Abstractly represents a callee, which may be a constant or function value,
@@ -692,6 +700,12 @@ class Callee {
692
700
}
693
701
};
694
702
703
+ } // end anonymous namespace
704
+
705
+ // ===----------------------------------------------------------------------===//
706
+ // SILGenApply ASTVisitor
707
+ // ===----------------------------------------------------------------------===//
708
+
695
709
// / For ObjC init methods, we generate a shared-linkage Swift allocating entry
696
710
// / point that does the [[T alloc] init] dance. We want to use this native
697
711
// / thunk where we expect to be calling an allocating entry point for an ObjC
@@ -700,6 +714,8 @@ static bool isConstructorWithGeneratedAllocatorThunk(ValueDecl *vd) {
700
714
return vd->isObjC () && isa<ConstructorDecl>(vd);
701
715
}
702
716
717
+ namespace {
718
+
703
719
// / An ASTVisitor for decomposing a nesting of ApplyExprs into an initial
704
720
// / Callee and a list of CallSites. The CallEmission class below uses these
705
721
// / to generate the actual SIL call.
@@ -1832,6 +1848,10 @@ RValue SILGenFunction::emitMonomorphicApply(SILLocation loc,
1832
1848
args, calleeTypeInfo, options, evalContext, postpone);
1833
1849
}
1834
1850
1851
+ // ===----------------------------------------------------------------------===//
1852
+ // Argument Emission
1853
+ // ===----------------------------------------------------------------------===//
1854
+
1835
1855
// / Count the number of SILParameterInfos that are needed in order to
1836
1856
// / pass the given argument.
1837
1857
static unsigned getFlattenedValueCount (AbstractionPattern origType,
@@ -3682,7 +3702,13 @@ namespace {
3682
3702
assert (Params.empty () && " didn't consume all the parameters" );
3683
3703
}
3684
3704
};
3705
+ } // end anonymous namespace
3685
3706
3707
+ // ===----------------------------------------------------------------------===//
3708
+ // CallSite
3709
+ // ===----------------------------------------------------------------------===//
3710
+
3711
+ namespace {
3686
3712
// / An application of possibly unevaluated arguments in the form of an
3687
3713
// / ArgumentSource to a Callee.
3688
3714
class CallSite {
@@ -3743,7 +3769,13 @@ namespace {
3743
3769
return std::move (ArgValue);
3744
3770
}
3745
3771
};
3772
+ } // end anonymous namespace
3746
3773
3774
+ // ===----------------------------------------------------------------------===//
3775
+ // CallEmission
3776
+ // ===----------------------------------------------------------------------===//
3777
+
3778
+ namespace {
3747
3779
// / Once the Callee and CallSites have been prepared by SILGenApply,
3748
3780
// / generate SIL for a fully-formed call.
3749
3781
// /
@@ -4390,6 +4422,10 @@ CallEmission CallEmission::forApplyExpr(SILGenFunction &SGF, Expr *e) {
4390
4422
return emission;
4391
4423
}
4392
4424
4425
+ // ===----------------------------------------------------------------------===//
4426
+ // Top Level Entrypoints
4427
+ // ===----------------------------------------------------------------------===//
4428
+
4393
4429
RValue SILGenFunction::emitApplyExpr (Expr *e, SGFContext c) {
4394
4430
CallEmission emission = CallEmission::forApplyExpr (*this , e);
4395
4431
return emission.apply (c);
0 commit comments