public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [SPARC] Remove unused macros
@ 2011-05-04 19:12 Anatoly Sokolov
  2011-05-08 12:12 ` Eric Botcazou
  0 siblings, 1 reply; 2+ messages in thread
From: Anatoly Sokolov @ 2011-05-04 19:12 UTC (permalink / raw)
  To: gcc-patches; +Cc: rth, ebotcazou

Hi.

  This patch remove some unused macros from sparc.h. The RTX_OK_FOR_OFFSET_P 
and RTX_OK_FOR_OLO10_P macros is used only in sparc_legitimate_address_p 
function and moved to sparc.c. 

  Bootstrapped on sparc64-unknown-linux-gnu.

  OK to install?


        * config/sparc/sparc.h (REG_OK_FOR_INDEX_P, REG_OK_FOR_BASE_P,
        SYMBOLIC_CONST, RTX_OK_FOR_BASE_P, RTX_OK_FOR_INDEX_P): Remove.
        (RTX_OK_FOR_OFFSET_P, RTX_OK_FOR_OLO10_P): Move to...
        * config/sparc/sparc.c (RTX_OK_FOR_OFFSET_P,
        RTX_OK_FOR_OLO10_P): ...here.
        (sparc_mode_dependent_address_p): Use symbolic_operand instead of
        SYMBOLIC_CONST.


Index: gcc/config/sparc/sparc.c
===================================================================
--- gcc/config/sparc/sparc.c    (revision 173212)
+++ gcc/config/sparc/sparc.c    (working copy)
@@ -3110,6 +3110,12 @@
   return true;
 }
 
+#define RTX_OK_FOR_OFFSET_P(X)                                          \
+  (CONST_INT_P (X) && INTVAL (X) >= -0x1000 && INTVAL (X) < 0x1000 - 8)
+
+#define RTX_OK_FOR_OLO10_P(X)                                           \
+  (CONST_INT_P (X) && INTVAL (X) >= -0x1000 && INTVAL (X) < 0xc00 - 8)
+
 /* Return nonzero if ADDR is a valid memory address.
    STRICT specifies whether strict register checking applies.  */
 
@@ -3706,7 +3712,7 @@
       rtx op0 = XEXP (addr, 0);
       rtx op1 = XEXP (addr, 1);
       if (op0 == pic_offset_table_rtx
-         && SYMBOLIC_CONST (op1))
+         && symbolic_operand (op1, VOIDmode))
        return true;
     }
 
Index: gcc/config/sparc/sparc.h
===================================================================
--- gcc/config/sparc/sparc.h    (revision 173212)
+++ gcc/config/sparc/sparc.h    (working copy)
@@ -1538,41 +1538,6 @@
    addresses which require two reload registers.  */
 
 #define LEGITIMATE_PIC_OPERAND_P(X) legitimate_pic_operand_p (X)
-
-/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
-   and check its validity for a certain class.
-   We have two alternate definitions for each of them.
-   The usual definition accepts all pseudo regs; the other rejects
-   them unless they have been allocated suitable hard regs.
-   The symbol REG_OK_STRICT causes the latter definition to be used.
-
-   Most source files want to accept pseudo regs in the hope that
-   they will get allocated to the class that the insn wants them to be in.
-   Source files for reload pass need to be strict.
-   After reload, it makes no difference, since pseudo regs have
-   been eliminated by then.  */
-
-#ifndef REG_OK_STRICT
-
-/* Nonzero if X is a hard reg that can be used as an index
-   or if it is a pseudo reg.  */
-#define REG_OK_FOR_INDEX_P(X) \
-  (REGNO (X) < 32                              \
-   || REGNO (X) == FRAME_POINTER_REGNUM                \
-   || REGNO (X) >= FIRST_PSEUDO_REGISTER)
-
-/* Nonzero if X is a hard reg that can be used as a base reg
-   or if it is a pseudo reg.  */
-#define REG_OK_FOR_BASE_P(X)  REG_OK_FOR_INDEX_P (X)
-
-#else
-
-/* Nonzero if X is a hard reg that can be used as an index.  */
-#define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X))
-/* Nonzero if X is a hard reg that can be used as a base reg.  */
-#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X))
-
-#endif
 \f
 /* Should gcc use [%reg+%lo(xx)+offset] addresses?  */
 
@@ -1582,31 +1547,6 @@
 #define USE_AS_OFFSETABLE_LO10 0
 #endif
 \f
-/* On SPARC, the actual legitimate addresses must be REG+REG or REG+SMALLINT
-   ordinarily.  This changes a bit when generating PIC.  The details are
-   in sparc.c's implementation of TARGET_LEGITIMATE_ADDRESS_P.  */
-
-#define SYMBOLIC_CONST(X) symbolic_operand (X, VOIDmode)
-
-#define RTX_OK_FOR_BASE_P(X)                                           \
-  ((GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X))                      \
-  || (GET_CODE (X) == SUBREG                                           \
-      && GET_CODE (SUBREG_REG (X)) == REG                              \
-      && REG_OK_FOR_BASE_P (SUBREG_REG (X))))
-
-#define RTX_OK_FOR_INDEX_P(X)                                          \
-  ((GET_CODE (X) == REG && REG_OK_FOR_INDEX_P (X))                     \
-  || (GET_CODE (X) == SUBREG                                           \
-      && GET_CODE (SUBREG_REG (X)) == REG                              \
-      && REG_OK_FOR_INDEX_P (SUBREG_REG (X))))
-
-#define RTX_OK_FOR_OFFSET_P(X)                                         \
-  (GET_CODE (X) == CONST_INT && INTVAL (X) >= -0x1000 && INTVAL (X) < 0x1000 - 8)
-
-#define RTX_OK_FOR_OLO10_P(X)                                          \
-  (GET_CODE (X) == CONST_INT && INTVAL (X) >= -0x1000 && INTVAL (X) < 0xc00 - 8)
-
-\f
 /* Try a machine-dependent way of reloading an illegitimate address
    operand.  If we find one, push the reload and jump to WIN.  This
    macro is used in only one place: `find_reloads_address' in reload.c.  */


