Skip to content

Commit b74ed23

Browse files
committed
[silgen] Add some "flags" to SILGenApply.cpp to organize it a little better.
1 parent 706e3db commit b74ed23

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

lib/SILGen/SILGenApply.cpp

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@
3939
using namespace swift;
4040
using namespace Lowering;
4141

42+
//===----------------------------------------------------------------------===//
43+
// Utility Functions
44+
//===----------------------------------------------------------------------===//
45+
4246
/// Return the abstraction pattern to use when calling a function value.
4347
static AbstractionPattern
4448
getIndirectApplyAbstractionPattern(SILGenFunction &SGF,
@@ -219,6 +223,10 @@ static void convertOwnershipConventionsGivenParamInfos(
219223
});
220224
}
221225

226+
//===----------------------------------------------------------------------===//
227+
// Callee
228+
//===----------------------------------------------------------------------===//
229+
222230
namespace {
223231

224232
/// Abstractly represents a callee, which may be a constant or function value,
@@ -692,6 +700,12 @@ class Callee {
692700
}
693701
};
694702

703+
} // end anonymous namespace
704+
705+
//===----------------------------------------------------------------------===//
706+
// SILGenApply ASTVisitor
707+
//===----------------------------------------------------------------------===//
708+
695709
/// For ObjC init methods, we generate a shared-linkage Swift allocating entry
696710
/// point that does the [[T alloc] init] dance. We want to use this native
697711
/// thunk where we expect to be calling an allocating entry point for an ObjC
@@ -700,6 +714,8 @@ static bool isConstructorWithGeneratedAllocatorThunk(ValueDecl *vd) {
700714
return vd->isObjC() && isa<ConstructorDecl>(vd);
701715
}
702716

717+
namespace {
718+
703719
/// An ASTVisitor for decomposing a nesting of ApplyExprs into an initial
704720
/// Callee and a list of CallSites. The CallEmission class below uses these
705721
/// to generate the actual SIL call.
@@ -1832,6 +1848,10 @@ RValue SILGenFunction::emitMonomorphicApply(SILLocation loc,
18321848
args, calleeTypeInfo, options, evalContext, postpone);
18331849
}
18341850

1851+
//===----------------------------------------------------------------------===//
1852+
// Argument Emission
1853+
//===----------------------------------------------------------------------===//
1854+
18351855
/// Count the number of SILParameterInfos that are needed in order to
18361856
/// pass the given argument.
18371857
static unsigned getFlattenedValueCount(AbstractionPattern origType,
@@ -3682,7 +3702,13 @@ namespace {
36823702
assert(Params.empty() && "didn't consume all the parameters");
36833703
}
36843704
};
3705+
} // end anonymous namespace
36853706

3707+
//===----------------------------------------------------------------------===//
3708+
// CallSite
3709+
//===----------------------------------------------------------------------===//
3710+
3711+
namespace {
36863712
/// An application of possibly unevaluated arguments in the form of an
36873713
/// ArgumentSource to a Callee.
36883714
class CallSite {
@@ -3743,7 +3769,13 @@ namespace {
37433769
return std::move(ArgValue);
37443770
}
37453771
};
3772+
} // end anonymous namespace
37463773

3774+
//===----------------------------------------------------------------------===//
3775+
// CallEmission
3776+
//===----------------------------------------------------------------------===//
3777+
3778+
namespace {
37473779
/// Once the Callee and CallSites have been prepared by SILGenApply,
37483780
/// generate SIL for a fully-formed call.
37493781
///
@@ -4390,6 +4422,10 @@ CallEmission CallEmission::forApplyExpr(SILGenFunction &SGF, Expr *e) {
43904422
return emission;
43914423
}
43924424

4425+
//===----------------------------------------------------------------------===//
4426+
// Top Level Entrypoints
4427+
//===----------------------------------------------------------------------===//
4428+
43934429
RValue SILGenFunction::emitApplyExpr(Expr *e, SGFContext c) {
43944430
CallEmission emission = CallEmission::forApplyExpr(*this, e);
43954431
return emission.apply(c);

0 commit comments

Comments
 (0)