[csl-arm] Thumb register class preference fix

Paul Brook paul@codesourcery.com
Fri Sep 9 16:59:00 GMT 2005


More fallout from my thumb-2 change.

Compiling the following testcase with -O2 -mthumb -fPIC:

struct re_pattern_buffer
{
  unsigned can_be_null:1;
  unsigned regs_allocated:2;
  unsigned fastmap_accurate:1;
  unsigned no_sub:1;
  unsigned not_bol:1;
  unsigned not_eol:1;
  unsigned newline_anchor:1;
};
xre_compile_pattern (struct re_pattern_buffer *bufp)
{
  bufp->newline_anchor = 1;
}

We get:

(set (reg:QI 104) (const_int -128 [0xffffffffffffff80]))

The thumb movqi pattern uses the "I" constraint, which rejects this constant, 
and forces a reload. I think this is in itself a bug, but ignore that for 
now.

Then reload calls PREFERRED_RELOAD_CLASS(..., NO_REGS). After my change this 
would force the constant into memory, causing all sorts of problems. Attached 
patch restores the original return value (LO_REGS) in this case.

Tested with cross to arm-none-eabi.
Applied to csl-arm-branch.

Paul

2005-09-09  Paul Brook  <paul@codesourcery.com>

	* config/arm/arm.h (PREFERRED_RELOAD_CLASS): Return LO_REGS for Thumb
	NO_REGS.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch
Type: text/x-diff
Size: 1163 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20050909/9df37b01/attachment.bin>


More information about the Gcc-patches mailing list