Skip to content

Commit 04e0907

Browse files
committed
SIL: rename Type.instanceTypeOfMetatype -> Type.loweredInstanceTypeOfMetatype
The same for SILType It needs to be made clear that this is not the "original", but the lowered SIL type. NFC
1 parent d9b7994 commit 04e0907

File tree

8 files changed

+13
-13
lines changed

8 files changed

+13
-13
lines changed

SwiftCompilerSources/Sources/Optimizer/InstructionSimplification/SimplifyBuiltin.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ private extension BuiltinInst {
200200
return
201201
}
202202

203-
let instanceType = type.instanceTypeOfMetatype(in: parentFunction)
203+
let instanceType = type.loweredInstanceTypeOfMetatype(in: parentFunction)
204204
let builder = Builder(before: self, context)
205205
let newMetatype = builder.createMetatype(of: instanceType, representation: .Thin)
206206
operands[argument].set(to: newMetatype, context)
@@ -277,8 +277,8 @@ private func typesOfValuesAreEqual(_ lhs: Value, _ rhs: Value, in function: Func
277277
if lhsMetatype.isDynamicSelfMetatype != rhsMetatype.isDynamicSelfMetatype {
278278
return nil
279279
}
280-
let lhsTy = lhsMetatype.instanceTypeOfMetatype(in: function)
281-
let rhsTy = rhsMetatype.instanceTypeOfMetatype(in: function)
280+
let lhsTy = lhsMetatype.loweredInstanceTypeOfMetatype(in: function)
281+
let rhsTy = rhsMetatype.loweredInstanceTypeOfMetatype(in: function)
282282

283283
// Do we know the exact types? This is not the case e.g. if a type is passed as metatype
284284
// to the function.

SwiftCompilerSources/Sources/Optimizer/Utilities/FunctionSignatureTransforms.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ private func removeMetatypArguments(in specializedFunction: Function, _ context:
148148
if funcArg.type.isRemovableMetatype(in: specializedFunction) {
149149
// Rematerialize the metatype value in the entry block.
150150
let builder = Builder(atBeginOf: entryBlock, context)
151-
let instanceType = funcArg.type.instanceTypeOfMetatype(in: specializedFunction)
151+
let instanceType = funcArg.type.loweredInstanceTypeOfMetatype(in: specializedFunction)
152152
let metatype = builder.createMetatype(of: instanceType, representation: .Thick)
153153
funcArg.uses.replaceAll(with: metatype, context)
154154
entryBlock.eraseArgument(at: funcArgIdx, context)
@@ -234,7 +234,7 @@ private extension Type {
234234
func isRemovableMetatype(in function: Function) -> Bool {
235235
if isMetatype {
236236
if representationOfMetatype(in: function) == .Thick {
237-
let instanceTy = instanceTypeOfMetatype(in: function)
237+
let instanceTy = loweredInstanceTypeOfMetatype(in: function)
238238
// For structs and enums we know the metatype statically.
239239
return instanceTy.isStruct || instanceTy.isEnum
240240
}

SwiftCompilerSources/Sources/SIL/Type.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ public struct Type : CustomStringConvertible, NoReflectionChildren {
131131

132132
public typealias MetatypeRepresentation = BridgedType.MetatypeRepresentation
133133

134-
public func instanceTypeOfMetatype(in function: Function) -> Type {
135-
bridged.getInstanceTypeOfMetatype(function.bridged).type
134+
public func loweredInstanceTypeOfMetatype(in function: Function) -> Type {
135+
bridged.getLoweredInstanceTypeOfMetatype(function.bridged).type
136136
}
137137

138138
public var isDynamicSelfMetatype: Bool {

include/swift/SIL/SILBridging.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ struct BridgedType {
417417
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedType getBuiltinVectorElementType() const;
418418
BRIDGED_INLINE bool isBuiltinFixedWidthInteger(SwiftInt width) const;
419419
BRIDGED_INLINE bool isExactSuperclassOf(BridgedType t) const;
420-
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedType getInstanceTypeOfMetatype(BridgedFunction f) const;
420+
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedType getLoweredInstanceTypeOfMetatype(BridgedFunction f) const;
421421
BRIDGED_INLINE bool isDynamicSelfMetatype() const;
422422
BRIDGED_INLINE MetatypeRepresentation getRepresentationOfMetatype(BridgedFunction f) const;
423423
BRIDGED_INLINE bool isCalleeConsumedFunction() const;

include/swift/SIL/SILBridgingImpl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,8 @@ bool BridgedType::isExactSuperclassOf(BridgedType t) const {
364364
return unbridged().isExactSuperclassOf(t.unbridged());
365365
}
366366

367-
BridgedType BridgedType::getInstanceTypeOfMetatype(BridgedFunction f) const {
368-
return unbridged().getInstanceTypeOfMetatype(f.getFunction());
367+
BridgedType BridgedType::getLoweredInstanceTypeOfMetatype(BridgedFunction f) const {
368+
return unbridged().getLoweredInstanceTypeOfMetatype(f.getFunction());
369369
}
370370

371371
bool BridgedType::isDynamicSelfMetatype() const {

include/swift/SIL/SILType.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -944,7 +944,7 @@ class SILType {
944944
return getSILBoxFieldType(fn).isMoveOnlyWrapped();
945945
}
946946

947-
SILType getInstanceTypeOfMetatype(SILFunction *function) const;
947+
SILType getLoweredInstanceTypeOfMetatype(SILFunction *function) const;
948948

949949
MetatypeRepresentation getRepresentationOfMetatype(SILFunction *function) const;
950950

lib/SIL/IR/SILType.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1142,7 +1142,7 @@ bool SILType::isValueTypeWithDeinit() const {
11421142
return false;
11431143
}
11441144

1145-
SILType SILType::getInstanceTypeOfMetatype(SILFunction *function) const {
1145+
SILType SILType::getLoweredInstanceTypeOfMetatype(SILFunction *function) const {
11461146
auto metaType = castTo<MetatypeType>();
11471147
CanType instanceTy = metaType.getInstanceType();
11481148
auto &tl = function->getModule().Types.getTypeLowering(instanceTy, TypeExpansionContext(*function));

lib/SILOptimizer/Transforms/VTableSpecializer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ static bool specializeVTablesInFunction(SILFunction &func, SILModule &module,
7373
transform) != nullptr);
7474
} else if (auto *metatype = dyn_cast<MetatypeInst>(&inst)) {
7575
changed |= (specializeVTableForType(
76-
metatype->getType().getInstanceTypeOfMetatype(&func),
76+
metatype->getType().getLoweredInstanceTypeOfMetatype(&func),
7777
module, transform) != nullptr);
7878
} else if (auto *cm = dyn_cast<ClassMethodInst>(&inst)) {
7979
changed |= specializeClassMethodInst(cm);

0 commit comments

Comments
 (0)