This is the mail archive of the gcc@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]

Re: A reload inheritance bug


Bernd Schmidt wrote:
Mark Shinwell wrote:

and the code following in emit_reload_insns?  Perhaps if spill_reg_index
took account of registers selected during find_reloads then this could
be simplified too.

So what do you think is the best approach to fix all of this? :-)

Sounds like you gave the answer yourself in the first paragraph. At least that's what I'd try.

I've been experimenting with the following (which fixes the original ARM problem and doesn't appear to regress on i686-pc-linux-gnu). However I'm still not very happy with this, since I'm thinking it might be too specific to this particular situation.

Do you think it should be the case that, at the point below, _any_ reload
with reg_rtx corresponding to a hard register should have the relevant
bit set in reload_spill_index?

Mark

--


Index: src/gcc-mainline/gcc/reload1.c =================================================================== --- src/gcc-mainline/gcc/reload1.c (revision 125602) +++ src/gcc-mainline/gcc/reload1.c (working copy) @@ -5657,6 +5657,22 @@ choose_reload_regs (struct insn_chain *c && ! rld[r].secondary_p) continue;

+         /* If find_reloads chose a hard register for an input reload register
+            (which can happen for example at an input reload if the hard
+            register corresponds to an input operand that dies in the
+            instruction), ensure that we record this allocation.  */
+         if (rld[r].when_needed == RELOAD_FOR_INPUT
+             && rld[r].reg_rtx
+             && REGNO (rld[r].reg_rtx) < FIRST_PSEUDO_REGISTER)
+           {
+             reload_spill_index[r] = REGNO (rld[r].reg_rtx);
+             mark_reload_reg_in_use (j,
+                                     rld[r].opnum,
+                                     rld[r].when_needed,
+                                     rld[r].mode);
+             continue;
+          };
+
          /* If find_reloads chose to use reload_in or reload_out as a reload
             register, we don't need to chose one.  Otherwise, try even if it
             found one since we might save an insn if we find the value lying


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