Anatoly.

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

* Re: [SPARC] Remove unused macros
  2011-05-04 19:12 [SPARC] Remove unused macros Anatoly Sokolov
@ 2011-05-08 12:12 ` Eric Botcazou
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Botcazou @ 2011-05-08 12:12 UTC (permalink / raw)
  To: Anatoly Sokolov; +Cc: gcc-patches, rth

>   This patch remove some unused macros from sparc.h. The
> RTX_OK_FOR_OFFSET_P and RTX_OK_FOR_OLO10_P macros is used only in
> sparc_legitimate_address_p function and moved to sparc.c.

Thanks for spotting this.

>   OK to install?
>
>
>         * config/sparc/sparc.h (REG_OK_FOR_INDEX_P, REG_OK_FOR_BASE_P,
>         SYMBOLIC_CONST, RTX_OK_FOR_BASE_P, RTX_OK_FOR_INDEX_P): Remove.
>         (RTX_OK_FOR_OFFSET_P, RTX_OK_FOR_OLO10_P): Move to...
>         * config/sparc/sparc.c (RTX_OK_FOR_OFFSET_P,
>         RTX_OK_FOR_OLO10_P): ...here.
>         (sparc_mode_dependent_address_p): Use symbolic_operand instead of
>         SYMBOLIC_CONST.

OK if you move...

> On SPARC, the actual legitimate addresses must be REG+REG or
> REG+SMALLINT -   ordinarily.  This changes a bit when generating PIC.

...this couple of sentences to the head comment of sparc_legitimate_address_p.

-- 
Eric Botcazou

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

end of thread, other threads:[~2011-05-08  8:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-04 19:12 [SPARC] Remove unused macros Anatoly Sokolov
2011-05-08 12:12 ` Eric Botcazou

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