This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] S/390: Fix r6 vararg handling.
- From: Andreas Krebbel <krebbel at linux dot vnet dot ibm dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 5 Feb 2016 12:43:38 +0100
- Subject: Re: [PATCH] S/390: Fix r6 vararg handling.
- Authentication-results: sourceware.org; auth=none
- References: <1454605125-27073-1-git-send-email-krebbel at linux dot vnet dot ibm dot com>
On 02/04/2016 05:58 PM, Andreas Krebbel wrote:
> +static void
> +s390_register_info_set_ranges ()
> +{
> + int i, j;
> +
> + /* Find the first and the last save slot supposed to use the stack
> + to set the restore range.
> + Vararg regs might be marked as save to stack but only the
> + call-saved regs really need restoring (i.e. r6). This code
> + assumes that the vararg regs have not yet been recorded in
> + cfun_gpr_save_slot. */
> + for (i = 0; i < 16 && cfun_gpr_save_slot (i) != SAVE_SLOT_STACK; i++);
> + for (j = 15; j > i && cfun_gpr_save_slot (j) != SAVE_SLOT_STACK; j--);
> + cfun_frame_layout.first_restore_gpr = (i == 16) ? -1 : i;
> + cfun_frame_layout.last_restore_gpr = (i == 16) ? -1 : j;
> +
> + /* Now the range of GPRs which need saving. */
> + for (i = 0; i < 16 && cfun_gpr_save_slot (i) != SAVE_SLOT_STACK; i++);
> + for (j = 15; j > i && cfun_gpr_save_slot (j) != SAVE_SLOT_STACK; j--);
> + cfun_frame_layout.first_save_gpr = (i == 16) ? -1 : i;
> + cfun_frame_layout.last_save_gpr = (i == 16) ? -1 : j;
Dominik just made me aware of this stupid copy and paste bug which made me ending up with the very
same loops twice :(
I've committed the attached patch to fix this:
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index 1667c11..2cf7096 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -9326,10 +9326,6 @@ s390_register_info_set_ranges ()
for (j = 15; j > i && cfun_gpr_save_slot (j) != SAVE_SLOT_STACK; j--);
cfun_frame_layout.first_restore_gpr = (i == 16) ? -1 : i;
cfun_frame_layout.last_restore_gpr = (i == 16) ? -1 : j;
-
- /* Now the range of GPRs which need saving. */
- for (i = 0; i < 16 && cfun_gpr_save_slot (i) != SAVE_SLOT_STACK; i++);
- for (j = 15; j > i && cfun_gpr_save_slot (j) != SAVE_SLOT_STACK; j--);
cfun_frame_layout.first_save_gpr = (i == 16) ? -1 : i;
cfun_frame_layout.last_save_gpr = (i == 16) ? -1 : j;
}
Bye,
-Andreas-