[ColdFire 21/63] Add *_REGNO_P macros
Roman Zippel
zippel@linux-m68k.org
Mon Jan 15 18:51:00 GMT 2007
Hi,
On Wed, 10 Jan 2007, Richard Sandiford wrote:
> Index: gcc/config/m68k/m68k.h
> ===================================================================
> --- gcc/config/m68k/m68k.h 2007-01-09 15:02:02.000000000 +0000
> +++ gcc/config/m68k/m68k.h 2007-01-09 15:02:04.000000000 +0000
> @@ -741,14 +741,33 @@ #define HAVE_PRE_DECREMENT 1
>
> /* Macros to check register numbers against specific register classes. */
>
> -#define REGNO_OK_FOR_INDEX_P(REGNO) \
> -((REGNO) < 16 || (unsigned) reg_renumber[REGNO] < 16)
> -#define REGNO_OK_FOR_BASE_P(REGNO) \
> -(((REGNO) ^ 010) < 8 || (unsigned) (reg_renumber[REGNO] ^ 010) < 8)
> -#define REGNO_OK_FOR_DATA_P(REGNO) \
> -((REGNO) < 8 || (unsigned) reg_renumber[REGNO] < 8)
> -#define REGNO_OK_FOR_FP_P(REGNO) \
> -(((REGNO) ^ 020) < 8 || (unsigned) (reg_renumber[REGNO] ^ 020) < 8)
> +/* True for data registers, D0 through D7. */
> +#define DATA_REGNO_P(REGNO) ((unsigned int) (REGNO) < 8)
> +
> +/* True for address registers, A0 through A7. */
> +#define ADDRESS_REGNO_P(REGNO) (((unsigned int) (REGNO) - 8) < 8)
> +
> +/* True for integer registers, D0 through D7 and A0 through A7. */
> +#define INT_REGNO_P(REGNO) ((unsigned int) (REGNO) < 16)
> +
> +/* True for floating point registers, FP0 through FP7. */
> +#define FP_REGNO_P(REGNO) (((unsigned int) (REGNO) - 16) < 8)
> +
> +#define REGNO_OK_FOR_INDEX_P(REGNO) \
> + (INT_REGNO_P (REGNO) \
> + || INT_REGNO_P (reg_renumber[REGNO]))
> +
> +#define REGNO_OK_FOR_BASE_P(REGNO) \
> + (ADDRESS_REGNO_P (REGNO) \
> + || ADDRESS_REGNO_P (reg_renumber[REGNO]))
> +
> +#define REGNO_OK_FOR_DATA_P(REGNO) \
> + (DATA_REGNO_P (REGNO) \
> + || DATA_REGNO_P (reg_renumber[REGNO]))
> +
> +#define REGNO_OK_FOR_FP_P(REGNO) \
> + (FP_REGNO_P (REGNO) \
> + || FP_REGNO_P (reg_renumber[REGNO]))
>
> /* Now macros that check whether X is a register and also,
> strictly, whether it is in a specified class.
This is not directly related to the patch, but because I'm seeing it and
I'm wondering about it.
Other archs like i386 only have the ...__OK_FOR_INDEX_P/_OK_FOR_BASE_P
variants and only there is reg_renumber is used. On m68k we also use it
for the more general macros like DATA_REG_P/ADDRESS_REG_P. The question
is, couldn't we cleanup the reg_renumber usage a little here?
bye, Roman
More information about the Gcc-patches
mailing list