Skip to content

Commit 5dab3cb

Browse files
committed
Clarify comments on new ABIDifference constants
1 parent 7309868 commit 5dab3cb

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

include/swift/SIL/TypeLowering.h

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -967,23 +967,27 @@ class TypeConverter {
967967
enum class ABIDifference : uint8_t {
968968
// Types have compatible calling conventions and representations, so can
969969
// be trivially bitcast.
970+
//
971+
// Furthermore, if two function types have
972+
// arguments of function type that differ only in
973+
// `CompatibleRepresentation`, those outer function types are transitively
974+
// `CompatibleRepresentation`. (In all other cases, the outer function types
975+
// would fall into the `NeedsThunk` case, because a thunk would be needed
976+
// to change the representation of the function argument.)
970977
CompatibleRepresentation,
971978

972-
// No convention differences, function can be cast via `convert_function`
973-
// without a thunk.
974-
//
975-
// There may still be a representation difference between values of the
976-
// compared function types. This means that, if two function types
977-
// have a matching argument or return of function type with
978-
// `SameCallingConvention`, then the outer function types may not themselves
979-
// have the `SameCallingConvention` because they need a thunk to convert
980-
// the inner function value representation.
979+
// No convention differences, but there may still be a representation
980+
// difference between values of the compared function types, such as a
981+
// different ptrauth discriminator. The conversion can be performed by a
982+
// `convert_function` instruction.
981983
CompatibleCallingConvention,
982984

983-
// Representation difference requires thin-to-thick conversion.
985+
// Representation difference requires thin-to-thick conversion with a
986+
// `thin_to_thick_function` conversion.
984987
CompatibleRepresentation_ThinToThick,
985-
// Function types have the `SameCallingConvention` but additionally need
986-
// a thin-to-thick conversion.
988+
// Function types have `CompatibleCallingConvention` but additionally need
989+
// a thin-to-thick conversion, so a `convert_function` followed by a
990+
// `thin_to_thick_function` sequence is necessary to convert.
987991
CompatibleCallingConvention_ThinToThick,
988992

989993
// Non-trivial difference requires thunk.

0 commit comments

Comments
 (0)