aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorClinton Popetz <cpopetz@cygnus.com>2000-01-14 21:19:51 +0000
committerClinton Popetz <cpopetz@gcc.gnu.org>2000-01-14 16:19:51 -0500
commit5e4f624424df8c5a8a6a6a7a7f9b0709d4f1213e (patch)
treef9a35a30ce0a91f50eb0507d969b47230adec015 /gcc
parent06be917325903b12e7d679c65c9213b7880f3f9f (diff)
downloadgcc-5e4f624424df8c5a8a6a6a7a7f9b0709d4f1213e.zip
gcc-5e4f624424df8c5a8a6a6a7a7f9b0709d4f1213e.tar.gz
gcc-5e4f624424df8c5a8a6a6a7a7f9b0709d4f1213e.tar.bz2
builtins.c (PAD_VARARGS_DOWN): Define.
* builtins.c (PAD_VARARGS_DOWN): Define. (std_expand_builtin_va_arg): Use the above macro. * config/mips/mips.c (PAD_VARARGS_DOWN): Define. * tm.texi (Register Arguments): Document the above macro. From-SVN: r31421
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/builtins.c6
-rw-r--r--gcc/config/mips/mips.c18
-rw-r--r--gcc/tm.texi8
4 files changed, 32 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6be4d2c..c2ea56d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2000-01-14 Clinton Popetz <cpopetz@cygnus.com>
+
+ * builtins.c (PAD_VARARGS_DOWN): Define.
+ (std_expand_builtin_va_arg): Use the above macro.
+ * config/mips/mips.c (PAD_VARARGS_DOWN): Define.
+ * tm.texi (Register Arguments): Document the above macro.
+
2000-01-14 Nick Clifton <nickc@cygnus.com>
* emit-rtl.c (emit_insn): If checking is enabled, make sure
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 7bfe10d..1ca5b5d 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -51,6 +51,10 @@ Boston, MA 02111-1307, USA. */
#define OUTGOING_REGNO(IN) (IN)
#endif
+#ifndef PAD_VARARGS_DOWN
+#define PAD_VARARGS_DOWN BYTES_BIG_ENDIAN
+#endif
+
tree (*lang_type_promotes_to) PARAMS ((tree));
static int get_pointer_alignment PARAMS ((tree, unsigned));
@@ -1967,7 +1971,7 @@ std_expand_builtin_va_arg (valist, type)
/* Get AP. */
addr_tree = valist;
- if (BYTES_BIG_ENDIAN)
+ if (PAD_VARARGS_DOWN)
{
/* Small args are padded downward. */
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 67859df..43601a7 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -1,5 +1,5 @@
/* Subroutines for insn-output.c for MIPS
- Copyright (C) 1989, 90, 91, 93-98, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1989, 90, 91, 93-98, 1999, 2000 Free Software Foundation, Inc.
Contributed by A. Lichnewsky, lich@inria.inria.fr.
Changes by Michael Meissner, meissner@osf.org.
64 bit r4000 support by Ian Lance Taylor, ian@cygnus.com, and
@@ -4045,11 +4045,10 @@ mips_va_start (stdarg_p, valist, nextarg)
tree valist;
rtx nextarg;
{
- int arg_words, fp_arg_words;
+ int arg_words;
tree t;
arg_words = current_function_args_info.arg_words;
- fp_arg_words = current_function_args_info.fp_arg_words;
if (mips_abi == ABI_EABI)
{
@@ -4059,6 +4058,11 @@ mips_va_start (stdarg_p, valist, nextarg)
tree gprv, fprv;
int gpro, fpro;
+ fpro = (8 - current_function_args_info.fp_arg_words);
+
+ if (!TARGET_64BIT)
+ fpro /= 2;
+
f_fpr = TYPE_FIELDS (va_list_type_node);
f_rem = TREE_CHAIN (f_fpr);
f_gpr = TREE_CHAIN (f_rem);
@@ -4084,16 +4088,15 @@ mips_va_start (stdarg_p, valist, nextarg)
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
t = build (MODIFY_EXPR, integer_type_node, rem,
- build_int_2 (8 - fp_arg_words, 0));
+ build_int_2 (fpro, 0));
TREE_SIDE_EFFECTS (t) = 1;
expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
- fpro = (8 - fp_arg_words) * 8;
if (fpro == 0)
fprv = gprv;
else
fprv = fold (build (PLUS_EXPR, ptr_type_node, gprv,
- build_int_2 (-fpro, -1)));
+ build_int_2 (-(fpro*8), -1)));
if (! TARGET_64BIT)
fprv = fold (build (BIT_AND_EXPR, ptr_type_node, fprv,
@@ -4199,6 +4202,9 @@ mips_va_arg (valist, type)
if (r != addr_rtx)
emit_move_insn (addr_rtx, r);
+ /* Ensure that the POSTINCREMENT is emitted before lab_over */
+ emit_queue();
+
emit_jump (lab_over);
emit_barrier ();
emit_label (lab_false);
diff --git a/gcc/tm.texi b/gcc/tm.texi
index dac44ae..ed74148 100644
--- a/gcc/tm.texi
+++ b/gcc/tm.texi
@@ -2943,6 +2943,14 @@ For little-endian machines, the default is to pad upward. For
big-endian machines, the default is to pad downward for an argument of
constant size shorter than an @code{int}, and upward otherwise.
+@findex PAD_VARARGS_DOWN
+@item PAD_VARARGS_DOWN
+If defined, a C expression which determines whether the default
+implementation of va_arg will attempt to pad down before reading the
+next argument, if that argument is smaller than its aligned space as
+controlled by @code{PARM_BOUNDARY}. If this macro is not defined, all such
+arguments are padded down if @code{BYTES_BIG_ENDIAN} is true.
+
@findex FUNCTION_ARG_BOUNDARY
@item FUNCTION_ARG_BOUNDARY (@var{mode}, @var{type})
If defined, a C expression that gives the alignment boundary, in bits,