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]
Other format: [Raw text]

match_operator and cleanup_subreg_operands



If we have a match_operator operand in a pattern that matches PLUS, MULT 
or MEM, then any subregs within that will be cleaned up by 
walk_alter_subreg.  However, this doesn't update recog_data.operand, so we 
abort if any operand within that operator expression is a subreg 
(alter_subreg expects to be passed a subreg, but we don't).  The fix is to 
test the underlying expression directly, rather than the operand as cached 
in recog_data.

2001-12-08  Richard Earnshaw  <rearnsha@arm.com>

	* final.c (cleanup_subreg_operands):  Use recog_data.operand_loc
	in test for a subreg.


Index: final.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/final.c,v
retrieving revision 1.230
diff -p -r1.230 final.c
*** final.c	2001/12/07 12:31:06	1.230
--- final.c	2001/12/08 10:48:35
*************** cleanup_subreg_operands (insn)
*** 2726,2732 ****
    extract_insn_cached (insn);
    for (i = 0; i < recog_data.n_operands; i++)
      {
!       if (GET_CODE (recog_data.operand[i]) == SUBREG)
  	recog_data.operand[i] = alter_subreg (recog_data.operand_loc[i]);
        else if (GET_CODE (recog_data.operand[i]) == PLUS
  	       || GET_CODE (recog_data.operand[i]) == MULT
--- 2726,2737 ----
    extract_insn_cached (insn);
    for (i = 0; i < recog_data.n_operands; i++)
      {
!       /* The following test cannot use recog_data.operand when tesing
! 	 for a SUBREG: the underlying object might have been changed
! 	 already if we are inside a match_operator expression that
! 	 matches the else clause.  Instead we test the underlying
! 	 expression directly.  */
!       if (GET_CODE (*recog_data.operand_loc[i]) == SUBREG)
  	recog_data.operand[i] = alter_subreg (recog_data.operand_loc[i]);
        else if (GET_CODE (recog_data.operand[i]) == PLUS
  	       || GET_CODE (recog_data.operand[i]) == MULT

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