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: PATCH: if -fpic then don't consider PIC_OFFSET_TABLE_REGNUM updates dead


On Mar 15, 2001, Richard Henderson <rth@redhat.com> wrote:

> On Thu, Mar 15, 2001 at 07:29:58PM -0300, Alexandre Oliva wrote:
>> I still think marking it as MAYBE_DEAD is the right way to fix the problem.

> Certainly better than hacking flow.  If Toshi has come up
> with a case in which the last GOT reference is removed by
> flow2, then do go ahead and use MAYBE_DEAD.

I'm checking this patch in mainline and branch.

Index: gcc/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* config/sh/sh.c (sh_expand_prologue): Insns that set up the PIC
	register may be dead.

Index: gcc/config/sh/sh.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/sh/sh.c,v
retrieving revision 1.89
diff -u -p -r1.89 sh.c
--- gcc/config/sh/sh.c 2001/02/02 18:20:29 1.89
+++ gcc/config/sh/sh.c 2001/03/16 12:30:44
@@ -3987,7 +3987,23 @@ sh_expand_prologue ()
   push_regs (live_regs_mask, live_regs_mask2);
 
   if (flag_pic && regs_ever_live[PIC_OFFSET_TABLE_REGNUM])
-    emit_insn (gen_GOTaddr2picreg ());
+    {
+      rtx insn = get_last_insn ();
+      rtx last = emit_insn (gen_GOTaddr2picreg ());
+
+      /* Mark these insns as possibly dead.  Sometimes, flow2 may
+	 delete all uses of the PIC register.  In this case, let it
+	 delete the initialization too.  */
+      do
+	{
+	  insn = NEXT_INSN (insn);
+
+	  REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_MAYBE_DEAD,
+						const0_rtx,
+						REG_NOTES (insn));
+	}
+      while (insn != last);
+    }
 
   if (target_flags != save_flags)
     {

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

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