mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[SILType] SILFunctionConventions API.
Separate formal lowered types from SIL types. The SIL type of an argument will depend on the SIL module's conventions. The module conventions are determined by the SIL stage and LangOpts. Almost NFC, but specialized manglings are broken incidentally as a result of fixes to the way passes handle book-keeping of aruments. The mangler is fixed in the subsequent commit. Otherwise, NFC is intended, but quite possible do to rewriting the logic in many places.
This commit is contained in:
@@ -451,16 +451,16 @@ CanSILFunctionType FunctionSignatureTransform::createOptimizedSILFunctionType()
|
||||
// back into the all-results list.
|
||||
llvm::SmallVector<SILResultInfo, 8> InterfaceResults;
|
||||
auto &ResultDescs = ResultDescList;
|
||||
for (SILResultInfo InterfaceResult : FTy->getAllResults()) {
|
||||
if (InterfaceResult.isDirect()) {
|
||||
for (SILResultInfo InterfaceResult : FTy->getResults()) {
|
||||
if (InterfaceResult.isFormalDirect()) {
|
||||
auto &RV = ResultDescs[0];
|
||||
if (!RV.CalleeRetain.empty()) {
|
||||
++NumOwnedConvertedToNotOwnedResult;
|
||||
InterfaceResults.push_back(SILResultInfo(InterfaceResult.getType(),
|
||||
ResultConvention::Unowned));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
InterfaceResults.push_back(InterfaceResult);
|
||||
}
|
||||
@@ -539,7 +539,7 @@ void FunctionSignatureTransform::createFunctionSignatureOptimizedFunction() {
|
||||
// now.
|
||||
SILValue ReturnValue;
|
||||
SILType LoweredType = NewF->getLoweredType();
|
||||
SILType ResultType = LoweredType.getFunctionInterfaceResultType();
|
||||
SILType ResultType = NewF->getConventions().getSILResultType();
|
||||
auto FunctionTy = LoweredType.castTo<SILFunctionType>();
|
||||
if (FunctionTy->hasErrorResult()) {
|
||||
// We need a try_apply to call a function with an error result.
|
||||
@@ -671,9 +671,9 @@ bool FunctionSignatureTransform::OwnedToGuaranteedAnalyzeParameters() {
|
||||
}
|
||||
|
||||
bool FunctionSignatureTransform::OwnedToGuaranteedAnalyzeResults() {
|
||||
auto FTy = F->getLoweredFunctionType();
|
||||
auto fnConv = F->getConventions();
|
||||
// For now, only do anything if there's a single direct result.
|
||||
if (FTy->getDirectResults().size() != 1)
|
||||
if (fnConv.getNumDirectSILResults() != 1)
|
||||
return false;
|
||||
|
||||
bool SignatureOptimize = false;
|
||||
@@ -951,7 +951,7 @@ public:
|
||||
for (unsigned i = 0, e = Args.size(); i != e; ++i) {
|
||||
ArgumentDescList.emplace_back(Args[i]);
|
||||
}
|
||||
for (SILResultInfo IR : F->getLoweredFunctionType()->getAllResults()) {
|
||||
for (SILResultInfo IR : F->getLoweredFunctionType()->getResults()) {
|
||||
ResultDescList.emplace_back(IR);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user