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]

Re: [PATCH], PR 50341, Fix TOC load scheduling for powerpc on GCC 4.6 and 4.7


On Thu, Sep 15, 2011 at 10:52 AM, Michael Meissner
<meissner@linux.vnet.ibm.com> wrote:
> The recent changes for the new code models tickled a latent bug in the GCC 4.6
> and 4.7 compilers with the AIX calling sequence (PR 50341). ÂWhen you call a
> function indirectly, the compiler has to save the current function's TOC
> pointer that is in r2 on the stack frame, and then load the new function's TOC
> pointer before doing the call. ÂIf the indirect function that you are calling
> has the same TOC value as the current function, the code will run, but if the
> indirection function has a different TOC (for example it is in the main
> program, and the indirect call is in a shared library), the wrong address will
> be used.
>
> The existing code did this by doing a split after reload has finished.
> Scheduling after reload then moves the load of the new TOC. ÂThese patches for
> GCC 4.6 and GCC 4.7 disable the splits so that the load of the new TOC is
> always next to the bctrl instruction, preventing the compiler from moving the
> load. ÂIdeally, we can eventually tackle the underlying problem that we did not
> have the right dependencies to prevent the scheduler from moving the new TOC
> load before the use.

ENOPATCH.

It was originally splitting before reload and I had changed it to be
splitting after reload assuming the dependencies would be correct.
What is the instruction which is being described as not dependent on
the load of r2?


-- Andrew


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