Fix for execute/980205.c failure on SH[123].
authorJ"orn Rennecke <amylaar@cygnus.co.uk>
Thu, 23 Apr 1998 20:57:06 +0000 (20:57 +0000)
committerJoern Rennecke <amylaar@gcc.gnu.org>
Thu, 23 Apr 1998 20:57:06 +0000 (21:57 +0100)
* sh.c (sh_expand_prologue, in !SH3E code): Don't push an extra
register for stdarg functions.
* sh.h (current_function_varargs): Declare.
(FUNCTION_ARG): Ignore NAMED for stdarg functions.

From-SVN: r19391

gcc/ChangeLog
gcc/config/sh/sh.c
gcc/config/sh/sh.h

index dfb02184b090f1c14b784262586ff8ce9afdf381..3063e960fe62067e157dd70a2b74242dc49d4f5c 100644 (file)
@@ -1,3 +1,10 @@
+Fri Apr 24 04:42:35 1998  J"orn Rennecke <amylaar@cygnus.co.uk>
+
+       * sh.c (sh_expand_prologue, in !SH3E code): Don't push an extra
+       register for stdarg functions.
+       * sh.h (current_function_varargs): Declare.
+       (FUNCTION_ARG): Ignore NAMED for stdarg functions.
+
 1998-04-23  Jim Wilson  <wilson@cygnus.com>
 
        * frame.c, libgcc2.c (stdlib.h, unistd.h): Don't include when
index 447716cb763bc39f19a2f7f7f84c56f693853c39..6441a41063cf81e48e17921e7788f5ef401f0fbb 100644 (file)
@@ -3488,9 +3488,9 @@ sh_expand_prologue ()
          for (i = 0; i < NPARM_REGS(SImode); i++)
            {
              int rn = NPARM_REGS(SImode) + FIRST_PARM_REG - i - 1;
-             if (i > (NPARM_REGS(SImode) 
-                      - current_function_args_info.arg_count[(int) SH_ARG_INT]
-                      - current_function_varargs))
+             if (i >= (NPARM_REGS(SImode) 
+                       - current_function_args_info.arg_count[(int) SH_ARG_INT]
+                       ))
                break;
              push (rn);
              extra_push += 4;
index ac1a622406ed9bc57bf7b6d356c84bd7e14eee41..2c008a43f1f13ba6d8c72054d7b79a6b59ba0495 100644 (file)
@@ -875,9 +875,11 @@ struct sh_args {
    NPARM_REGS words is at least partially passed in a register unless
    its data type forbids.  */
 
+extern int current_function_varargs;
+
 #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \
   ((PASS_IN_REG_P ((CUM), (MODE), (TYPE))                              \
-    && ((NAMED) || TARGET_SH3E))                                       \
+    && ((NAMED) || TARGET_SH3E || ! current_function_varargs))         \
    ? gen_rtx (REG, (MODE),                                             \
              (BASE_ARG_REG (MODE) + ROUND_REG ((CUM), (MODE)))) \
    : 0)
@@ -890,7 +892,6 @@ struct sh_args {
 
 #define FUNCTION_ARG_PARTIAL_NREGS(CUM, MODE, TYPE, NAMED) \
   ((PASS_IN_REG_P ((CUM), (MODE), (TYPE))                      \
-    && ((NAMED) || TARGET_SH3E)                                        \
     && (ROUND_REG ((CUM), (MODE))                              \
        + (MODE != BLKmode                                      \
           ? ROUND_ADVANCE (GET_MODE_SIZE (MODE))               \