aboutsummaryrefslogtreecommitdiff
path: root/gcc/config
diff options
context:
space:
mode:
authorKazu Hirata <kazu@cs.umass.edu>2004-02-18 22:05:47 +0000
committerKazu Hirata <kazu@gcc.gnu.org>2004-02-18 22:05:47 +0000
commit07ee3b586d70c3596f1cf284b7154024ed27aeb6 (patch)
treea9b54d1c0a1b60af70d9616806b0e0cc2aaa616a /gcc/config
parent22234f56d2395ae470961d3eb5fdc65a7597af9a (diff)
downloadgcc-07ee3b586d70c3596f1cf284b7154024ed27aeb6.zip
gcc-07ee3b586d70c3596f1cf284b7154024ed27aeb6.tar.gz
gcc-07ee3b586d70c3596f1cf284b7154024ed27aeb6.tar.bz2
h8300-protos.h: Add prototypes for h8300_hard_regno_nregs and h8300_hard_regno_mode_ok.
* 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
Diffstat (limited to 'gcc/config')
-rw-r--r--gcc/config/h8300/h8300-protos.h2
-rw-r--r--gcc/config/h8300/h8300.c26
-rw-r--r--gcc/config/h8300/h8300.h26
3 files changed, 32 insertions, 22 deletions
diff --git a/gcc/config/h8300/h8300-protos.h b/gcc/config/h8300/h8300-protos.h
index a37933a..4f03f98 100644
--- a/gcc/config/h8300/h8300-protos.h
+++ b/gcc/config/h8300/h8300-protos.h
@@ -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 *);
diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c
index 6857f80..b34ddd3 100644
--- a/gcc/config/h8300/h8300.c
+++ b/gcc/config/h8300/h8300.c
@@ -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;
+}
/* Perform target dependent optabs initialization. */
static void
diff --git a/gcc/config/h8300/h8300.h b/gcc/config/h8300/h8300.h
index 52b3a70..6b2d1aa 100644
--- a/gcc/config/h8300/h8300.h
+++ b/gcc/config/h8300/h8300.h
@@ -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.