Drop the non-interface types from SILFunctionType.

There are some straggling references to the context generic param list, but nothing uses the non-interface param or result types anymore!

Swift SVN r13725
This commit is contained in:
Joe Groff
2014-02-09 22:39:01 +00:00
parent 201e1d9bf9
commit 481fbb7b91
17 changed files with 25 additions and 258 deletions

View File

@@ -2604,8 +2604,7 @@ Type ModuleFile::getType(TypeID TID) {
}
case decls_block::SIL_FUNCTION_TYPE: {
TypeID resultID, interfaceResultID;
uint8_t rawResultConvention;
TypeID interfaceResultID;
uint8_t rawInterfaceResultConvention;
uint8_t rawCallingConvention;
uint8_t rawCalleeConvention;
@@ -2616,8 +2615,6 @@ Type ModuleFile::getType(TypeID TID) {
ArrayRef<uint64_t> paramIDs;
decls_block::SILFunctionTypeLayout::readRecord(scratch,
resultID,
rawResultConvention,
interfaceResultID,
rawInterfaceResultConvention,
genericContextID,
@@ -2638,16 +2635,8 @@ Type ModuleFile::getType(TypeID TID) {
thin, noreturn);
// Process the result.
auto resultConvention = getActualResultConvention(rawResultConvention);
if (!resultConvention.hasValue()) {
error();
return nullptr;
}
SILResultInfo result(getType(resultID)->getCanonicalType(),
resultConvention.getValue());
auto interfaceResultConvention
= getActualResultConvention(rawResultConvention);
= getActualResultConvention(rawInterfaceResultConvention);
if (!interfaceResultConvention.hasValue()) {
error();
return nullptr;
@@ -2657,12 +2646,8 @@ Type ModuleFile::getType(TypeID TID) {
// Process the parameters.
unsigned numParamIDs = paramIDs.size() - numGenericParams;
if (numParamIDs % 2 != 0) {
error();
return nullptr;
}
SmallVector<SILParameterInfo, 8> allParams;
allParams.reserve(numParamIDs / 2);
allParams.reserve(numParamIDs);
for (size_t i = 0, e = numParamIDs; i != e; i += 2) {
auto type = getType(paramIDs[i])->getCanonicalType();
auto convention = getActualParameterConvention(paramIDs[i+1]);
@@ -2674,10 +2659,6 @@ Type ModuleFile::getType(TypeID TID) {
allParams.push_back(param);
}
ArrayRef<SILParameterInfo> params{allParams.data(), allParams.size()/2U};
ArrayRef<SILParameterInfo> interfaceParams
{params.end(), allParams.size()/2U};
// Process the callee convention.
auto calleeConvention = getActualParameterConvention(rawCalleeConvention);
if (!calleeConvention.hasValue()) {
@@ -2706,8 +2687,7 @@ Type ModuleFile::getType(TypeID TID) {
typeOrOffset = SILFunctionType::get(genericParams, genericSig, extInfo,
calleeConvention.getValue(),
params, result,
interfaceParams, interfaceResult,
allParams, interfaceResult,
ctx);
break;
}

View File

@@ -462,8 +462,6 @@ namespace decls_block {
using SILFunctionTypeLayout = BCRecordLayout<
SIL_FUNCTION_TYPE,
TypeIDField, // result type
ResultConventionField, // result convention
TypeIDField, // interface result type
ResultConventionField, // interface result convention
DeclIDField, // decl that owns the generic params
@@ -473,7 +471,6 @@ namespace decls_block {
BCFixed<1>, // noreturn?
BCFixed<30>, // number of generic parameters
BCArray<TypeIDField> // parameter types and conventions, alternating
// followed by interface types and conventions
// followed by generic parameter types
// Trailed by its generic requirements, if any.
// Trailed by its generic parameters, if the owning decl ID is 0.

View File

@@ -1830,19 +1830,11 @@ SIL_FUNCTION_TYPE_IGNORE_DEPRECATED_BEGIN
auto genericParams = fnTy->getGenericParams();
auto callingConvention = fnTy->getAbstractCC();
auto result = fnTy->getResult();
auto interfaceResult = fnTy->getInterfaceResult();
auto stableResultConvention =
getRawStableResultConvention(result.getConvention());
auto stableInterfaceResultConvention =
getRawStableResultConvention(interfaceResult.getConvention());
SmallVector<TypeID, 8> paramTypes;
for (auto param : fnTy->getParameters()) {
paramTypes.push_back(addTypeRef(param.getType()));
unsigned conv = getRawStableParameterConvention(param.getConvention());
paramTypes.push_back(TypeID(conv));
}
for (auto param : fnTy->getInterfaceParameters()) {
paramTypes.push_back(addTypeRef(param.getType()));
unsigned conv = getRawStableParameterConvention(param.getConvention());
@@ -1860,8 +1852,6 @@ SIL_FUNCTION_TYPE_IGNORE_DEPRECATED_BEGIN
unsigned abbrCode = DeclTypeAbbrCodes[SILFunctionTypeLayout::Code];
SILFunctionTypeLayout::emitRecord(Out, ScratchRecord, abbrCode,
addTypeRef(result.getType()),
stableResultConvention,
addTypeRef(interfaceResult.getType()),
stableInterfaceResultConvention,
// FIXME: Always serialize a new