Patchwork [m68hc11] Hookize CLASS_LIKELY_SPILLED_P macro

login
register
mail settings
Submitter Anatoly Sokolov
Date Sept. 20, 2010, 4:35 p.m.
Message ID <1852359126.20100920203501@post.ru>
Download mbox | patch
Permalink /patch/65223/
State New
Headers show

Comments

Anatoly Sokolov - Sept. 20, 2010, 4:35 p.m.
Hi.

  This patch removes obsolete CLASS_LIKELY_SPILLED_P macro from the
m68hc11 back end in the GCC and introduces equivalent
TARGET_CLASS_LIKELY_SPILLED_P target hook.


  Untested.

  OK to install?

        * config/m68hc11/m68hc11.h (CLASS_LIKELY_SPILLED_P): Remove.
        * config/m68hc11/m68hc11.c (TARGET_CLASS_LIKELY_SPILLED_P): Define.
        (m68hc11_class_likely_spilled_p): New function.




Anatoly.
Anatoly Sokolov - Sept. 27, 2010, 4:01 p.m.
Hi.

Only the m68hc11 back end using  CLASS_LIKELY_SPILLED_P macro now. This 
patch
should allow to remove the CLASS_LIKELY_SPILLED_P macro from the GCC.

http://gcc.gnu.org/ml/gcc-patches/2010-09/msg01584.html

>  This patch removes obsolete CLASS_LIKELY_SPILLED_P macro from the
> m68hc11 back end in the GCC and introduces equivalent
> TARGET_CLASS_LIKELY_SPILLED_P target hook.
>
>  Untested.
>
 > OK to install?
>
 >       * config/m68hc11/m68hc11.h (CLASS_LIKELY_SPILLED_P): Remove.
 >      * config/m68hc11/m68hc11.c (TARGET_CLASS_LIKELY_SPILLED_P): Define.
 >       (m68hc11_class_likely_spilled_p): New function.



Anatoly.
Anatoly Sokolov - Oct. 4, 2010, 9:20 p.m.
Hi

Only the m68hc11 back end using  CLASS_LIKELY_SPILLED_P macro now. This 
patch block patch to remove the C_L_S_P macro from the GCC.

http://gcc.gnu.org/ml/gcc-patches/2010-09/msg01584.html
http://gcc.gnu.org/ml/gcc-patches/2010-09/msg02286.html

>         * config/m68hc11/m68hc11.h (CLASS_LIKELY_SPILLED_P): Remove.
>         * config/m68hc11/m68hc11.c (TARGET_CLASS_LIKELY_SPILLED_P): Define.
>         (m68hc11_class_likely_spilled_p): New function.


Anatoly.
Richard Henderson - Oct. 4, 2010, 9:29 p.m.
On 09/27/2010 09:01 AM, Anatoly Sokolov wrote:
> +  switch (rclass)
> +    {
> +      case D_REGS:

Indentation is wrong; case/default should align with the {.

Otherwise ok.


r~

Patch

Index: gcc/config/m68hc11/m68hc11.c
===================================================================
--- gcc/config/m68hc11/m68hc11.c        (revision 164423)
+++ gcc/config/m68hc11/m68hc11.c        (working copy)
@@ -76,6 +76,7 @@ 
 static bool m68hc11_rtx_costs (rtx, int, int, int *, bool);
 static tree m68hc11_handle_fntype_attribute (tree *, tree, tree, int, bool *);
 static tree m68hc11_handle_page0_attribute (tree *, tree, tree, int, bool *);
+static bool m68hc11_class_likely_spilled_p (reg_class_t);
 
 void create_regs_rtx (void);
 
@@ -291,6 +292,9 @@ 
 #undef TARGET_CAN_ELIMINATE
 #define TARGET_CAN_ELIMINATE m68hc11_can_eliminate
 
+#undef TARGET_CLASS_LIKELY_SPILLED_P
+#define TARGET_CLASS_LIKELY_SPILLED_P m68hc11_class_likely_spilled_p
+
 #undef TARGET_TRAMPOLINE_INIT
 #define TARGET_TRAMPOLINE_INIT m68hc11_trampoline_init
 
@@ -581,6 +585,33 @@ 
   return rclass;
 }
 
+/* Implement TARGET_CLASS_LIKELY_SPILLED_P.  */
+
+static bool
+m68hc11_class_likely_spilled_p (reg_class_t rclass)
+{
+  switch (rclass)
+    {
+      case D_REGS:
+      case X_REGS:
+      case Y_REGS:
+      case A_REGS:
+      case SP_REGS:
+      case D_OR_X_REGS:
+      case D_OR_Y_REGS:
+      case X_OR_SP_REGS:
+      case Y_OR_SP_REGS:
+      case D_OR_SP_REGS:
+        return true;
+
+      default:
+        break;
+    }
+
+  return false;
+}
+
+
 /* Return 1 if the operand is a valid indexed addressing mode.
    For 68hc11:  n,r    with n in [0..255] and r in A_REGS class
    For 68hc12:  n,r    no constraint on the constant, r in A_REGS class.  */
Index: gcc/config/m68hc11/m68hc11.h
===================================================================
--- gcc/config/m68hc11/m68hc11.h        (revision 164423)
+++ gcc/config/m68hc11/m68hc11.h        (working copy)
@@ -704,34 +704,6 @@ 
 #define HARD_REGNO_RENAME_OK(REGNO1,REGNO2) \
   m68hc11_hard_regno_rename_ok ((REGNO1), (REGNO2))
 
-/* A C expression whose value is nonzero if pseudos that have been
-   assigned to registers of class CLASS would likely be spilled
-   because registers of CLASS are needed for spill registers.
-
-   The default value of this macro returns 1 if CLASS has exactly one
-   register and zero otherwise.  On most machines, this default
-   should be used.  Only define this macro to some other expression
-   if pseudo allocated by `local-alloc.c' end up in memory because
-   their hard registers were needed for spill registers.  If this
-   macro returns nonzero for those classes, those pseudos will only
-   be allocated by `global.c', which knows how to reallocate the
-   pseudo to another register.  If there would not be another
-   register available for reallocation, you should not change the
-   definition of this macro since the only effect of such a
-   definition would be to slow down register allocation.  */
-
-#define CLASS_LIKELY_SPILLED_P(CLASS)                                  \
-  (((CLASS) == D_REGS)                                                 \
-   || ((CLASS) == X_REGS)                                               \
-   || ((CLASS) == Y_REGS)                                               \
-   || ((CLASS) == A_REGS)                                               \
-   || ((CLASS) == SP_REGS)                                              \
-   || ((CLASS) == D_OR_X_REGS)                                          \
-   || ((CLASS) == D_OR_Y_REGS)                                          \
-   || ((CLASS) == X_OR_SP_REGS)                                         \
-   || ((CLASS) == Y_OR_SP_REGS)                                         \
-   || ((CLASS) == D_OR_SP_REGS))
-
 /* Return the maximum number of consecutive registers needed to represent
    mode MODE in a register of class CLASS.  */
 #define CLASS_MAX_NREGS(CLASS, MODE)           \