This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gcc-3.3 problem with reloading byte into address register onColdFire


>> I've stumbled across a problem with reload trying to load a byte into
>> an address register, something legal on m68k, but illegal on ColdFire:
>
>There is nothing in LIMIT_RELOAD_CLASS or PREFERRED_RELOAD_CLASS to 
>handle this.  Note that both of them handle the case where CLASS != 
>ADDR_REGS.  I.e., if we don't have ADDR_REGS, then we force it into 
>DATA_REGS because we know both DATA_REGS is OK.  And if it is ADDR_REGS 
>then we leave it alone because we know ADDR_REGS is OK.  It looks like 
>the 5200 specific movqi pattern is bogus.
>
>I'd wonder if the problem is BASE_REG_CLASS which is ADDR_REGS.  There 
>is MODE_BASE_REG_CLASS which lets you define one which is mode specific.
>
>Otherwise, maybe you need to define CANNOT_CHANGE_MODE_CLASS to prevent 
>reload from changing an ADDR_REGS/SImode reference to a ADDR_REGS/QImode 
>reference when TARGET_5200.

I've modified movqi for ColdFire to not use an 'a' constraint.
I've added:

/* ColdFire can't hold a QImode in an address register since there are
   no isntructions to move a QImode into or out of an ADDR_REG */
#define CANNOT_CHANGE_MODE_CLASS(FROM, TO, CLASS)  \
  (TARGET_COLDFIRE && ((TO) == QImode && (CLASS) == ADDR_REGS))

I've moddified PREFERRED_RELOAD_CLASS to use DATA_REGS if its a
COLDFIRE, and CLASS is ADDR_REGS:

#define PREFERRED_RELOAD_CLASS(X,CLASS)  \
  ((GET_CODE (X) == CONST_INT			\
    && (unsigned) (INTVAL (X) + 0x80) < 0x100	\
    && (CLASS) != ADDR_REGS)			\
   ? DATA_REGS					\
   : (GET_MODE (X) == QImode && (CLASS) != ADDR_REGS) \
   ? DATA_REGS					\
   : (TARGET_COLDFIRE && GET_MODE (X) == QImode && (CLASS) == ADDR_REGS) \
   ? DATA_REGS					\
   : (GET_CODE (X) == CONST_DOUBLE					\
      && GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT)			\
   ? (TARGET_68881 && (CLASS == FP_REGS || CLASS == DATA_OR_FP_REGS)	\
      ? FP_REGS : NO_REGS)						\
   : (TARGET_PCREL				\
      && (GET_CODE (X) == SYMBOL_REF || GET_CODE (X) == CONST \
	  || GET_CODE (X) == LABEL_REF))	\
   ? ADDR_REGS					\
   : (CLASS))

And even modified LIMIT_RELOAD_CLASS to *force* QImode values into a
data registers:

#define LIMIT_RELOAD_CLASS(MODE, CLASS) \
  (((MODE) == QImode && (CLASS) == ADDR_REGS)	\
   ? DATA_REGS					\
   : (CLASS))

And it still blows up building the full-up compiler:

/home/peter/work/cvs-local/xgcc/obj/m68k-elf-3.3/m68k-elf-gcc/gcc/xgcc -B/home/peter/work/cvs-local/xgcc/obj/m68k-elf-3.3/m68k-elf-gcc/gcc/ -B/tmp/m68k-elf-3.3//m68k-elf/bin/ -B/tmp/m68k-elf-3.3//m68k-elf/lib/ -isystem /tmp/m68k-elf-3.3//m68k-elf/include -c -DHAVE_CONFIG_H -O2 -g -O2  -m5200 -I. -I/home/peter/work/cvs-local/xgcc/gcc-3.3/libiberty/../include  -W -Wall -Wtraditional -pedantic /home/peter/work/cvs-local/xgcc/gcc-3.3/libiberty/regex.c -o regex.o
In file included from /home/peter/work/cvs-local/xgcc/gcc-3.3/include/xregex.h:26,
                 from /home/peter/work/cvs-local/xgcc/gcc-3.3/libiberty/regex.c:195:
/home/peter/work/cvs-local/xgcc/gcc-3.3/include/xregex2.h:551: warning: ISO C90 does not support `static' or type qualifiers in parameter array declarators
In file included from /home/peter/work/cvs-local/xgcc/gcc-3.3/libiberty/regex.c:649:
/home/peter/work/cvs-local/xgcc/gcc-3.3/libiberty/regex.c: In function `byte_regex_compile':
/home/peter/work/cvs-local/xgcc/gcc-3.3/libiberty/regex.c:2473: warning: implicit declaration of function `free'
/home/peter/work/cvs-local/xgcc/gcc-3.3/libiberty/regex.c:2534: warning: function `free' was previously declared within a block
/home/peter/work/cvs-local/xgcc/gcc-3.3/libiberty/regex.c:2567: warning: function `free' was previously declared within a block
/home/peter/work/cvs-local/xgcc/gcc-3.3/libiberty/regex.c:2674: warning: function `free' was previously declared within a block
/home/peter/work/cvs-local/xgcc/gcc-3.3/libiberty/regex.c:3677: warning: function `free' was previously declared within a block
/home/peter/work/cvs-local/xgcc/gcc-3.3/libiberty/regex.c:4184: warning: function `free' was previously declared within a block
/home/peter/work/cvs-local/xgcc/gcc-3.3/libiberty/regex.c:4255: error: insn does not satisfy its constraints:
(insn 8483 474 476 55 (nil) (set (reg/v:QI 10 %a2 [129])
        (reg:QI 0 %d0)) 37 {*m68k.md:1060} (nil)
    (nil))
/home/peter/work/cvs-local/xgcc/gcc-3.3/libiberty/regex.c:4255: internal compiler error: in reload_cse_simplify_operands, at reload1.c:8348
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
make[4]: *** [regex.o] Error 1
make[4]: Leaving directory `/home/peter/work/cvs-local/xgcc/obj/m68k-elf-3.3/m68k-elf-gcc/m68k-elf/m5200/libiberty'

Any other suggestions will be most appreciative!

-- 
Peter Barada
peter@baradas.org


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]