diff options
author | Kazu Hirata <kazu@cs.umass.edu> | 2002-10-29 17:55:45 +0000 |
---|---|---|
committer | Kazu Hirata <kazu@gcc.gnu.org> | 2002-10-29 17:55:45 +0000 |
commit | 803d56f52a6eee9870b0f5c821f2bc24b025bf0a (patch) | |
tree | 25fa6c8a4235d87e518bce3356a48de9b773b28c /gcc | |
parent | 6bb8a3f75af9ddb66a0e35fe2be54b6a4bf109e1 (diff) | |
download | gcc-803d56f52a6eee9870b0f5c821f2bc24b025bf0a.zip gcc-803d56f52a6eee9870b0f5c821f2bc24b025bf0a.tar.gz gcc-803d56f52a6eee9870b0f5c821f2bc24b025bf0a.tar.bz2 |
h8300.c (h8300_eightbit_constant_address_p): New.
* config/h8300/h8300.c (h8300_eightbit_constant_address_p): New.
(h8300_tiny_constant_address_p): Likewise.
* config/h8300/h8300.h (EIGHTBIT_CONSTANT_ADDRESS_P): Use
h8300_eightbit_constant_address_p.
(TINY_CONSTANT_ADDRESS_P): Use h8300_tiny_constant_address_p.
* config/h8300/h8300-protos.h: Add the prototypes for the two
new functions.
From-SVN: r58628
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/config/h8300/h8300-protos.h | 3 | ||||
-rw-r--r-- | gcc/config/h8300/h8300.c | 53 | ||||
-rw-r--r-- | gcc/config/h8300/h8300.h | 21 |
4 files changed, 70 insertions, 17 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 95f304f..3fb826f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,15 @@ 2002-10-29 Kazu Hirata <kazu@cs.umass.edu> + * config/h8300/h8300.c (h8300_eightbit_constant_address_p): New. + (h8300_tiny_constant_address_p): Likewise. + * config/h8300/h8300.h (EIGHTBIT_CONSTANT_ADDRESS_P): Use + h8300_eightbit_constant_address_p. + (TINY_CONSTANT_ADDRESS_P): Use h8300_tiny_constant_address_p. + * config/h8300/h8300-protos.h: Add the prototypes for the two + new functions. + +2002-10-29 Kazu Hirata <kazu@cs.umass.edu> + * reload1.c (update_eliminables): Unconditionally check if frame_pointer_needed has changed. diff --git a/gcc/config/h8300/h8300-protos.h b/gcc/config/h8300/h8300-protos.h index c786f9f..b88ade0 100644 --- a/gcc/config/h8300/h8300-protos.h +++ b/gcc/config/h8300/h8300-protos.h @@ -60,6 +60,9 @@ extern int bit_memory_operand PARAMS ((rtx, enum machine_mode)); extern int bit_operator PARAMS ((rtx, enum machine_mode)); extern int nshift_operator PARAMS ((rtx, enum machine_mode)); +extern int h8300_eightbit_constant_address_p PARAMS ((rtx)); +extern int h8300_tiny_constant_address_p PARAMS ((rtx)); + /* Used in builtins.c */ extern rtx h8300_return_addr_rtx PARAMS ((int, rtx)); #endif /* RTX_CODE */ diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c index 8461d5c..55ac700 100644 --- a/gcc/config/h8300/h8300.c +++ b/gcc/config/h8300/h8300.c @@ -3856,3 +3856,56 @@ h8300_asm_named_section (name, flags) fprintf (asm_out_file, "\t.section %s\n", name); } #endif /* ! OBJECT_FORMAT_ELF */ + +int +h8300_eightbit_constant_address_p (x) + rtx x; +{ + /* The ranges the 8-bit area. */ + const unsigned HOST_WIDE_INT n1 = trunc_int_for_mode (0x0000ff00, SImode); + const unsigned HOST_WIDE_INT n2 = trunc_int_for_mode (0x0000ffff, SImode); + const unsigned HOST_WIDE_INT h1 = trunc_int_for_mode (0x00ffff00, SImode); + const unsigned HOST_WIDE_INT h2 = trunc_int_for_mode (0x00ffffff, SImode); + const unsigned HOST_WIDE_INT s1 = trunc_int_for_mode (0xffffff00, SImode); + const unsigned HOST_WIDE_INT s2 = trunc_int_for_mode (0xffffffff, SImode); + + unsigned HOST_WIDE_INT addr; + + if (GET_CODE (x) != CONST_INT) + return 0; + + addr = INTVAL (x); + + return (0 + || (TARGET_H8300 && IN_RANGE (addr, n1, n2)) + || (TARGET_H8300H && IN_RANGE (addr, h1, h2)) + || (TARGET_H8300S && IN_RANGE (addr, s1, s2))); +} + +int +h8300_tiny_constant_address_p (x) + rtx x; +{ + /* The ranges for the 16-bit area. */ + const unsigned HOST_WIDE_INT h1 = trunc_int_for_mode (0x00000000, SImode); + const unsigned HOST_WIDE_INT h2 = trunc_int_for_mode (0x00007fff, SImode); + const unsigned HOST_WIDE_INT h3 = trunc_int_for_mode (0x00ff8000, SImode); + const unsigned HOST_WIDE_INT h4 = trunc_int_for_mode (0x00ffffff, SImode); + const unsigned HOST_WIDE_INT s1 = trunc_int_for_mode (0x00000000, SImode); + const unsigned HOST_WIDE_INT s2 = trunc_int_for_mode (0x00007fff, SImode); + const unsigned HOST_WIDE_INT s3 = trunc_int_for_mode (0xffff8000, SImode); + const unsigned HOST_WIDE_INT s4 = trunc_int_for_mode (0xffffffff, SImode); + + unsigned HOST_WIDE_INT addr; + + if (GET_CODE (x) != CONST_INT) + return 0; + + addr = INTVAL (x); + + return (0 + || (TARGET_H8300H + && IN_RANGE (addr, h1, h2) || IN_RANGE (addr, h3, h4)) + || (TARGET_H8300S + && IN_RANGE (addr, s1, s2) || IN_RANGE (addr, s3, s4))); +} diff --git a/gcc/config/h8300/h8300.h b/gcc/config/h8300/h8300.h index 927484a..1e4b1dd 100644 --- a/gcc/config/h8300/h8300.h +++ b/gcc/config/h8300/h8300.h @@ -837,27 +837,14 @@ struct cum_arg /* Nonzero if X is a constant address suitable as an 8-bit absolute, which is a special case of the 'R' operand. */ -#define EIGHTBIT_CONSTANT_ADDRESS_P(X) \ - ((GET_CODE (X) == CONST_INT) \ - && ((TARGET_H8300 && IN_RANGE (INTVAL (X) & 0xffff, 0xff00, 0xffff)) \ - || (TARGET_H8300H && IN_RANGE (INTVAL (X) & 0xffffffff, \ - 0xffff00, 0xffffff)) \ - || (TARGET_H8300S && IN_RANGE (INTVAL (X) & 0xffffffff, \ - 0xffffff00, 0xffffffff)))) +#define EIGHTBIT_CONSTANT_ADDRESS_P(X) \ + h8300_eightbit_constant_address_p (X) /* Nonzero if X is a constant address suitable as an 16-bit absolute on H8/300H and H8S. */ -#define TINY_CONSTANT_ADDRESS_P(X) \ - ((GET_CODE (X) == CONST_INT) \ - && ((TARGET_H8300H \ - && (IN_RANGE (INTVAL (X) & 0xffffffff, 0x000000, 0x007fff) \ - || IN_RANGE (INTVAL (X) & 0xffffffff, 0xff8000, 0xffffff))) \ - || (TARGET_H8300S \ - && (IN_RANGE (INTVAL (X) & 0xffffffff, \ - 0x00000000, 0x00007fff) \ - || IN_RANGE (INTVAL (X) & 0xffffffff, \ - 0xffff8000, 0xffffffff))))) +#define TINY_CONSTANT_ADDRESS_P(X) \ + h8300_tiny_constant_address_p (X) /* 'U' if valid for a bset destination; i.e. a register, register indirect, or the eightbit memory region |