aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Sandiford <rsandifo@redhat.com>2003-09-25 07:04:05 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2003-09-25 07:04:05 +0000
commite72ed4a733be57abe58ae396a70fdacea138980d (patch)
tree0a1c294991078642b8d4aba4868ea813127a9c88 /gcc
parent4d6d5bb21aaf986588d42e2b260868ea462fb3bb (diff)
downloadgcc-e72ed4a733be57abe58ae396a70fdacea138980d.zip
gcc-e72ed4a733be57abe58ae396a70fdacea138980d.tar.gz
gcc-e72ed4a733be57abe58ae396a70fdacea138980d.tar.bz2
mips.c (mips_va_arg): Handle arguments that must be passed on the stack.
* config/mips/mips.c (mips_va_arg): Handle arguments that must be passed on the stack. From-SVN: r71760
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/config/mips/mips.c19
2 files changed, 24 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ab62668..d581d45 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2003-09-25 Richard Sandiford <rsandifo@redhat.com>
+
+ * config/mips/mips.c (mips_va_arg): Handle arguments that must be
+ passed on the stack.
+
2003-09-25 Nathanael Nerode <neroden@gcc.gnu.org>
* config.gcc (widely ported systems section): Mostly alphabetize
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 0f0a680..3a9aac3 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -4277,6 +4277,7 @@ mips_va_arg (tree valist, tree type)
{
/* Not EABI. */
int align;
+ HOST_WIDE_INT min_offset;
/* ??? The original va-mips.h did always align, despite the fact
that alignments <= UNITS_PER_WORD are preserved by the va_arg
@@ -4295,6 +4296,24 @@ mips_va_arg (tree valist, tree type)
t = build (PLUS_EXPR, TREE_TYPE (valist), valist,
build_int_2 (align - 1, 0));
t = build (BIT_AND_EXPR, TREE_TYPE (t), t, build_int_2 (-align, -1));
+
+ /* If arguments of type TYPE must be passed on the stack,
+ set MIN_OFFSET to the offset of the first stack parameter. */
+ if (!MUST_PASS_IN_STACK (TYPE_MODE (type), type))
+ min_offset = 0;
+ else if (TARGET_NEWABI)
+ min_offset = current_function_pretend_args_size;
+ else
+ min_offset = REG_PARM_STACK_SPACE (current_function_decl);
+
+ /* Make sure the new address is at least MIN_OFFSET bytes from
+ the incoming argument pointer. */
+ if (min_offset > 0)
+ t = build (MAX_EXPR, TREE_TYPE (valist), t,
+ make_tree (TREE_TYPE (valist),
+ plus_constant (virtual_incoming_args_rtx,
+ min_offset)));
+
t = build (MODIFY_EXPR, TREE_TYPE (valist), valist, t);
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);