{
cum->nregs = AVR_TINY ? 6 : 18;
cum->regno = FIRST_CUM_REG;
+ cum->has_stack_args = 0;
if (!libname && stdarg_p (fntype))
cum->nregs = 0;
if (cum->nregs && bytes <= cum->nregs)
return gen_rtx_REG (arg.mode, cum->regno - bytes);
+ cum->has_stack_args = 1;
+
return NULL_RTX;
}
return "";
}
+
+/* Implement `TARGET_FRAME_POINTER_REQUIRED'. */
/* Return 1 if frame pointer for current function required. */
static bool
return (cfun->calls_alloca
|| cfun->calls_setjmp
|| cfun->has_nonlocal_label
- || crtl->args.info.nregs == 0
+ || crtl->args.info.has_stack_args
|| get_frame_size () > 0);
}
/* Next available register number */
int regno;
+
+ /* Whether some of the arguments are passed on the stack,
+ and hence an arg pointer is needed. */
+ int has_stack_args;
} CUMULATIVE_ARGS;
#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, FNDECL, N_NAMED_ARGS) \
--- /dev/null
+/* { dg-additional-options "-Os -std=c99" } */
+
+#ifdef __AVR_TINY__
+int func (int a, int b, char c)
+#else
+int func (long long a, long long b, char c)
+#endif
+{
+ (void) a;
+ (void) b;
+
+ return c;
+}
+
+/* { dg-final { scan-assembler-not "push r28" } } */
--- /dev/null
+/* { dg-do run } */
+/* { dg-additional-options "-std=c99" } */
+
+__attribute__((noinline,noclone))
+#ifdef __AVR_TINY__
+int func (int a, int b, char c)
+#else
+int func (long long a, long long b, char c)
+#endif
+{
+ (void) a;
+ (void) b;
+ return 10 + c;
+}
+
+int main (void)
+{
+ if (func (0, 0, 91) != 101)
+ __builtin_abort();
+ return 0;
+}
+