File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -59,14 +59,21 @@ namespace swift {
59
59
template <typename Ret, typename Param>
60
60
Param returnTypeHelper(Ret (*)(Param)) {}
61
61
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
+
62
70
// Helper macro that defines one entrypoint that takes the parameter in reg and
63
71
// calls through to function.
64
72
#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() { \
67
74
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 " \
70
77
" .endif" \
71
78
: " =r" (ptr)); \
72
79
return function (ptr); \
You can’t perform that action at this time.
0 commit comments