Hi,
This patch adds support for the register "wsp"; in ILP32, this is
necessary in order to support the global register variable associated
the stack pointer with the syntax asm ("wsp"); it is used in libgloss to
get the stack pointer.
OK for the trunk?
Thanks,
Yufeng
gcc/
* config/aarch64/aarch64.c (aarch64_hard_regno_mode_ok): Also
return
true for SP_REGNUM if mode == ptr_mode.
* config/aarch64/aarch64.h (ADDITIONAL_REGISTER_NAMES): Add "wsp"
with value R0_REGNUM + 31.
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 7049651..46c11bc 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -358,8 +358,13 @@ aarch64_hard_regno_mode_ok (unsigned regno, enum machine_mode mode)
if (GET_MODE_CLASS (mode) == MODE_CC)
return regno == CC_REGNUM;
- if (regno == SP_REGNUM || regno == FRAME_POINTER_REGNUM
- || regno == ARG_POINTER_REGNUM)
+ if (regno == SP_REGNUM)
+ /* The purpose of comparing with ptr_mode is to support the
+ global register variable associated with the stack pointer
+ register via the syntax of asm ("wsp") in ILP32. */
+ return mode == Pmode || mode == ptr_mode;
+
+ if (regno == FRAME_POINTER_REGNUM || regno == ARG_POINTER_REGNUM)
return mode == Pmode;
if (GP_REGNUM_P (regno) && ! aarch64_vect_struct_mode_p (mode))
diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
index e1fa413..0924269 100644
--- a/gcc/config/aarch64/aarch64.h
+++ b/gcc/config/aarch64/aarch64.h
@@ -278,7 +278,7 @@ extern unsigned long aarch64_tune_flags;
R_ALIASES(16), R_ALIASES(17), R_ALIASES(18), R_ALIASES(19), \
R_ALIASES(20), R_ALIASES(21), R_ALIASES(22), R_ALIASES(23), \
R_ALIASES(24), R_ALIASES(25), R_ALIASES(26), R_ALIASES(27), \
- R_ALIASES(28), R_ALIASES(29), R_ALIASES(30), /* 31 omitted */ \
+ R_ALIASES(28), R_ALIASES(29), R_ALIASES(30), {"wsp", R0_REGNUM + 31}, \
V_ALIASES(0), V_ALIASES(1), V_ALIASES(2), V_ALIASES(3), \
V_ALIASES(4), V_ALIASES(5), V_ALIASES(6), V_ALIASES(7), \
V_ALIASES(8), V_ALIASES(9), V_ALIASES(10), V_ALIASES(11), \