diff options
author | kazu <kazu@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-03-01 08:57:14 +0000 |
---|---|---|
committer | kazu <kazu@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-03-01 08:57:14 +0000 |
commit | 58b67d364774fb6e12daf03e6b3f4d9c570272dc (patch) | |
tree | d6833c54680736ca3a849cce0ac9703d2c52420e /gcc | |
parent | 81629ee65f030f4caae89049a2407b3e6aaf4596 (diff) | |
download | gcc-58b67d364774fb6e12daf03e6b3f4d9c570272dc.tar.gz |
* config/h8300/h8300.c (print_operand): Support 16-bit
constant addresses.
* config/h8300/h8300.h (TINY_CONSTANT_ADDRESS_P): New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@50191 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/config/h8300/h8300.c | 45 | ||||
-rw-r--r-- | gcc/config/h8300/h8300.h | 8 |
3 files changed, 46 insertions, 13 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index df3eded181b..d8e0b1f89ad 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2002-03-01 Kazu Hirata <kazu@hxi.com> + + * config/h8300/h8300.c (print_operand): Support 16-bit + constant addresses. + * config/h8300/h8300.h (TINY_CONSTANT_ADDRESS_P): New. + 2002-02-28 Richard Henderson <rth@redhat.com> * expmed.c (store_bit_field): Prevent generation of CONCATs; diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c index 7d984544efb..b8e7d98cf0e 100644 --- a/gcc/config/h8300/h8300.c +++ b/gcc/config/h8300/h8300.c @@ -1206,23 +1206,42 @@ print_operand (file, x, code) case MEM: { rtx addr = XEXP (x, 0); + int eightbit_ok = ((GET_CODE (addr) == SYMBOL_REF + && SYMBOL_REF_FLAG (addr)) + || EIGHTBIT_CONSTANT_ADDRESS_P (addr)); + int tiny_ok = ((GET_CODE (addr) == SYMBOL_REF + && TINY_DATA_NAME_P (XSTR (addr, 0))) + || TINY_CONSTANT_ADDRESS_P (addr)); fprintf (file, "@"); output_address (addr); - /* If this is an 'R' operand (reference into the 8-bit - area), then specify a symbolic address as "foo:8", - otherwise if operand is still in eight bit section, use - "foo:16". */ - if (GET_CODE (addr) == SYMBOL_REF - && SYMBOL_REF_FLAG (addr)) - fprintf (file, (code == 'R' ? ":8" : ":16")); - else if (GET_CODE (addr) == SYMBOL_REF - && TINY_DATA_NAME_P (XSTR (addr, 0))) - fprintf (file, ":16"); - else if ((code == 'R') - && EIGHTBIT_CONSTANT_ADDRESS_P (addr)) - fprintf (file, ":8"); + /* We fall back from smaller addressing to larger + addressing in various ways depending on CODE. */ + switch (code) + { + case 'R': + /* Used for mov.b and bit operations. */ + if (eightbit_ok) + { + fprintf (file, ":8"); + break; + } + + /* Fall through. We should not get here if we are + processing bit operations on H8/300 or H8/300H + because 'U' constraint does not allow bit + operations on the tiny area on these machines. */ + + case 'T': + case 'S': + /* Used for mov.w and mov.l. */ + if (tiny_ok) + fprintf (file, ":16"); + break; + default: + break; + } } break; diff --git a/gcc/config/h8300/h8300.h b/gcc/config/h8300/h8300.h index cec359cbc7d..6175d310f30 100644 --- a/gcc/config/h8300/h8300.h +++ b/gcc/config/h8300/h8300.h @@ -860,6 +860,14 @@ struct cum_arg (GET_CODE (X) == CONST_INT && TARGET_H8300H \ && 0xffff00 <= INTVAL (X) && INTVAL (X) <= 0xffffff) +/* Nonzero if X is a constant address suitable as an 16-bit absolute + on the H8/300H. */ + +#define TINY_CONSTANT_ADDRESS_P(X) \ + (GET_CODE (X) == CONST_INT && TARGET_H8300H \ + && ((0xff8000 <= INTVAL (X) && INTVAL (X) <= 0xffffff) \ + || (0x000000 <= INTVAL (X) && INTVAL (X) <= 0x007fff))) + /* 'U' if valid for a bset destination; i.e. a register, register indirect, or the eightbit memory region (a SYMBOL_REF with an SYMBOL_REF_FLAG set). |