mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[sil-generic-specializer] Provide a possibility to disable the indirect-to-direct conversions of parameters and results
This is required by the capture propagation pass. Indirect-to-direct conversions are still performed by default.
This commit is contained in:
@@ -50,6 +50,10 @@ class ReabstractionInfo {
|
||||
/// to direct.
|
||||
llvm::SmallBitVector Conversions;
|
||||
|
||||
/// If set, indirect to direct conversions should be performned by the generic
|
||||
/// specializer.
|
||||
bool ConvertIndirectToDirect;
|
||||
|
||||
/// The first NumResults bits in Conversions refer to formal indirect
|
||||
/// out-parameters.
|
||||
unsigned NumFormalIndirectResults;
|
||||
@@ -130,7 +134,8 @@ public:
|
||||
/// If specialization is not possible getSpecializedType() will return an
|
||||
/// invalid type.
|
||||
ReabstractionInfo(ApplySite Apply, SILFunction *Callee,
|
||||
SubstitutionList ParamSubs);
|
||||
SubstitutionList ParamSubs,
|
||||
bool ConvertIndirectToDirect = true);
|
||||
|
||||
/// Constructs the ReabstractionInfo for generic function \p Orig with
|
||||
/// additional requirements. Requirements may contain new layout,
|
||||
@@ -140,14 +145,15 @@ public:
|
||||
/// Returns true if the \p ParamIdx'th (non-result) formal parameter is
|
||||
/// converted from indirect to direct.
|
||||
bool isParamConverted(unsigned ParamIdx) const {
|
||||
return Conversions.test(ParamIdx + NumFormalIndirectResults);
|
||||
return ConvertIndirectToDirect &&
|
||||
Conversions.test(ParamIdx + NumFormalIndirectResults);
|
||||
}
|
||||
|
||||
/// Returns true if the \p ResultIdx'th formal result is converted from
|
||||
/// indirect to direct.
|
||||
bool isFormalResultConverted(unsigned ResultIdx) const {
|
||||
assert(ResultIdx < NumFormalIndirectResults);
|
||||
return Conversions.test(ResultIdx);
|
||||
return ConvertIndirectToDirect && Conversions.test(ResultIdx);
|
||||
}
|
||||
|
||||
/// Gets the total number of original function arguments.
|
||||
|
||||
Reference in New Issue
Block a user