From 2ea7ec53b458d319955e92c6b81f1e1e3ae9bead Mon Sep 17 00:00:00 2001 From: Marc Espie Date: Wed, 8 Sep 1999 08:17:51 +0000 Subject: Better stack usage, bugfix from current. Fri Aug 27 09:36:17 1999 Andreas Schwab * function.c (assign_stack_temp_for_type): Fix change of Mar 5 for the fact that ALIGN is measured in bits, not bytes. --- gnu/egcs/gcc/function.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'gnu/egcs/gcc') diff --git a/gnu/egcs/gcc/function.c b/gnu/egcs/gcc/function.c index 0937844d812..d2cf4c2edfb 100644 --- a/gnu/egcs/gcc/function.c +++ b/gnu/egcs/gcc/function.c @@ -786,6 +786,10 @@ assign_stack_local (mode, size, align) else alignment = align / BITS_PER_UNIT; +#ifdef FRAME_GROWS_DOWNWARD + frame_offset -= size; +#endif + /* Round frame offset to that alignment. We must be careful here, since FRAME_OFFSET might be negative and division with a negative dividend isn't as well defined as we might @@ -802,10 +806,6 @@ assign_stack_local (mode, size, align) if (BYTES_BIG_ENDIAN && mode != BLKmode) bigend_correction = size - GET_MODE_SIZE (mode); -#ifdef FRAME_GROWS_DOWNWARD - frame_offset -= size; -#endif - /* If we have already instantiated virtual registers, return the actual address relative to the frame pointer. */ if (virtuals_instantiated) @@ -871,6 +871,10 @@ assign_outer_stack_local (mode, size, align, function) else alignment = align / BITS_PER_UNIT; +#ifdef FRAME_GROWS_DOWNWARD + function->frame_offset -= size; +#endif + /* Round frame offset to that alignment. */ #ifdef FRAME_GROWS_DOWNWARD function->frame_offset = FLOOR_ROUND (function->frame_offset, alignment); @@ -883,9 +887,6 @@ assign_outer_stack_local (mode, size, align, function) if (BYTES_BIG_ENDIAN && mode != BLKmode) bigend_correction = size - GET_MODE_SIZE (mode); -#ifdef FRAME_GROWS_DOWNWARD - function->frame_offset -= size; -#endif addr = plus_constant (virtual_stack_vars_rtx, function->frame_offset + bigend_correction); #ifndef FRAME_GROWS_DOWNWARD @@ -1027,11 +1028,12 @@ assign_stack_temp_for_type (mode, size, keep, type) So for requests which depended on the rounding of SIZE, we go ahead and round it now. We also make sure ALIGNMENT is at least BIGGEST_ALIGNMENT. */ - if (mode == BLKmode && align < (BIGGEST_ALIGNMENT / BITS_PER_UNIT)) + if (mode == BLKmode && align < BIGGEST_ALIGNMENT) abort(); p->slot = assign_stack_local (mode, - mode == BLKmode - ? CEIL_ROUND (size, align) : size, + (mode == BLKmode + ? CEIL_ROUND (size, align / BITS_PER_UNIT) + : size), align); p->align = align; -- cgit v1.2.3