mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[lower-aggregate-instrs] Add an additional type lowering style "DeepNoEnum" for use in lowering aggregate memory operations.
The idea here is that the aggregate memory operation is lowered deep recursively for all types except enums which recieve a shallow lowering. This prevents code bloat due to the deep lowering of an enum requiring the creation of a bunch of new basic blocks, code bloat which we do not want. Another thing to note is that this method is actually not used anywhere else currently, but in case this behavior was left in on purpose I decided to extend it by adding the enum class flag rather than just changing the underlying behavior (i.e. making deep not lower enum values). Swift SVN r11748
This commit is contained in:
@@ -228,16 +228,24 @@ public:
|
||||
virtual void emitDestroyRValue(SILBuilder &B, SILLocation loc,
|
||||
SILValue value) const = 0;
|
||||
|
||||
enum class LoweringStyle {
|
||||
Shallow,
|
||||
Deep,
|
||||
DeepNoEnum
|
||||
};
|
||||
|
||||
/// Emit a lowered 'destroy_value' operation.
|
||||
///
|
||||
/// This type must be loadable.
|
||||
virtual void emitLoweredDestroyValue(SILBuilder &B, SILLocation loc,
|
||||
SILValue value, bool deep) const = 0;
|
||||
SILValue value,
|
||||
LoweringStyle loweringStyle) const = 0;
|
||||
|
||||
void emitLoweredDestroyChildValue(SILBuilder &B, SILLocation loc,
|
||||
SILValue value, bool wasDeep) const {
|
||||
if (wasDeep) {
|
||||
return emitLoweredDestroyValue(B, loc, value, true);
|
||||
SILValue value,
|
||||
LoweringStyle loweringStyle) const {
|
||||
if (loweringStyle != LoweringStyle::Shallow) {
|
||||
return emitLoweredDestroyValue(B, loc, value, loweringStyle);
|
||||
} else {
|
||||
return emitDestroyValue(B, loc, value);
|
||||
}
|
||||
@@ -248,7 +256,7 @@ public:
|
||||
/// This type must be loadable.
|
||||
void emitLoweredDestroyValueShallow(SILBuilder &B, SILLocation loc,
|
||||
SILValue value) const {
|
||||
emitLoweredDestroyValue(B, loc, value, false);
|
||||
emitLoweredDestroyValue(B, loc, value, LoweringStyle::Shallow);
|
||||
}
|
||||
|
||||
/// Emit a lowered 'destroy_value' operation.
|
||||
@@ -256,7 +264,15 @@ public:
|
||||
/// This type must be loadable.
|
||||
void emitLoweredDestroyValueDeep(SILBuilder &B, SILLocation loc,
|
||||
SILValue value) const {
|
||||
emitLoweredDestroyValue(B, loc, value, true);
|
||||
emitLoweredDestroyValue(B, loc, value, LoweringStyle::Deep);
|
||||
}
|
||||
|
||||
/// Emit a lowered 'destroy_value' operation.
|
||||
///
|
||||
/// This type must be loadable.
|
||||
void emitLoweredDestroyValueDeepNoEnum(SILBuilder &B, SILLocation loc,
|
||||
SILValue value) const {
|
||||
emitLoweredDestroyValue(B, loc, value, LoweringStyle::DeepNoEnum);
|
||||
}
|
||||
|
||||
/// Given a primitively loaded value of this type (which must be
|
||||
|
||||
Reference in New Issue
Block a user