[PATCH] Fix powerpc64-linux -mminimal-toc shrink-wrapping bootstrap failure (PR bootstrap/51872)
David Edelsohn
dje.gcc@gmail.com
Tue Jan 17 14:46:00 GMT 2012
On Tue, Jan 17, 2012 at 5:16 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> crtbegin.o is miscompiled on powerpc64-linux with -mminimal-toc (and likely
> many other sources). The problem is that when flag_pic is 0, the
> shrink-wrapping code doesn't consider register r30 being set up by the
> prologue, so instructions that use r30 (TOC_REGISTER) can be considered
> usable even without an earlier prologue that computes it.
> Unfortunately the generic code adds just a couple of selected registers
> to set_up_by_prologue regset, and I don't see without a target hook a way
> to add further registers to the hard regset.
>
> So, this patch implements such a hook and uses it on rs6000 to indicate that
> r30 is computed by the prologue if the prologue does that.
>
> Bootstrapped/regtested on powerpc64-linux (with -mminimal-toc in
> CFLAGS/CXXFLAGS/etc., which previously failed to bootstrap) and on
> x86_64-linux and i686-linux. Ok for trunk?
>
> 2012-01-17 Jakub Jelinek <jakub@redhat.com>
>
> PR bootstrap/51872
> * hard-reg-set.h (struct hard_reg_set_container): New type.
> * target.h (struct hard_reg_set_container): Forward declare.
> * target.def (set_up_by_prologue): New target hook.
> * doc/tm.texi (TARGET_SET_UP_BY_PROLOGUE): Document it.
> * function.c (thread_prologue_and_epilogue_insns): Change
> set_up_by_prologue HARD_REG_SET into struct hard_reg_set_container.
> Call targetm.set_up_by_prologue on it.
> * config/rs6000/rs6000.c (rs6000_set_up_by_prologue): New function.
> (TARGET_SET_UP_BY_PROLOGUE): Redefine to it.
The rs6000 bits are okay with me.
Thanks, David
More information about the Gcc-patches
mailing list