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]

splitting patch



I've moved the post-reload insn splitting code to run after reload_cse has
completed.  This is both an optimiation and a bug fix.

reload_cse may simplify insns enough to allow them to be split.  Consider
a double-word load in reload which reload simplifies into a double-word
copy.  We need to split that as late as possible, but before the second
flow pass.


        * reload1.c (reload): Do not set reload_completed or split insns 
        here.  Instead...
        * toplev.c (rest_of_compilation): Set reload_completed after
        reload returns.  Split insns after reload_cse has run.

Index: reload1.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/./gcc/reload1.c,v
retrieving revision 1.106
diff -c -3 -p -r1.106 reload1.c
*** reload1.c	1998/12/01 10:53:54	1.106
--- reload1.c	1998/12/01 22:23:43
*************** reload (first, global, dumpfile)
*** 1100,1109 ****
  	}
      }
  
-   /* We've finished reloading.  This reload_completed must be set before we
-      perform instruction splitting below.  */
-   reload_completed = 1;
- 
    /* Make a pass over all the insns and delete all USEs which we inserted
       only to tag a REG_EQUAL note on them.  Remove all REG_DEAD and REG_UNUSED
       notes.  Delete all CLOBBER insns and simplify (subreg (reg)) operands.  */
--- 1100,1105 ----
*************** reload (first, global, dumpfile)
*** 1135,1158 ****
  
  	/* And simplify (subreg (reg)) if it appears as an operand.  */
  	cleanup_subreg_operands (insn);
- 
- 	/* If optimizing and we are performing instruction scheduling after
- 	   reload, then go ahead and split insns now since we are about to
- 	   recompute flow information anyway.  */
- 	if (optimize && flag_schedule_insns_after_reload)
- 	  {
- 	    rtx last;
- 
- 	    last = try_split (PATTERN (insn), insn, 1);
- 
- 	    if (last != insn)
- 	      {
- 		PUT_CODE (insn, NOTE);
- 		NOTE_SOURCE_FILE (insn) = 0;
- 		NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
- 	      }
- 	  }
- 	   
        }
  
    /* If we are doing stack checking, give a warning if this function's
--- 1131,1136 ----
Index: toplev.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/./gcc/toplev.c,v
retrieving revision 1.131
diff -c -3 -p -r1.131 toplev.c
*** toplev.c	1998/11/27 10:09:13	1.131
--- toplev.c	1998/12/01 22:23:49
*************** rest_of_compilation (decl)
*** 3968,3976 ****
--- 3968,4006 ----
    if (failure)
      goto exit_rest_of_compilation;
  
+   reload_completed = 1;
+ 
    /* Do a very simple CSE pass over just the hard registers.  */
    if (optimize > 0)
      reload_cse_regs (insns);
+ 
+   /* If optimizing and we are performing instruction scheduling after
+      reload, then go ahead and split insns now since we are about to
+      recompute flow information anyway.
+ 
+      reload_cse_regs may expose more splitting opportunities, expecially
+      for double-word operations.  */
+   if (optimize > 0 && flag_schedule_insns_after_reload)
+     {
+       rtx insn;
+ 
+       for (insn = insns; insn; insn = NEXT_INSN (insn))
+ 	{
+ 	  rtx last;
+ 
+ 	  if (GET_RTX_CLASS (GET_CODE (insn)) != 'i')
+ 	    continue;
+ 
+ 	  last = try_split (PATTERN (insn), insn, 1);
+ 
+ 	  if (last != insn)
+ 	    {
+ 	      PUT_CODE (insn, NOTE);
+ 	      NOTE_SOURCE_FILE (insn) = 0;
+ 	      NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
+ 	    }
+ 	}
+     }
  
    /* Re-create the death notes which were deleted during reload.  */
    if (optimize)



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