From a204fec0cbb0097002847875e64c0850defcfe5e Mon Sep 17 00:00:00 2001 From: Alexandre Oliva Date: Sun, 23 Apr 2000 21:40:51 +0000 Subject: [PATCH] mn10300.h (REGNO_IN_RANGE_P): New macro. * config/mn10300/mn10300.h (REGNO_IN_RANGE_P): New macro. (REGNO_DATA_P, REGNO_ADDRESS_P, REGNO_SP_P): New macros. (REGNO_EXTENDED_P, REGNO_AM33_P): New macros. (REGNO_OK_FOR_BASE_P): Define in terms of them. (REGNO_OK_FOR_BIT_BASE_P, REGNO_OK_FOR_INDEX_P): Likewise. (REG_OK_FOR_BASE_P): Define in terms of the REGNO macro. (REG_OK_FOR_BIT_BASE_P, REG_OK_FOR_INDEX_P): Likewise. From-SVN: r33359 --- gcc/ChangeLog | 10 +++++ gcc/config/mn10300/mn10300.h | 82 +++++++++++++++++------------------- 2 files changed, 49 insertions(+), 43 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6456636e6a8..9e4789702f1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +Sun Apr 23 18:37:53 2000 Alexandre Oliva + + * config/mn10300/mn10300.h (REGNO_IN_RANGE_P): New macro. + (REGNO_DATA_P, REGNO_ADDRESS_P, REGNO_SP_P): New macros. + (REGNO_EXTENDED_P, REGNO_AM33_P): New macros. + (REGNO_OK_FOR_BASE_P): Define in terms of them. + (REGNO_OK_FOR_BIT_BASE_P, REGNO_OK_FOR_INDEX_P): Likewise. + (REG_OK_FOR_BASE_P): Define in terms of the REGNO macro. + (REG_OK_FOR_BIT_BASE_P, REG_OK_FOR_INDEX_P): Likewise. + Sun Apr 23 22:23:08 MET DST 2000 Jan Hubicka * loop.c (simplify_giv_expr): Be more agressive on simplifying diff --git a/gcc/config/mn10300/mn10300.h b/gcc/config/mn10300/mn10300.h index dbf5191438f..bbea7b10146 100644 --- a/gcc/config/mn10300/mn10300.h +++ b/gcc/config/mn10300/mn10300.h @@ -292,26 +292,55 @@ enum reg_class { /* Macros to check register numbers against specific register classes. */ +/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx + and check its validity for a certain class. + We have two alternate definitions for each of them. + The usual definition accepts all pseudo regs; the other rejects + them unless they have been allocated suitable hard regs. + The symbol REG_OK_STRICT causes the latter definition to be used. + + Most source files want to accept pseudo regs in the hope that + they will get allocated to the class that the insn wants them to be in. + Source files for reload pass need to be strict. + After reload, it makes no difference, since pseudo regs have + been eliminated by then. */ + /* These assume that REGNO is a hard or pseudo reg number. They give nonzero only if REGNO is a hard reg of the suitable class or a pseudo reg currently allocated to a suitable hard reg. Since they use reg_renumber, they are safe only once reg_renumber has been allocated, which happens in local-alloc.c. */ - + +#ifndef REG_OK_STRICT +# define REGNO_IN_RANGE_P(regno,min,max) \ + (((regno) >= (min) && (regno) <= (max)) || (regno) >= FIRST_PSEUDO_REGISTER) +#else +# define REGNO_IN_RANGE_P(regno,min,max) \ + (((regno) >= (min) && (regno) <= (max)) \ + || (reg_renumber \ + && reg_renumber[(regno)] >= (min) && reg_renumber[(regno)] <= (max))) +#endif + +#define REGNO_DATA_P(regno) REGNO_IN_RANGE_P ((regno), 0, 3) +#define REGNO_ADDRESS_P(regno) REGNO_IN_RANGE_P ((regno), 4, 8) +#define REGNO_SP_P(regno) REGNO_IN_RANGE_P ((regno), 9, 9) +#define REGNO_EXTENDED_P(regno) REGNO_IN_RANGE_P ((regno), 10, 17) +#define REGNO_AM33_P(regno) \ + (REGNO_DATA_P ((regno)) || REGNO_ADDRESS_P ((regno)) \ + || REGNO_EXTENDED_P ((regno))) + #define REGNO_OK_FOR_BASE_P(regno) \ - (((regno) > 3 && regno < FIRST_PSEUDO_REGISTER) \ - || (reg_renumber[regno] > 3 && reg_renumber[regno] < FIRST_PSEUDO_REGISTER)) + (REGNO_SP_P ((regno)) \ + || REGNO_ADDRESS_P ((regno)) || REGNO_EXTENDED_P ((regno))) +#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X)) #define REGNO_OK_FOR_BIT_BASE_P(regno) \ - (((regno) > 3 && regno < 10) \ - || (reg_renumber[regno] > 3 && reg_renumber[regno] < 10)) + (REGNO_SP_P ((regno)) || REGNO_ADDRESS_P ((regno))) +#define REG_OK_FOR_BIT_BASE_P(X) REGNO_OK_FOR_BIT_BASE_P (REGNO (X)) #define REGNO_OK_FOR_INDEX_P(regno) \ - (((regno) >= 0 && regno < 4) \ - || ((regno) >= 10 && regno < 18) \ - || (reg_renumber[regno] >= 10 && reg_renumber[regno] < 18) \ - || (reg_renumber[regno] >= 0 && reg_renumber[regno] < 4)) - + (REGNO_DATA_P ((regno)) || REGNO_EXTENDED_P ((regno))) +#define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X)) /* Given an rtx X being reloaded into a reg required to be in class CLASS, return the class of reg to actually use. @@ -646,39 +675,6 @@ struct cum_arg {int nbytes; }; #define MAX_REGS_PER_ADDRESS 2 -/* The macros REG_OK_FOR..._P assume that the arg is a REG rtx - and check its validity for a certain class. - We have two alternate definitions for each of them. - The usual definition accepts all pseudo regs; the other rejects - them unless they have been allocated suitable hard regs. - The symbol REG_OK_STRICT causes the latter definition to be used. - - Most source files want to accept pseudo regs in the hope that - they will get allocated to the class that the insn wants them to be in. - Source files for reload pass need to be strict. - After reload, it makes no difference, since pseudo regs have - been eliminated by then. */ - -#ifndef REG_OK_STRICT -/* Nonzero if X is a hard reg that can be used as an index - or if it is a pseudo reg. */ -#define REG_OK_FOR_INDEX_P(X) \ - ((REGNO (X) >= 0 && REGNO(X) <= 3) || REGNO (X) >= 10) -/* Nonzero if X is a hard reg that can be used as a base reg - or if it is a pseudo reg. */ -#define REG_OK_FOR_BASE_P(X) \ - ((REGNO (X) >= 4 && REGNO(X) <= 9) || REGNO (X) >= 10) -#define REG_OK_FOR_BIT_BASE_P(X) \ - ((REGNO (X) >= 4 && REGNO(X) <= 9)) -#else -/* Nonzero if X is a hard reg that can be used as an index. */ -#define REG_OK_FOR_INDEX_P(X) REGNO_OK_FOR_INDEX_P (REGNO (X)) -/* Nonzero if X is a hard reg that can be used as a base reg. */ -#define REG_OK_FOR_BASE_P(X) REGNO_OK_FOR_BASE_P (REGNO (X)) -/* Nonzero if X is a hard reg that can be used as a base reg. */ -#define REG_OK_FOR_BIT_BASE_P(X) REGNO_OK_FOR_BIT_BASE_P (REGNO (X)) -#endif - #define HAVE_POST_INCREMENT (TARGET_AM33)