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]

[patch] Remove loop notes (5/8) -- sh.c


Hello,

there are two uses of loop notes in sh.c.  The first one is not
interesting -- it is in sh_adjust_unroll_max, that is dead and commented
out (another patch for its complete removal was proposed).  The
interesting one is in heuristics in sh_optimize_target_register_callee_saved.

The heuristics does not seem to be very useful (in fact I was not able
to get it run at all without first commenting out the previous
conditions); the patch removes it.  The patch was built and regtested in sh-sim.

In case someone is interested in replacing the heuristics later, I also
attach a patch for that; lacking the access to real hardware, I was
not able to test it properly, though, which is why I propose the more
conservative patch for now.

Zdenek

	* config/sh/sh.c (sh_optimize_target_register_callee_saved): Remove
	heuristics using loop notes.

Index: config/sh/sh.c
===================================================================
*** config/sh/sh.c	(revision 111675)
--- config/sh/sh.c	(working copy)
*************** static bool
*** 8906,8912 ****
  sh_optimize_target_register_callee_saved (bool after_prologue_epilogue_gen)
  {
    HARD_REG_SET dummy;
-   rtx insn;
  
    if (! shmedia_space_reserved_for_target_registers)
      return 0;
--- 8898,8903 ----
*************** sh_optimize_target_register_callee_saved
*** 8914,8941 ****
      return 0;
    if (calc_live_regs (&dummy) >= 6 * 8)
      return 1;
-   /* This is a borderline case.  See if we got a nested loop, or a loop
-      with a call, or with more than 4 labels inside.  */
-   for (insn = get_insns(); insn; insn = NEXT_INSN (insn))
-     {
-       if (GET_CODE (insn) == NOTE
- 	  && NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_BEG)
- 	{
- 	  int labels = 0;
- 
- 	  do
- 	    {
- 	      insn = NEXT_INSN (insn);
- 	      if ((GET_CODE (insn) == NOTE
- 		   && NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_BEG)
- 		  || GET_CODE (insn) == CALL_INSN
- 		  || (GET_CODE (insn) == CODE_LABEL && ++labels > 4))
- 		return 1;
- 	    }
- 	  while (GET_CODE (insn) != NOTE
- 		 || NOTE_LINE_NUMBER (insn) != NOTE_INSN_LOOP_END);
- 	}
-     }
    return 0;
  }
  
--- 8905,8910 ----

Attachment: diff_rem_lnotes_sh.diff
Description: Text document


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