This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: gcc 3.4.0 m68k-elf generates illegal code for ColdFire (maybea fix)
- From: Bernardo Innocenti <bernie at develer dot com>
- To: peter at lasergraph-dsp dot de
- Cc: gcc at gcc dot gnu dot org, Peter Barada <peter at baradas dot org>
- Date: Tue, 01 Jun 2004 16:12:12 +0200
- Subject: Re: gcc 3.4.0 m68k-elf generates illegal code for ColdFire (maybea fix)
- Organization: Develer S.r.l.
- References: <E1BTLiH-00086h-00@mrelay01.kundenservices.net>
peter@lasergraph-dsp.de wrote:
Dear gcc gurus,
since no one wants to handle the old illegal code generation issue (it
seems it existed since 2002), I tried to find it myself. I might have
found it:
In reload.c (find_reloads) a force reload needs IMHO to be forced not
only for memory operands, but also for pseudo registers, which also
reside in memory.
Can someone with deeper understanding of gcc verify that this assumption
is correct and does not break any other code?
I'm not qualified to review your patch, sorry. I could run
regression tests for your patch. Is there a PR already on file?
Here is a patch:
-------------------------------------------------------------------------------
2004-05-27 Peter Jakubek <peter@laseranimation.com>
* reload.c (find_reloads): force reload for pseudo registers on big
endian machines.
diff -ru gcc.orig/gcc/reload.c gcc/gcc/reload.c
--- gcc.orig/gcc/reload.c 2004-03-10 02:51:01.000000000 +0100
+++ gcc/gcc/reload.c 2004-05-27 13:07:32.828125000 +0200
@@ -2947,7 +2947,7 @@
< BIGGEST_ALIGNMENT)
&& (GET_MODE_SIZE (operand_mode[i])
> GET_MODE_SIZE (GET_MODE (operand))))
- || (GET_CODE (operand) == MEM && BYTES_BIG_ENDIAN)
+ || (BYTES_BIG_ENDIAN)
#ifdef LOAD_EXTEND_OP
|| (GET_MODE_SIZE (operand_mode[i]) <= UNITS_PER_WORD
&& (GET_MODE_SIZE (GET_MODE (operand))
By removing the "GET_CODE (operand) == MEM" check
you're maybe underspecifying the condition. The operand
may also be an immediate or a hard register.
Maybe this?
|| BYTES_BIG_ENDIAN
&& (GET_CODE (operand) == MEM)
|| (GET_CODE(operand) == REG
&& REGNO(operand) >= FIRST_PSEUDO_REGISTER))
I also added my original patch for m68k_output_mi_thunk to fix the invalid
code that was genrated on ColdFire for thunks:
2004-05-27 Peter Jakubek <peter@laseranimation.com>
* config/m68k/m68k.c (m68k_output_mi_thunk): correct code generated
for ColdFire.
A slightly different version of this patch just went in CVS today.
It was credited to Peter Barada, but now I wonder wether you've
both developed the same patch independently or I should add your
name in the ChangeLog entry.
--
// Bernardo Innocenti - Develer S.r.l., R&D dept.
\X/ http://www.develer.com/