From 07ee3b586d70c3596f1cf284b7154024ed27aeb6 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Wed, 18 Feb 2004 22:05:47 +0000 Subject: [PATCH] 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 --- gcc/ChangeLog | 10 ++++++++++ gcc/config/h8300/h8300-protos.h | 2 ++ gcc/config/h8300/h8300.c | 26 ++++++++++++++++++++++++++ gcc/config/h8300/h8300.h | 26 ++++---------------------- 4 files changed, 42 insertions(+), 22 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 59750e81aa7..e0af65acbbd 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2004-02-18 Kazu Hirata + + * 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 * cpphash.h (struct cpp_buffer): Restore return_at_eof field. This diff --git a/gcc/config/h8300/h8300-protos.h b/gcc/config/h8300/h8300-protos.h index a37933a8211..4f03f9815f1 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 6857f80c838..b34ddd32c31 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 52b3a70bdcf..6b2d1aa264a 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. -- 2.30.2