public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Patch, xtensa] Add LOCAL_REGNO to the xtensa backend.
@ 2014-01-14 15:14 Felix Yang
  2014-01-14 16:45 ` Sterling Augustine
  0 siblings, 1 reply; 2+ messages in thread
From: Felix Yang @ 2014-01-14 15:14 UTC (permalink / raw)
  To: Sterling Augustine, gcc-patches

Hi Sterling,

    The xtensa backend uses register windows, and we need to define
LOCAL_REGNO for it.
    The dataflow may not be accurate with this macro. This patch
passed the cases in testsuite/gcc.c-torture/execute dir.
    Please apply it if OK for trunk. Thanks.

Index: gcc/ChangeLog
===================================================================
--- gcc/ChangeLog    (revision 206599)
+++ gcc/ChangeLog    (working copy)
@@ -1,3 +1,7 @@
+2014-01-14  Felix Yang  <fei.yang0953@gmail.com>
+
+    * config/xtensa/xtensa.h (LOCAL_REGNO): New.
+
 2014-01-14  Richard Biener  <rguenther@suse.de>

     PR tree-optimization/58921
Index: gcc/config/xtensa/xtensa.h
===================================================================
--- gcc/config/xtensa/xtensa.h    (revision 206599)
+++ gcc/config/xtensa/xtensa.h    (working copy)
@@ -369,7 +369,14 @@ extern char xtensa_hard_regno_mode_ok[][FIRST_PSEU
     ((unsigned) ((IN) - GP_REG_FIRST) < WINDOW_SIZE)) ?            \
    (IN) + WINDOW_SIZE : (IN))

+/* Define this macro if the target machine has register windows.  This
+   C expression returns true if the register is call-saved but is in the
+   register window.  */

+#define LOCAL_REGNO(REGNO)                        \
+  (GP_REG_P (REGNO) && ((unsigned) (REGNO - GP_REG_FIRST) < WINDOW_SIZE))
+
+
 /* Define the classes of registers for register constraints in the
    machine description.  */
 enum reg_class



Cheers,
Felix

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Patch, xtensa] Add LOCAL_REGNO to the xtensa backend.
  2014-01-14 15:14 [Patch, xtensa] Add LOCAL_REGNO to the xtensa backend Felix Yang
@ 2014-01-14 16:45 ` Sterling Augustine
  0 siblings, 0 replies; 2+ messages in thread
From: Sterling Augustine @ 2014-01-14 16:45 UTC (permalink / raw)
  To: Felix Yang, Marc Gauthier; +Cc: gcc-patches

On Tue, Jan 14, 2014 at 7:14 AM, Felix Yang <fei.yang0953@gmail.com> wrote:
> Hi Sterling,
>
>     The xtensa backend uses register windows, and we need to define
> LOCAL_REGNO for it.

Hi Felix,

How does this change the produced code? In particular, please identify
a problem this patch is solving. I know that the documentation for the
macro says to define it if you have register windows, but things
aren't that straightforward.

The original register windowing support in GCC went in to support
Sparc and, iirc, Intel i960. There are subtle differences between the
two ISAs that aren't entirely captured in the GCC infrastructure. Note
that in Sparc the window isn't modified until the save and restore
instructions are executed, whereas in Xtensa, the save and restores
happen combined with call and return.

All of this makes for very subtle data-flow issues around certain
registers--in particular, a8 (which functions as both an argument
register and the frame pointer.) Passing gcc/torture/... isn't enough
to establish that this works. It needs a full set of ABI tests to be
established as correct.

What we have there works perfectly well. Your patch may indeed improve
the generated code, or be more correct, but please identify the
problem you are solving and show how this patch improves things.

Thanks,

Sterling

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-01-14 16:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-14 15:14 [Patch, xtensa] Add LOCAL_REGNO to the xtensa backend Felix Yang
2014-01-14 16:45 ` Sterling Augustine

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).