Skip to content

Commit 7089bf6

Browse files
committed
[nfc] rename one of the two emitPrologs in SILGen
There's a basic prolog emission function, used by value and class constructors, etc, and then there's the full-blown one for functions and closures, which uses the basic version.
1 parent 5fec104 commit 7089bf6

File tree

4 files changed

+23
-22
lines changed

4 files changed

+23
-22
lines changed

lib/SILGen/SILGenConstructor.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -350,11 +350,11 @@ void SILGenFunction::emitValueConstructor(ConstructorDecl *ctor) {
350350
SILValue selfLV = VarLocs[selfDecl].value;
351351

352352
// Emit the prolog.
353-
emitProlog(ctor->getParameters(),
354-
/*selfParam=*/nullptr,
355-
ctor->getResultInterfaceType(), ctor,
356-
ctor->hasThrows(),
357-
ctor->getThrowsLoc());
353+
emitBasicProlog(ctor->getParameters(),
354+
/*selfParam=*/nullptr,
355+
ctor->getResultInterfaceType(), ctor,
356+
ctor->hasThrows(),
357+
ctor->getThrowsLoc());
358358
emitConstructorMetatypeArg(*this, ctor);
359359

360360
// Create a basic block to jump to for the implicit 'self' return.
@@ -717,9 +717,9 @@ void SILGenFunction::emitClassConstructorInitializer(ConstructorDecl *ctor) {
717717

718718
// Emit the prolog for the non-self arguments.
719719
// FIXME: Handle self along with the other body patterns.
720-
uint16_t ArgNo = emitProlog(ctor->getParameters(), /*selfParam=*/nullptr,
721-
TupleType::getEmpty(F.getASTContext()), ctor,
722-
ctor->hasThrows(), ctor->getThrowsLoc());
720+
uint16_t ArgNo = emitBasicProlog(ctor->getParameters(), /*selfParam=*/nullptr,
721+
TupleType::getEmpty(F.getASTContext()), ctor,
722+
ctor->hasThrows(), ctor->getThrowsLoc());
723723

724724
SILType selfTy = getLoweredLoadableType(selfDecl->getType());
725725
ManagedValue selfArg = B.createInputFunctionArgument(selfTy, selfDecl);

lib/SILGen/SILGenFunction.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -997,8 +997,8 @@ void SILGenFunction::emitGeneratorFunction(SILDeclRef function, VarDecl *var) {
997997
}
998998
}
999999

1000-
emitProlog(/*paramList*/ nullptr, /*selfParam*/ nullptr, interfaceType, dc,
1001-
/*throws=*/false, SourceLoc());
1000+
emitBasicProlog(/*paramList*/ nullptr, /*selfParam*/ nullptr,
1001+
interfaceType, dc, /*throws=*/ false,SourceLoc());
10021002
prepareEpilog(true, false, CleanupLocation(loc));
10031003

10041004
auto pbd = var->getParentPatternBinding();

lib/SILGen/SILGenFunction.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -876,10 +876,11 @@ class LLVM_LIBRARY_VISIBILITY SILGenFunction
876876
ParameterList *paramList, ParamDecl *selfParam,
877877
DeclContext *DC, Type resultType,
878878
bool throws, SourceLoc throwsLoc);
879-
/// returns the number of variables in paramPatterns.
880-
uint16_t emitProlog(ParameterList *paramList, ParamDecl *selfParam,
881-
Type resultType, DeclContext *DC,
882-
bool throws, SourceLoc throwsLoc);
879+
/// A simpler version of emitProlog
880+
/// \returns the number of variables in paramPatterns.
881+
uint16_t emitBasicProlog(ParameterList *paramList, ParamDecl *selfParam,
882+
Type resultType, DeclContext *DC,
883+
bool throws, SourceLoc throwsLoc);
883884

884885
/// Create SILArguments in the entry block that bind a single value
885886
/// of the given parameter suitably for being forwarded.

lib/SILGen/SILGenProlog.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -411,8 +411,8 @@ void SILGenFunction::emitProlog(CaptureInfo captureInfo,
411411
Type resultType,
412412
bool throws,
413413
SourceLoc throwsLoc) {
414-
uint16_t ArgNo = emitProlog(paramList, selfParam, resultType,
415-
DC, throws, throwsLoc);
414+
uint16_t ArgNo = emitBasicProlog(paramList, selfParam, resultType,
415+
DC, throws, throwsLoc);
416416

417417
// Emit the capture argument variables. These are placed last because they
418418
// become the first curry level of the SIL function.
@@ -733,12 +733,12 @@ static void emitIndirectResultParameters(SILGenFunction &SGF, Type resultType,
733733
(void)arg;
734734
}
735735

736-
uint16_t SILGenFunction::emitProlog(ParameterList *paramList,
737-
ParamDecl *selfParam,
738-
Type resultType,
739-
DeclContext *DC,
740-
bool throws,
741-
SourceLoc throwsLoc) {
736+
uint16_t SILGenFunction::emitBasicProlog(ParameterList *paramList,
737+
ParamDecl *selfParam,
738+
Type resultType,
739+
DeclContext *DC,
740+
bool throws,
741+
SourceLoc throwsLoc) {
742742
// Create the indirect result parameters.
743743
auto genericSig = DC->getGenericSignatureOfContext();
744744
resultType = resultType->getCanonicalType(genericSig);

0 commit comments

Comments
 (0)