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) {
|
||||
|
||||
auto name = constant.mangle();
|
||||
auto constantType = Types.getConstantType(constant).castTo<SILFunctionType>();
|
||||
auto constantType = Types.getConstantFunctionType(constant);
|
||||
SILLinkage linkage = constant.getLinkage(forDefinition);
|
||||
|
||||
if (auto fn = lookUpFunction(name)) {
|
||||
|
||||
@@ -118,13 +118,13 @@ getBridgingFn(Optional<SILDeclRef> &cacheSlot,
|
||||
// Check that the function takes the expected arguments and returns the
|
||||
// expected result type.
|
||||
SILDeclRef c(fd);
|
||||
auto funcInfo = SGM.getConstantType(c).castTo<SILFunctionType>();
|
||||
SILFunctionConventions fnConv(funcInfo, SGM.M);
|
||||
auto funcTy = SGM.Types.getConstantFunctionType(c);
|
||||
SILFunctionConventions fnConv(funcTy, SGM.M);
|
||||
|
||||
if (inputTypes) {
|
||||
auto toSILType = [&SGM](Type ty) { return SGM.getLoweredType(ty); };
|
||||
if (fnConv.hasIndirectSILResults()
|
||||
|| funcInfo->getNumParameters() != inputTypes->size()
|
||||
|| funcTy->getNumParameters() != inputTypes->size()
|
||||
|| !std::equal(
|
||||
fnConv.getParameterSILTypes().begin(),
|
||||
fnConv.getParameterSILTypes().end(),
|
||||
@@ -445,10 +445,6 @@ SILFunction *SILGenModule::emitTopLevelFunction(SILLocation Loc) {
|
||||
SubclassScope::NotApplicable);
|
||||
}
|
||||
|
||||
SILType SILGenModule::getConstantType(SILDeclRef constant) {
|
||||
return Types.getConstantType(constant);
|
||||
}
|
||||
|
||||
SILFunction *SILGenModule::getEmittedFunction(SILDeclRef constant,
|
||||
ForDefinition_t forDefinition) {
|
||||
auto found = emittedFunctions.find(constant);
|
||||
|
||||
@@ -140,15 +140,6 @@ public:
|
||||
static DeclName getMagicFunctionName(SILDeclRef ref);
|
||||
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
|
||||
/// emitted yet.
|
||||
SILFunction *getEmittedFunction(SILDeclRef constant,
|
||||
|
||||
@@ -241,7 +241,7 @@ void SILGenFunction::emitObjCDestructor(SILDeclRef dtor) {
|
||||
auto superclassDtor = SILDeclRef(superclassDtorDecl,
|
||||
SILDeclRef::Kind::Deallocator)
|
||||
.asForeign();
|
||||
auto superclassDtorType = SGM.getConstantType(superclassDtor);
|
||||
auto superclassDtorType = SGM.Types.getConstantType(superclassDtor);
|
||||
SILValue superclassDtorValue = B.createObjCSuperMethod(
|
||||
cleanupLoc, selfValue, superclassDtor,
|
||||
superclassDtorType);
|
||||
|
||||
Reference in New Issue
Block a user