aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbwilson <bwilson@138bc75d-0d04-0410-961f-82ee72b054a4>2006-08-26 17:03:22 +0000
committerbwilson <bwilson@138bc75d-0d04-0410-961f-82ee72b054a4>2006-08-26 17:03:22 +0000
commit81c44390fa403e4b574aed6a270bcfc07d688ca6 (patch)
treeb6d11acc1abf277ae3d293bd9728bdfdab92d507
parent0e5cde0cdaed60a49d7e1d79c6884ce0a84624e7 (diff)
* config/xtensa/xtensa.c (function_arg_boundary): New.
(function_arg, xtensa_gimplify_va_arg_expr): Limit alignment to STACK_BOUNDARY. * config/xtensa/xtensa.h (FUNCTION_ARG_BOUNDARY): Move code to new function_arg_boundary function that limits alignment to STACK_BOUNDARY. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@116469 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/config/xtensa/xtensa.c20
-rw-r--r--gcc/config/xtensa/xtensa.h12
3 files changed, 27 insertions, 13 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6360ec64887..cfd6d8c514e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2006-08-26 Bob Wilson <bob.wilson@acm.org>
+
+ * config/xtensa/xtensa.c (function_arg_boundary): New.
+ (function_arg, xtensa_gimplify_va_arg_expr): Limit alignment to
+ STACK_BOUNDARY.
+ * config/xtensa/xtensa.h (FUNCTION_ARG_BOUNDARY): Move code to new
+ function_arg_boundary function that limits alignment to STACK_BOUNDARY.
+
2006-08-26 Jakub Jelinek <jakub@redhat.com>
PR middle-end/28683
diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c
index d05d97e063e..836ae2e1687 100644
--- a/gcc/config/xtensa/xtensa.c
+++ b/gcc/config/xtensa/xtensa.c
@@ -1,5 +1,5 @@
/* Subroutines for insn-output.c for Tensilica's Xtensa architecture.
- Copyright 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
Contributed by Bob Wilson (bwilson@tensilica.com) at Tensilica.
This file is part of GCC.
@@ -1470,7 +1470,7 @@ function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode, tree type,
if (type && (TYPE_ALIGN (type) > BITS_PER_WORD))
{
- int align = TYPE_ALIGN (type) / BITS_PER_WORD;
+ int align = MIN (TYPE_ALIGN (type), STACK_BOUNDARY) / BITS_PER_WORD;
*arg_words = (*arg_words + align - 1) & -align;
}
@@ -1486,6 +1486,20 @@ function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode, tree type,
}
+int
+function_arg_boundary (enum machine_mode mode, tree type)
+{
+ unsigned int alignment;
+
+ alignment = type ? TYPE_ALIGN (type) : GET_MODE_ALIGNMENT (mode);
+ if (alignment < PARM_BOUNDARY)
+ alignment = PARM_BOUNDARY;
+ if (alignment > STACK_BOUNDARY)
+ alignment = STACK_BOUNDARY;
+ return alignment;
+}
+
+
static bool
xtensa_return_in_msb (tree valtype)
{
@@ -2185,7 +2199,7 @@ xtensa_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p,
if (TYPE_ALIGN (type) > BITS_PER_WORD)
{
- int align = TYPE_ALIGN (type) / BITS_PER_UNIT;
+ int align = MIN (TYPE_ALIGN (type), STACK_BOUNDARY) / BITS_PER_UNIT;
t = build2 (PLUS_EXPR, integer_type_node, orig_ndx,
build_int_cst (NULL_TREE, align - 1));
diff --git a/gcc/config/xtensa/xtensa.h b/gcc/config/xtensa/xtensa.h
index c290a382417..d7f70102611 100644
--- a/gcc/config/xtensa/xtensa.h
+++ b/gcc/config/xtensa/xtensa.h
@@ -1,5 +1,5 @@
/* Definitions of Tensilica's Xtensa target machine for GNU compiler.
- Copyright 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
Contributed by Bob Wilson (bwilson@tensilica.com) at Tensilica.
This file is part of GCC.
@@ -728,15 +728,7 @@ typedef struct xtensa_args
#define FUNCTION_INCOMING_ARG(CUM, MODE, TYPE, NAMED) \
function_arg (&CUM, MODE, TYPE, TRUE)
-/* Specify function argument alignment. */
-#define FUNCTION_ARG_BOUNDARY(MODE, TYPE) \
- ((TYPE) != 0 \
- ? (TYPE_ALIGN (TYPE) <= PARM_BOUNDARY \
- ? PARM_BOUNDARY \
- : TYPE_ALIGN (TYPE)) \
- : (GET_MODE_ALIGNMENT (MODE) <= PARM_BOUNDARY \
- ? PARM_BOUNDARY \
- : GET_MODE_ALIGNMENT (MODE)))
+#define FUNCTION_ARG_BOUNDARY function_arg_boundary
/* Profiling Xtensa code is typically done with the built-in profiling
feature of Tensilica's instruction set simulator, which does not