This is the mail archive of the 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]

[PATCH,RFC] reload: X constraint doesn't match everything


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.

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 
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;

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;
	      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 ----

              case 'X':
+               force_reload = 0;
                win = 1;

Is that the correct solution?



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