Skip to content

Commit f553832

Browse files
authored
Merge pull request #62625 from mikeash/fix-custom-rr-arm64_32-warnings
[Runtime] Fix warnings in CustomRRABI when building for ARM64_32.
2 parents 7b08b30 + c085682 commit f553832

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

include/swift/Runtime/CustomRRABI.h

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,21 @@ namespace swift {
5959
template <typename Ret, typename Param>
6060
Param returnTypeHelper(Ret (*)(Param)) {}
6161

62+
#if defined(__LP64__) || defined(_LP64)
63+
#define REGISTER_SUBSTITUTION_PREFIX ""
64+
#define REGISTER_PREFIX "x"
65+
#else
66+
#define REGISTER_SUBSTITUTION_PREFIX "w"
67+
#define REGISTER_PREFIX "w"
68+
#endif
69+
6270
// Helper macro that defines one entrypoint that takes the parameter in reg and
6371
// calls through to function.
6472
#define CUSTOM_RR_ENTRYPOINTS_DEFINE_ONE_ENTRYPOINT(reg, function) \
65-
SWIFT_RUNTIME_EXPORT decltype(function( \
66-
nullptr)) function##_x##reg() { \
73+
SWIFT_RUNTIME_EXPORT decltype(function(nullptr)) function##_x##reg() { \
6774
decltype(returnTypeHelper(function)) ptr; \
68-
asm(".ifnc %0, x" #reg "\n" \
69-
"mov %0, x" #reg "\n" \
75+
asm(".ifnc %" REGISTER_SUBSTITUTION_PREFIX "0, " REGISTER_PREFIX #reg "\n" \
76+
"mov %" REGISTER_SUBSTITUTION_PREFIX "0, " REGISTER_PREFIX #reg "\n" \
7077
".endif" \
7178
: "=r"(ptr)); \
7279
return function(ptr); \

0 commit comments

Comments
 (0)