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: optimization/1945 fix


On Thursday 15 February 2001 20:57, Richard Henderson wrote:
> On Thu, Feb 15, 2001 at 05:07:19AM -0800, Shane Nay wrote:
> > +         /* We need to check to make sure that we should be
> > +            emitting shift code, because if the argument isn't
> > +            getting used, it is considered a bug to emit
> > +            preparation code for it in mips_expand_prologue.
> > +         */
>
> Ug.  I don't think you want to be scanning the entire function.
> I'd have said check "BASIC_BLOCK (0)->global_live_at_start", but
> just remembered that that isn't valid at this point.

Really I think it's right to have this evaluation of whether or not registers 
are needed in the flow_analysis because it benefits more than one platform.  
Maybe instead of REG_MAYBE_DEAD, we should have REG_DONT_KILL, and assume all 
manipulations are worthy of dumping if they aren't used unless the 
architecture specific piece notes them as REG_DONT_KILL.

> As much as I dislike the thing, I think you'll have to add a
> REG_MAYBE_UNUSED note to these shift instructions.

Alternate patch:

2001-02-16  Shane Nay  <shane@agendacomputing.com>
	* mips.c (mips_expand_prologue) Add REG_MAYBE_DEAD
	notes to structs passed by value since we don't know at that
	point whether or not we'll need the value.

Index: mips/mips.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/mips.c,v
retrieving revision 1.107
diff -u -3 -r1.107 mips.c
--- mips.c      2001/02/05 16:34:40     1.107
+++ mips.c      2001/02/16 13:43:34
@@ -7115,13 +7115,21 @@
 
       for (i = 0; i < num; i++)
        {
+         rtx insn;
          rtx pattern = RTVEC_ELT (adjust, i);
+
          if (GET_CODE (pattern) != SET
              || GET_CODE (SET_SRC (pattern)) != ASHIFT)
            abort_with_insn (pattern, "Insn is not a shift");
-
          PUT_CODE (SET_SRC (pattern), ASHIFTRT);
-         emit_insn (pattern);
+         insn=emit_insn (pattern);
+
+         /* Since we are emitting these shift instructions without
+            checking whether they are necessary, we must note
+            that they might be dead. */
+
+         REG_NOTES(insn) = gen_rtx_EXPR_LIST (REG_MAYBE_DEAD, NULL_RTX,
+                                           REG_NOTES (insn));
        }
     }
 


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