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: INSN_CODE_NUMBER of INT_MAX


>     So sensible way is probably to modify combine to first try match, then
>     do the INT_MAX bypass and make delete_noop_move to blast INT_MAX insns
>     with notes and keep other noops lurking around...
> 
> Yes, that sounds precisely correct to me.
I am just testing following patch (previous version has passed i686
bootstrap/regtesting, I made some cleanups then).

OK if it passes?

Fri Jul 27 17:12:35 CEST 2001  Jan Hubicka  <jh@suse.cz>

	Suggested by Richard Henderson and Richard Kenner:
	* combine.c (recog_for_combine): Use the fake recog
	only if instruction does not match.
	* rtl.h (NOOP_MOVE_INSN_CODE): New.
	* rtlanal.c (noop_move_p): Always return 1 for NOOP_MOVE_INSN_CODE.

Index: combine.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/combine.c,v
retrieving revision 1.221
diff -c -3 -p -r1.221 combine.c
*** combine.c	2001/07/24 21:39:19	1.221
--- combine.c	2001/07/27 15:08:47
*************** recog_for_combine (pnewpat, insn, pnotes
*** 9600,9611 ****
    old_notes = REG_NOTES (insn);
    REG_NOTES (insn) = 0;
  
!   /* Is the result of combination a valid instruction?
!      Recognize all noop sets, these will be killed by followup pass.  */
!   if (GET_CODE (pat) == SET && set_noop_p (pat))
!     insn_code_number = INT_MAX;
!   else
!     insn_code_number = recog (pat, insn, &num_clobbers_to_add);
  
    /* If it isn't, there is the possibility that we previously had an insn
       that clobbered some register as a side effect, but the combined
--- 9600,9606 ----
    old_notes = REG_NOTES (insn);
    REG_NOTES (insn) = 0;
  
!   insn_code_number = recog (pat, insn, &num_clobbers_to_add);
  
    /* If it isn't, there is the possibility that we previously had an insn
       that clobbered some register as a side effect, but the combined
*************** recog_for_combine (pnewpat, insn, pnotes
*** 9630,9641 ****
        if (pos == 1)
  	pat = XVECEXP (pat, 0, 0);
  
!       /* Recognize all noop sets, these will be killed by followup pass.  */
!       if (GET_CODE (pat) == SET && set_noop_p (pat))
! 	insn_code_number = INT_MAX;
!       else
!         insn_code_number = recog (pat, insn, &num_clobbers_to_add);
      }
  
    REG_NOTES (insn) = old_notes;
  
--- 9625,9636 ----
        if (pos == 1)
  	pat = XVECEXP (pat, 0, 0);
  
!       insn_code_number = recog (pat, insn, &num_clobbers_to_add);
      }
+ 
+   /* Recognize all noop sets, these will be killed by followup pass.  */
+   if (insn_code_number < 0 && GET_CODE (pat) == SET && set_noop_p (pat))
+     insn_code_number = NOOP_MOVE_INSN_CODE, num_clobbers_to_add = 0;
  
    REG_NOTES (insn) = old_notes;
  
Index: rtl.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/rtl.h,v
retrieving revision 1.280
diff -c -3 -p -r1.280 rtl.h
*** rtl.h	2001/07/26 23:47:15	1.280
--- rtl.h	2001/07/27 15:08:48
*************** struct function;
*** 35,40 ****
--- 35,44 ----
  union tree_node;
  #endif
  
+ /* Value used by some passes to "recognize" noop moves as valid instructions.
+  */
+ #define NOOP_MOVE_INSN_CODE	INT_MAX
+ 
  /* Register Transfer Language EXPRESSIONS CODES */
  
  #define RTX_CODE	enum rtx_code
Index: rtlanal.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/rtlanal.c,v
retrieving revision 1.102
diff -c -3 -p -r1.102 rtlanal.c
*** rtlanal.c	2001/07/23 14:08:12	1.102
--- rtlanal.c	2001/07/27 15:08:48
*************** noop_move_p (insn)
*** 1030,1035 ****
--- 1030,1038 ----
  {
    rtx pat = PATTERN (insn);
  
+   if (INSN_CODE (insn) == NOOP_MOVE_INSN_CODE)
+     return 1;
+ 
    /* Insns carrying these notes are useful later on.  */
    if (find_reg_note (insn, REG_EQUAL, NULL_RTX))
      return 0;


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