h8300-protos.h: Add prototypes for h8300_hard_regno_nregs and h8300_hard_regno_mode_ok.
authorKazu Hirata <kazu@cs.umass.edu>
Wed, 18 Feb 2004 22:05:47 +0000 (22:05 +0000)
committerKazu Hirata <kazu@gcc.gnu.org>
Wed, 18 Feb 2004 22:05:47 +0000 (22:05 +0000)
* config/h8300/h8300-protos.h: Add prototypes for
h8300_hard_regno_nregs and h8300_hard_regno_mode_ok.
* config/h8300/h8300.c (h8300_hard_regno_nregs): New.
(h8300_hard_regno_mode_ok): Likewise.
* config/h8300/h8300.h (HARD_REGNO_NREGS): Call
h8300_hard_regno_nregs().
(HARD_REGNO_MODE_OK): Call h8300_hard_regno_mode_ok().

From-SVN: r78050

gcc/ChangeLog
gcc/config/h8300/h8300-protos.h
gcc/config/h8300/h8300.c
gcc/config/h8300/h8300.h

index 59750e81aa782e46412d7d3374d70bde5d61e67c..e0af65acbbd72bd6f66daf3cfe4919c417156d0e 100644 (file)
@@ -1,3 +1,13 @@
+2004-02-18  Kazu Hirata  <kazu@cs.umass.edu>
+
+       * config/h8300/h8300-protos.h: Add prototypes for
+       h8300_hard_regno_nregs and h8300_hard_regno_mode_ok.
+       * config/h8300/h8300.c (h8300_hard_regno_nregs): New.
+       (h8300_hard_regno_mode_ok): Likewise.
+       * config/h8300/h8300.h (HARD_REGNO_NREGS): Call
+       h8300_hard_regno_nregs().
+       (HARD_REGNO_MODE_OK): Call h8300_hard_regno_mode_ok().
+
 2004-02-18  Per Bothner  <per@bothner.com>
 
        * cpphash.h (struct cpp_buffer):  Restore return_at_eof field.  This
index a37933a8211e4b97ca0396b13f603bdf1f0d7444..4f03f9815f1c944cfd8edefd3a58991621a70add 100644 (file)
@@ -104,6 +104,8 @@ extern int h8300_current_function_interrupt_function_p (void);
 extern int h8300_initial_elimination_offset (int, int);
 extern int h8300_regs_ok_for_stm (int, rtx[]);
 extern int h8300_hard_regno_rename_ok (unsigned int, unsigned int);
+extern int h8300_hard_regno_nregs (int, enum machine_mode);
+extern int h8300_hard_regno_mode_ok (int, enum machine_mode);
 
 struct cpp_reader;
 extern void h8300_pr_interrupt (struct cpp_reader *);
index 6857f80c838295e73dfd492a7356752112cca57f..b34ddd32c31a2c30bbef17f38bddf4e3e4fa4c49 100644 (file)
@@ -4706,6 +4706,32 @@ h8300_legitimate_address_p (rtx x, int strict)
 
   return 0;
 }
+
+/* Worker function for HARD_REGNO_NREGS.
+
+   We pretend the MAC register is 32bits -- we don't have any data
+   types on the H8 series to handle more than 32bits.  */
+
+int
+h8300_hard_regno_nregs (int regno ATTRIBUTE_UNUSED, enum machine_mode mode)
+{
+  return (GET_MODE_SIZE (mode) + UNITS_PER_WORD - 1) / UNITS_PER_WORD;
+}
+
+/* Worker function for HARD_REGNO_MODE_OK.  */
+
+int
+h8300_hard_regno_mode_ok (int regno, enum machine_mode mode)
+{
+  if (TARGET_H8300)
+    /* If an even reg, then anything goes.  Otherwise the mode must be
+       QI or HI.  */
+    return ((regno & 1) == 0) || (mode == HImode) || (mode == QImode);
+  else
+    /* MAC register can only be of SImode.  Otherwise, anything
+       goes.  */
+    return regno == MAC_REG ? mode == SImode : 1;
+}
 \f
 /* Perform target dependent optabs initialization.  */
 static void
index 52b3a70bdcf0c5b23a1d6217613d5cc56ecee746..6b2d1aa264aa575a263f8c55bf0e1c82c9e60ba8 100644 (file)
@@ -316,29 +316,11 @@ extern int target_flags;
     fixed_regs[MAC_REG] = call_used_regs[MAC_REG] = 1; \
 }
 
-/* Return number of consecutive hard regs needed starting at reg REGNO
-   to hold something of mode MODE.
+#define HARD_REGNO_NREGS(REGNO, MODE)          \
+  h8300_hard_regno_nregs ((REGNO), (MODE))
 
-   This is ordinarily the length in words of a value of mode MODE
-   but can be less for certain modes in special long registers.
-
-   We pretend the MAC register is 32bits -- we don't have any data
-   types on the H8 series to handle more than 32bits.  */
-
-#define HARD_REGNO_NREGS(REGNO, MODE)   \
-   ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
-
-/* Value is 1 if hard register REGNO can hold a value of machine-mode
-   MODE.
-
-   H8/300: If an even reg, then anything goes. Otherwise the mode must be QI
-           or HI.
-   H8/300H: Anything goes.  */
-
-#define HARD_REGNO_MODE_OK(REGNO, MODE)                                        \
-  (TARGET_H8300                                                                \
-   ? ((((REGNO) & 1) == 0) || ((MODE) == HImode) || ((MODE) == QImode))        \
-   : (REGNO) == MAC_REG ? (MODE) == SImode : 1)
+#define HARD_REGNO_MODE_OK(REGNO, MODE)                \
+  h8300_hard_regno_mode_ok ((REGNO), (MODE))
 
 /* Value is 1 if it is a good idea to tie two pseudo registers
    when one has mode MODE1 and one has mode MODE2.