public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Georg-Johann Lay <avr@gjlay.de>
To: gcc-patches@gcc.gnu.org
Cc: Anatoly Sokolov <aesok@post.ru>,
	 Denis Chertykov <chertykov@gmail.com>,
	Eric Weddington <eric.weddington@atmel.com>
Subject: [Patch,AVR]: Fix PR45099
Date: Mon, 02 May 2011 15:24:00 -0000	[thread overview]
Message-ID: <4DBECC84.4080701@gjlay.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 451 bytes --]

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  <avr@gjlay.de>

	PR target/45099

	* config/avr/avr.c (avr_function_arg_advance): Error if a fixed
	register is needed for a function argument.

[-- Attachment #2: pr45099.diff --]
[-- Type: text/x-patch, Size: 854 bytes --]

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;

             reply	other threads:[~2011-05-02 15:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-02 15:24 Georg-Johann Lay [this message]
2011-05-02 16:19 ` Nathan Froyd
2011-05-06 14:07   ` Georg-Johann Lay
2011-05-10 13:21     ` Denis Chertykov
2011-05-16 15:53       ` Georg-Johann Lay
2011-05-16 17:31         ` Denis Chertykov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4DBECC84.4080701@gjlay.de \
    --to=avr@gjlay.de \
    --cc=aesok@post.ru \
    --cc=chertykov@gmail.com \
    --cc=eric.weddington@atmel.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).