mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SIL: Use getConstantFunctionType() instead of getConstantType() in a few places
This commit is contained in:
@@ -312,7 +312,7 @@ SILFunction *SILModule::getOrCreateFunction(SILLocation loc,
|
|||||||
ProfileCounter entryCount) {
|
ProfileCounter entryCount) {
|
||||||
|
|
||||||
auto name = constant.mangle();
|
auto name = constant.mangle();
|
||||||
auto constantType = Types.getConstantType(constant).castTo<SILFunctionType>();
|
auto constantType = Types.getConstantFunctionType(constant);
|
||||||
SILLinkage linkage = constant.getLinkage(forDefinition);
|
SILLinkage linkage = constant.getLinkage(forDefinition);
|
||||||
|
|
||||||
if (auto fn = lookUpFunction(name)) {
|
if (auto fn = lookUpFunction(name)) {
|
||||||
|
|||||||
@@ -118,13 +118,13 @@ getBridgingFn(Optional<SILDeclRef> &cacheSlot,
|
|||||||
// Check that the function takes the expected arguments and returns the
|
// Check that the function takes the expected arguments and returns the
|
||||||
// expected result type.
|
// expected result type.
|
||||||
SILDeclRef c(fd);
|
SILDeclRef c(fd);
|
||||||
auto funcInfo = SGM.getConstantType(c).castTo<SILFunctionType>();
|
auto funcTy = SGM.Types.getConstantFunctionType(c);
|
||||||
SILFunctionConventions fnConv(funcInfo, SGM.M);
|
SILFunctionConventions fnConv(funcTy, SGM.M);
|
||||||
|
|
||||||
if (inputTypes) {
|
if (inputTypes) {
|
||||||
auto toSILType = [&SGM](Type ty) { return SGM.getLoweredType(ty); };
|
auto toSILType = [&SGM](Type ty) { return SGM.getLoweredType(ty); };
|
||||||
if (fnConv.hasIndirectSILResults()
|
if (fnConv.hasIndirectSILResults()
|
||||||
|| funcInfo->getNumParameters() != inputTypes->size()
|
|| funcTy->getNumParameters() != inputTypes->size()
|
||||||
|| !std::equal(
|
|| !std::equal(
|
||||||
fnConv.getParameterSILTypes().begin(),
|
fnConv.getParameterSILTypes().begin(),
|
||||||
fnConv.getParameterSILTypes().end(),
|
fnConv.getParameterSILTypes().end(),
|
||||||
@@ -445,10 +445,6 @@ SILFunction *SILGenModule::emitTopLevelFunction(SILLocation Loc) {
|
|||||||
SubclassScope::NotApplicable);
|
SubclassScope::NotApplicable);
|
||||||
}
|
}
|
||||||
|
|
||||||
SILType SILGenModule::getConstantType(SILDeclRef constant) {
|
|
||||||
return Types.getConstantType(constant);
|
|
||||||
}
|
|
||||||
|
|
||||||
SILFunction *SILGenModule::getEmittedFunction(SILDeclRef constant,
|
SILFunction *SILGenModule::getEmittedFunction(SILDeclRef constant,
|
||||||
ForDefinition_t forDefinition) {
|
ForDefinition_t forDefinition) {
|
||||||
auto found = emittedFunctions.find(constant);
|
auto found = emittedFunctions.find(constant);
|
||||||
|
|||||||
@@ -140,15 +140,6 @@ public:
|
|||||||
static DeclName getMagicFunctionName(SILDeclRef ref);
|
static DeclName getMagicFunctionName(SILDeclRef ref);
|
||||||
static DeclName getMagicFunctionName(DeclContext *dc);
|
static DeclName getMagicFunctionName(DeclContext *dc);
|
||||||
|
|
||||||
/// Returns the type of a constant reference.
|
|
||||||
SILType getConstantType(SILDeclRef constant);
|
|
||||||
|
|
||||||
/// Returns the calling convention for a function.
|
|
||||||
SILFunctionTypeRepresentation getDeclRefRepresentation(SILDeclRef constant) {
|
|
||||||
return getConstantType(constant).getAs<SILFunctionType>()
|
|
||||||
->getRepresentation();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Get the function for a SILDeclRef, or return nullptr if it hasn't been
|
/// Get the function for a SILDeclRef, or return nullptr if it hasn't been
|
||||||
/// emitted yet.
|
/// emitted yet.
|
||||||
SILFunction *getEmittedFunction(SILDeclRef constant,
|
SILFunction *getEmittedFunction(SILDeclRef constant,
|
||||||
|
|||||||
@@ -241,7 +241,7 @@ void SILGenFunction::emitObjCDestructor(SILDeclRef dtor) {
|
|||||||
auto superclassDtor = SILDeclRef(superclassDtorDecl,
|
auto superclassDtor = SILDeclRef(superclassDtorDecl,
|
||||||
SILDeclRef::Kind::Deallocator)
|
SILDeclRef::Kind::Deallocator)
|
||||||
.asForeign();
|
.asForeign();
|
||||||
auto superclassDtorType = SGM.getConstantType(superclassDtor);
|
auto superclassDtorType = SGM.Types.getConstantType(superclassDtor);
|
||||||
SILValue superclassDtorValue = B.createObjCSuperMethod(
|
SILValue superclassDtorValue = B.createObjCSuperMethod(
|
||||||
cleanupLoc, selfValue, superclassDtor,
|
cleanupLoc, selfValue, superclassDtor,
|
||||||
superclassDtorType);
|
superclassDtorType);
|
||||||
|
|||||||
Reference in New Issue
Block a user