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

Re: reload and earlyclobber operands


> This morning I got bitten by the bug described in 
> <http://egcs.cygnus.com/ml/gcc-bugs/1999-06/msg00853.html>, which spurred me 
> into trying to do something about it.

I've stripped down that test case a bit; a smaller version is appended.

> Here's a patch I cooked up to address this issue.

Could you try whether the patch below fixes your problem as well?  I believe
the problem is that we first decide to use the inherited register for the
RELOAD_OTHER reload whose output is earlyclobbered, and then return 1 in
reload_reg_free_for_value_p for the other reload (type RELOAD_INPUT).

Bernd
        
template<class type> class   QArrayT 
{
    type * t;
public:
    QArrayT( int size )  {}
    type& at( unsigned int i ) const
	{ return *t; }
};
typedef QArrayT <int>		TicTacArray;
class TicTacGameBoard 
{
public:
    TicTacGameBoard( int n );
   ~TicTacGameBoard();
    enum	State { Init, HumansTurn, HumanWon, ComputerWon, NobodyWon };
    State	st;
    int		nBoard;
    TicTacArray *btArray;
};

TicTacGameBoard::TicTacGameBoard( int n )
{
    st = Init;
    nBoard = n;
    n *= n;
    btArray = new TicTacArray(n);
    for ( int i=0; i<n; i++ ) {
	btArray->at(i) = 3;
    }
}

	* reload1.c (reload_reg_free_for_value_p):  RELOAD_OTHER reloads with
	an earlyclobbered output conflict with RELOAD_INPUT reloads.

Index: reload1.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/reload1.c,v
retrieving revision 1.147
diff -u -p -r1.147 reload1.c
--- reload1.c	1999/07/08 10:07:30	1.147
+++ reload1.c	1999/07/27 14:00:09
@@ -5281,7 +5281,7 @@ reload_reg_free_for_value_p (regno, opnu
 	  if (! reload_in[i] || ! rtx_equal_p (reload_in[i], value)
 	      || reload_out[i] || out)
 	    {
-	      int time2;
+	      int j, time2;
 	      switch (reload_when_needed[i])
 		{
 		case RELOAD_FOR_OTHER_ADDRESS:
@@ -5360,6 +5360,11 @@ reload_reg_free_for_value_p (regno, opnu
 		  if (! reload_in[i] || rtx_equal_p (reload_in[i], value))
 		    {
 		      time2 = MAX_RECOG_OPERANDS * 4 + 4;
+		      /* Earlyclobbered outputs must conflict with inputs.  */
+		      for (j = 0; j < n_earlyclobbers; j++)
+			if (reload_out[i] == reload_earlyclobbers[j])
+			  time2 = MAX_RECOG_OPERANDS * 4 + 3;
+			  
 		      break;
 		    }
 		  time2 = 1;


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