+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
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 *);
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
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.