This is the mail archive of the
mailing list for the GCC project.
[patch] h8300.c: Optimize code in the normal mode.
- From: Kazu Hirata <kazu at cs dot umass dot edu>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 26 Jan 2004 21:59:38 -0500 (EST)
- Subject: [patch] h8300.c: Optimize code in the normal mode.
Attached is a patch to optimize code in the normal mode.
Currently, GCC overestimates the length of the instruction
as 8 bytes in the normal mode even though it actually only takes 6
bytes. This is because GCC thinks that @_g is a 32-bit address, but
in the normal mode, every address is 16-bit wide.
The patch catches the above case as well as a constant address with a
displacement like @(_g+4), resulting in tighter length calculation.
Tested on h8300-hms. Committed.
2004-01-26 Kazu Hirata <email@example.com>
* config/h8300/h8300.c (h8300_tiny_constant_address_p): Accept
constant addresses in the normal mode.
RCS file: /cvs/gcc/gcc/gcc/config/h8300/h8300.c,v
retrieving revision 1.265
diff -u -r1.265 h8300.c
--- h8300.c 26 Jan 2004 20:21:11 -0000 1.265
+++ h8300.c 26 Jan 2004 20:29:05 -0000
@@ -4437,8 +4437,11 @@
switch (GET_CODE (x))
- /* We accept symbols declared with tiny_data. */
- return (SYMBOL_REF_FLAGS (x) & SYMBOL_FLAG_TINY_DATA) != 0;
+ /* In the normal mode, any symbol fits in the 16-bit absolute
+ address range. We also accept symbols declared with
+ tiny_data. */
+ return (TARGET_NORMAL_MODE
+ || (SYMBOL_REF_FLAGS (x) & SYMBOL_FLAG_TINY_DATA) != 0);
addr = INTVAL (x);
@@ -4447,6 +4450,9 @@
&& (IN_RANGE (addr, h1, h2) || IN_RANGE (addr, h3, h4)))
&& (IN_RANGE (addr, s1, s2) || IN_RANGE (addr, s3, s4))));
+ case CONST:
+ return TARGET_NORMAL_MODE;