fix g++.eh/registers1.c on alpha
Richard Henderson
rth@redhat.com
Sat Jan 26 17:08:00 GMT 2002
We weren't allocating enough stack space for the extra registers
named by EH_RETURN_DATA_REGNO, which resulted in clobbering part
of the stack frame.
r~
* config/alpha/alpha.c (alpha_sa_mask): Mark RA for unicos here too.
(alpha_sa_size): Use alpha_sa_mask to compute size of saved regs.
Index: alpha.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/alpha/alpha.c,v
retrieving revision 1.227
diff -c -p -d -r1.227 alpha.c
*** alpha.c 2002/01/23 00:39:50 1.227
--- alpha.c 2002/01/27 00:35:04
*************** alpha_sa_mask (imaskP, fmaskP)
*** 5890,5903 ****
}
}
! if (!TARGET_ABI_UNICOSMK)
! {
! /* If any register spilled, then spill the return address also. */
! /* ??? This is required by the Digital stack unwind specification
! and isn't needed if we're doing Dwarf2 unwinding. */
! if (imask || fmask || alpha_ra_ever_killed ())
! imask |= (1L << REG_RA);
! }
}
*imaskP = imask;
--- 5890,5900 ----
}
}
! /* If any register spilled, then spill the return address also. */
! /* ??? This is required by the Digital stack unwind specification
! and isn't needed if we're doing Dwarf2 unwinding. */
! if (imask || fmask || alpha_ra_ever_killed ())
! imask |= (1L << REG_RA);
}
*imaskP = imask;
*************** alpha_sa_mask (imaskP, fmaskP)
*** 5907,5940 ****
int
alpha_sa_size ()
{
int sa_size = 0;
! int i;
! #ifdef ASM_OUTPUT_MI_THUNK
! if (current_function_is_thunk)
! sa_size = 0;
else
- #endif
{
! if (TARGET_ABI_UNICOSMK)
! {
! for (i = 9; i < 15 && sa_size == 0; i++)
! if (! fixed_regs[i] && ! call_used_regs[i]
! && regs_ever_live[i])
! sa_size = 14;
! for (i = 32 + 2; i < 32 + 10 && sa_size == 0; i++)
! if (! fixed_regs[i] && ! call_used_regs[i]
! && regs_ever_live[i])
! sa_size = 14;
! }
! else
! {
! /* One for every register we have to save. */
! for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
! if (! fixed_regs[i] && ! call_used_regs[i]
! && regs_ever_live[i] && i != REG_RA)
! sa_size++;
! }
}
if (TARGET_ABI_UNICOSMK)
--- 5904,5926 ----
int
alpha_sa_size ()
{
+ unsigned long mask[2];
int sa_size = 0;
! int i, j;
! alpha_sa_mask (&mask[0], &mask[1]);
!
! if (TARGET_ABI_UNICOSMK)
! {
! if (mask[0] || mask[1])
! sa_size = 14;
! }
else
{
! for (j = 0; j < 2; ++j)
! for (i = 0; i < 32; ++i)
! if ((mask[j] >> i) & 1)
! sa_size++;
}
if (TARGET_ABI_UNICOSMK)
*************** alpha_sa_size ()
*** 5945,5958 ****
use alloca and have not determined that we need a frame for other
reasons. */
! alpha_is_stack_procedure = sa_size != 0
! || alpha_ra_ever_killed ()
! || get_frame_size() != 0
! || current_function_outgoing_args_size
! || current_function_varargs
! || current_function_stdarg
! || current_function_calls_alloca
! || frame_pointer_needed;
/* Always reserve space for saving callee-saved registers if we
need a frame as required by the calling convention. */
--- 5931,5943 ----
use alloca and have not determined that we need a frame for other
reasons. */
! alpha_is_stack_procedure = (sa_size
! || get_frame_size() != 0
! || current_function_outgoing_args_size
! || current_function_varargs
! || current_function_stdarg
! || current_function_calls_alloca
! || frame_pointer_needed);
/* Always reserve space for saving callee-saved registers if we
need a frame as required by the calling convention. */
*************** alpha_sa_size ()
*** 5964,5971 ****
/* Start by assuming we can use a register procedure if we don't
make any calls (REG_RA not used) or need to save any
registers and a stack procedure if we do. */
! alpha_is_stack_procedure = sa_size != 0 || alpha_ra_ever_killed ();
/* Decide whether to refer to objects off our PV via FP or PV.
If we need FP for something else or if we receive a nonlocal
goto (which expects PV to contain the value), we must use PV.
--- 5949,5961 ----
/* Start by assuming we can use a register procedure if we don't
make any calls (REG_RA not used) or need to save any
registers and a stack procedure if we do. */
! alpha_is_stack_procedure = ((mask[0] >> REG_RA) & 1);
+ /* Don't reserve space for saving RA yet. Do that later after we've
+ made the final decision on stack procedure vs register procedure. */
+ if (alpha_is_stack_procedure)
+ sa_size--;
+
/* Decide whether to refer to objects off our PV via FP or PV.
If we need FP for something else or if we receive a nonlocal
goto (which expects PV to contain the value), we must use PV.
*************** alpha_sa_size ()
*** 5998,6008 ****
}
else
{
- /* If some registers were saved but not RA, RA must also be saved,
- so leave space for it. */
- if (!TARGET_ABI_UNICOSMK && (sa_size != 0 || alpha_ra_ever_killed ()))
- sa_size++;
-
/* Our size must be even (multiple of 16 bytes). */
if (sa_size & 1)
sa_size++;
--- 5988,5993 ----
More information about the Gcc-patches
mailing list