PR45099 is an extension that gives an error when a fixed register is
needed to pass a parameter to a function.
Because the program will show malfunction when such code is generated,
anyway, I think an error is more appropriate than a warning (as
proposed in the PR).
Johann
2011-05-02 Georg-Johann Lay <[email protected]>
PR target/45099
* config/avr/avr.c (avr_function_arg_advance): Error if a fixed
register is needed for a function argument.
Index: config/avr/avr.c
===================================================================
--- config/avr/avr.c (Revision 172902)
+++ config/avr/avr.c (Arbeitskopie)
@@ -1794,6 +1794,20 @@ avr_function_arg_advance (CUMULATIVE_ARG
cfun->machine->sibcall_fails = 1;
}
+ /* Test if all registers needed by the ABI are actually available. If the
+ user has fixed a GPR needed to pass an argument, an (implicit) function
+ call would clobber that fixed register. See PR45099 for an example. */
+
+ if (cum->regno >= 0)
+ {
+ int regno;
+
+ for (regno = cum->regno; regno < cum->regno + bytes; regno++)
+ if (fixed_regs[regno])
+ error ("Register %s is needed to pass a parameter but is fixed",
+ reg_names[regno]);
+ }
+
if (cum->nregs <= 0)
{
cum->nregs = 0;