This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH,RFC] reload: X constraint doesn't match everything
- From: Andreas Krebbel <krebbel1 at de dot ibm dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 6 Jun 2006 17:14:28 +0200
- Subject: [PATCH,RFC] reload: X constraint doesn't match everything
Hi,
according to the gcc internals manual the "X" constraint accepts everything
even rtxs which wouldn't match general_operand. With the current code in
find_reloads paradoxical subregs of pseudos are sometimes rejected for
a "X" constraint.
e.g.
In reload.c:2986 force_reload is set to 1 if operand is a paradoxical
subreg of a pseudo.
(Whether this is the correct thing is another question. Ulrich stated
in http://gcc.gnu.org/ml/gcc-patches/2004-10/msg02342.html
that stack slots are already properly allocated in scan_paradoxical_subregs
so that it shouldn't be necessary to force a reload here.)
If the constraint is "X" the win flag is set to 1 (reload.c: 3277):
case 'X':
win = 1;
break;
With force_reload set to 1 although win is 1 as well the else branch in the
code below is entered: (reload.c:3381)
/* Record which operands fit this alternative. */
this_alternative_earlyclobber[i] = earlyclobber;
if (win && ! force_reload)
this_alternative_win[i] = 1;
else if (did_match && ! force_reload)
this_alternative_match_win[i] = 1;
else
{
int const_to_mem = 0;
...
Considering that we are dealing with a doloop like pattern and we would
need an output reload for the paradoxical subreg this alternative would be
marked as bad in (reload.c: 3427):
if (GET_CODE (operand) != SCRATCH
&& modified[i] != RELOAD_READ && no_output_reloads
&& ! find_reg_note (insn, REG_UNUSED, operand))
bad = 1;
...
Hence reload would state that it can't reload that operand in spite of the
"X" constraint.
I would like to set the "X" constraint in the S/390 doloop Pattern in order
to fix a different issue with this pattern. In case the "X" alternative is
choosen a splitter would implement doloop differently which should be fine.
I could get it working with the following small patch for reload:
*** gcc/reload.c.orig 2006-05-31 14:06:05.000000000 +0200
--- gcc/reload.c 2006-05-31 13:57:37.000000000 +0200
*************** find_reloads (rtx insn, int replace, int
*** 3313,3318 ****
--- 3313,3319 ----
break;
case 'X':
+ force_reload = 0;
win = 1;
break;
Is that the correct solution?
Bye,
-Andreas-