public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [M32C] Hookize CLASS_MAX_NREGS
@ 2011-08-22 20:34 Anatoly Sokolov
  2011-08-22 20:39 ` DJ Delorie
  0 siblings, 1 reply; 2+ messages in thread
From: Anatoly Sokolov @ 2011-08-22 20:34 UTC (permalink / raw)
  To: gcc-patches; +Cc: dj

Hi.

  This patch removes obsolete CLASS_MAX_NREGS macro from M32C back end in the 
GCC and introduces equivalent TARGET_CLASS_MAX_NREGS target hooks.

  Regression tested on m32c-unknown-elf.

  OK to install?

        * config/m32c/m32c.h (CLASS_MAX_NREGS): Remove macro.
        * config/m32c/m32c-protos.h (m32c_class_max_nregs): Remove.
        * config/m32c/m32c.c (m32c_class_max_nregs): Make static. Change
        regclass argument type to reg_class_t. Change 'max' and 'v' vars
        and return types to unsigned char. Use reg_class_contents instead
        of class_contents.
        (TARGET_CLASS_MAX_NREGS): Define.


Index: gcc/config/m32c/m32c.c
===================================================================
--- gcc/config/m32c/m32c.c      (revision 177968)
+++ gcc/config/m32c/m32c.c      (working copy)
@@ -859,18 +859,23 @@
   return (reg_class_size[(int) regclass] == 1);
 }
 
-/* Implements CLASS_MAX_NREGS.  We calculate this according to its
+/* Implements TARGET_CLASS_MAX_NREGS.  We calculate this according to its
    documented meaning, to avoid potential inconsistencies with actual
    class definitions.  */
-int
-m32c_class_max_nregs (int regclass, enum machine_mode mode)
+
+#undef TARGET_CLASS_MAX_NREGS
+#define TARGET_CLASS_MAX_NREGS m32c_class_max_nregs
+
+static unsigned char
+m32c_class_max_nregs (reg_class_t regclass, enum machine_mode mode)
 {
-  int rn, max = 0;
+  int rn;
+  unsigned char max = 0;
 
   for (rn = 0; rn < FIRST_PSEUDO_REGISTER; rn++)
-    if (class_contents[regclass][0] & (1 << rn))
+    if (TEST_HARD_REG_BIT (reg_class_contents[(int) regclass], rn))
       {
-       int n = m32c_hard_regno_nregs (rn, mode);
+       unsigned char n = m32c_hard_regno_nregs (rn, mode);
        if (max < n)
          max = n;
       }
Index: gcc/config/m32c/m32c.h
===================================================================
--- gcc/config/m32c/m32c.h      (revision 177968)
+++ gcc/config/m32c/m32c.h      (working copy)
@@ -425,8 +425,6 @@
 
 #define TARGET_SMALL_REGISTER_CLASSES_FOR_MODE_P hook_bool_mode_true
 
-#define CLASS_MAX_NREGS(C,M) m32c_class_max_nregs (C, M)
-
 #define CANNOT_CHANGE_MODE_CLASS(F,T,C) m32c_cannot_change_mode_class(F,T,C)
 
 #define CONST_OK_FOR_CONSTRAINT_P(VALUE,C,STR) \
Index: gcc/config/m32c/m32c-protos.h
===================================================================
--- gcc/config/m32c/m32c-protos.h       (revision 177968)
+++ gcc/config/m32c/m32c-protos.h       (working copy)
@@ -44,7 +44,6 @@
 #ifdef RTX_CODE
 
 int  m32c_cannot_change_mode_class (enum machine_mode, enum machine_mode, int);
-int  m32c_class_max_nregs (int, enum machine_mode);
 rtx  m32c_eh_return_stackadj_rtx (void);
 void m32c_emit_eh_epilogue (rtx);
 int  m32c_expand_cmpstr (rtx *);


Anatoly.

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

* Re: [M32C] Hookize CLASS_MAX_NREGS
  2011-08-22 20:34 [M32C] Hookize CLASS_MAX_NREGS Anatoly Sokolov
@ 2011-08-22 20:39 ` DJ Delorie
  0 siblings, 0 replies; 2+ messages in thread
From: DJ Delorie @ 2011-08-22 20:39 UTC (permalink / raw)
  To: Anatoly Sokolov; +Cc: gcc-patches


>   OK to install?
> 
>         * config/m32c/m32c.h (CLASS_MAX_NREGS): Remove macro.
>         * config/m32c/m32c-protos.h (m32c_class_max_nregs): Remove.
>         * config/m32c/m32c.c (m32c_class_max_nregs): Make static. Change
>         regclass argument type to reg_class_t. Change 'max' and 'v' vars
>         and return types to unsigned char. Use reg_class_contents instead
>         of class_contents.
>         (TARGET_CLASS_MAX_NREGS): Define.

Ok.

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

end of thread, other threads:[~2011-08-22 19:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-22 20:34 [M32C] Hookize CLASS_MAX_NREGS Anatoly Sokolov
2011-08-22 20:39 ` DJ Delorie

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