aboutsummaryrefslogtreecommitdiff
path: root/gcc/function.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@gcc.gnu.org>2005-06-26 07:18:53 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2005-06-26 07:18:53 +0200
commitf62c8a5c7996b97c736e3242de0d5527ec299a34 (patch)
tree390776c633d81d423d7316acdfdfa13dcefb5a65 /gcc/function.c
parent567fb6602c70e0c7341a0b1a39b017419669027b (diff)
downloadgcc-f62c8a5c7996b97c736e3242de0d5527ec299a34.zip
gcc-f62c8a5c7996b97c736e3242de0d5527ec299a34.tar.gz
gcc-f62c8a5c7996b97c736e3242de0d5527ec299a34.tar.bz2
defaults.h (FRAME_GROWS_DOWNWARD): Define to 0 if not defined.
* defaults.h (FRAME_GROWS_DOWNWARD): Define to 0 if not defined. * function.c (get_func_frame_size): Use if (FRAME_GROWS_DOWNWARD) instead of preprocessor conditionals. (assign_stack_local_1, assign_stack_temp_for_type): Likewise. * cfgexpand.c (FRAME_GROWS_DOWNWARD): Don't redefine to 1 or 0 depending on if it was or was not defined previously. * doc/rtl.texi (VIRTUAL_STACK_VARS_REGNUM): Mention that only non-zero definition of FRAME_GROWS_DOWNWARD means frame grows downward. * doc/tm.texi (FRAME_GROWS_DOWNWARD): Likewise. * config/m68hc11/m68hc11.h (FRAME_GROWS_DOWNWARD): Define to 0. Update comment. * config/pa/pa.h (FRAME_GROWS_DOWNWARD): Likewise. * config/rs6000/rs6000.h (FRAME_GROWS_DOWNWARD): Likewise. * config/stormy16/stormy16.h (FRAME_GROWS_DOWNWARD): Define to 0. * config/c4x/c4x.h (FRAME_GROWS_DOWNWARD): Likewise. * config/sh/sh.h (FRAME_GROWS_DOWNWARD): Likewise. * config/ia64/ia64.h (FRAME_GROWS_DOWNWARD): Likewise. * config/iq2000/iq2000.h (FRAME_GROWS_DOWNWARD): Likewise. * config/pdp11/pdp11.h (FRAME_GROWS_DOWNWARD): Define to 1. Update comment. * config/i860/i860.h (FRAME_GROWS_DOWNWARD): Likewise. * config/h8300/h8300.h (FRAME_GROWS_DOWNWARD): Likewise. * config/arc/arc.h (FRAME_GROWS_DOWNWARD): Likewise. * config/vax/vax.h (FRAME_GROWS_DOWNWARD): Likewise. * config/sparc/sparc.h (FRAME_GROWS_DOWNWARD): Likewise. * config/i386/i386.h (FRAME_GROWS_DOWNWARD): Likewise. * config/fr30/fr30.h (FRAME_GROWS_DOWNWARD): Likewise. * config/frv/frv.h (FRAME_GROWS_DOWNWARD): Likewise. * config/mn10300/mn10300.h (FRAME_GROWS_DOWNWARD): Likewise. * config/bfin/bfin.h (FRAME_GROWS_DOWNWARD): Likewise. * config/ns32k/ns32k.h (FRAME_GROWS_DOWNWARD): Likewise. * config/v850/v850.h (FRAME_GROWS_DOWNWARD): Likewise. * config/alpha/alpha.h (FRAME_GROWS_DOWNWARD): Update comment. * config/s390/s390.h (FRAME_GROWS_DOWNWARD): Likewise. * config/arm/arm.h (FRAME_GROWS_DOWNWARD): Likewise. * config/alpha/unicosmk.h (FRAME_GROWS_DOWNWARD): Define to 1. * config/cris/cris.h (FRAME_GROWS_DOWNWARD): Likewise. * config/m68k/m68k.h (FRAME_GROWS_DOWNWARD): Likewise. * config/mmix/mmix.h (FRAME_GROWS_DOWNWARD): Likewise. From-SVN: r101329
Diffstat (limited to 'gcc/function.c')
-rw-r--r--gcc/function.c66
1 files changed, 32 insertions, 34 deletions
diff --git a/gcc/function.c b/gcc/function.c
index 45f1316..c5c8dd8 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -347,11 +347,10 @@ free_after_compilation (struct function *f)
static HOST_WIDE_INT
get_func_frame_size (struct function *f)
{
-#ifdef FRAME_GROWS_DOWNWARD
- return -f->x_frame_offset;
-#else
- return f->x_frame_offset;
-#endif
+ if (FRAME_GROWS_DOWNWARD)
+ return -f->x_frame_offset;
+ else
+ return f->x_frame_offset;
}
/* Return size needed for stack frame based on slots so far allocated.
@@ -412,9 +411,8 @@ assign_stack_local_1 (enum machine_mode mode, HOST_WIDE_INT size, int align,
else
alignment = align / BITS_PER_UNIT;
-#ifdef FRAME_GROWS_DOWNWARD
- function->x_frame_offset -= size;
-#endif
+ if (FRAME_GROWS_DOWNWARD)
+ function->x_frame_offset -= size;
/* Ignore alignment we can't do with expected alignment of the boundary. */
if (alignment * BITS_PER_UNIT > PREFERRED_STACK_BOUNDARY)
@@ -440,17 +438,16 @@ assign_stack_local_1 (enum machine_mode mode, HOST_WIDE_INT size, int align,
division with a negative dividend isn't as well defined as we might
like. So we instead assume that ALIGNMENT is a power of two and
use logical operations which are unambiguous. */
-#ifdef FRAME_GROWS_DOWNWARD
- function->x_frame_offset
- = (FLOOR_ROUND (function->x_frame_offset - frame_phase,
- (unsigned HOST_WIDE_INT) alignment)
- + frame_phase);
-#else
- function->x_frame_offset
- = (CEIL_ROUND (function->x_frame_offset - frame_phase,
- (unsigned HOST_WIDE_INT) alignment)
- + frame_phase);
-#endif
+ if (FRAME_GROWS_DOWNWARD)
+ function->x_frame_offset
+ = (FLOOR_ROUND (function->x_frame_offset - frame_phase,
+ (unsigned HOST_WIDE_INT) alignment)
+ + frame_phase);
+ else
+ function->x_frame_offset
+ = (CEIL_ROUND (function->x_frame_offset - frame_phase,
+ (unsigned HOST_WIDE_INT) alignment)
+ + frame_phase);
}
/* On a big-endian machine, if we are allocating more space than we will use,
@@ -471,9 +468,8 @@ assign_stack_local_1 (enum machine_mode mode, HOST_WIDE_INT size, int align,
(function->x_frame_offset + bigend_correction,
Pmode));
-#ifndef FRAME_GROWS_DOWNWARD
- function->x_frame_offset += size;
-#endif
+ if (!FRAME_GROWS_DOWNWARD)
+ function->x_frame_offset += size;
x = gen_rtx_MEM (mode, addr);
@@ -698,20 +694,22 @@ assign_stack_temp_for_type (enum machine_mode mode, HOST_WIDE_INT size,
can be either above or below this stack slot depending on which
way the frame grows. We include the extra space if and only if it
is above this slot. */
-#ifdef FRAME_GROWS_DOWNWARD
- p->size = frame_offset_old - frame_offset;
-#else
- p->size = size;
-#endif
+ if (FRAME_GROWS_DOWNWARD)
+ p->size = frame_offset_old - frame_offset;
+ else
+ p->size = size;
/* Now define the fields used by combine_temp_slots. */
-#ifdef FRAME_GROWS_DOWNWARD
- p->base_offset = frame_offset;
- p->full_size = frame_offset_old - frame_offset;
-#else
- p->base_offset = frame_offset_old;
- p->full_size = frame_offset - frame_offset_old;
-#endif
+ if (FRAME_GROWS_DOWNWARD)
+ {
+ p->base_offset = frame_offset;
+ p->full_size = frame_offset_old - frame_offset;
+ }
+ else
+ {
+ p->base_offset = frame_offset_old;
+ p->full_size = frame_offset - frame_offset_old;
+ }
p->address = 0;
selected = p;