This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RS6000] PR 80938, Don't emit eh_frame for regs that don't need saving
On Thu, Aug 17, 2017 at 11:25:27AM +0930, Alan Modra wrote:
> On Wed, Aug 16, 2017 at 06:23:13PM -0500, Segher Boessenkool wrote:
> > Maybe whatever is creating those instructions should set RTX_FRAME_RELATED_P
> > by itself? Not sure if that is nicer.
> >
> > Both this CR2 and R0 handling are pretty nasty hacks. Could you add a
> > comment saying that?
>
> I wouldn't say the R0 handling is a nasty hack at all. You can't save
> LR directly, storing to the stack must go via a gpr. I'm 100% sure
> you know that, and so would anyone else working on powerpc gcc
> support. It so happens that we use r0 in every case we hit this
> code. *That* fact is commented. I don't really know what else you
> want.
But R0 isn't necessarily used for LR here. That is true currently in
all cases I can see, but it can be used for other things. The ABI
doesn't force things here.
The separate shrink-wrapping code does use R0 for other things, but it
manually sets the CFI notes anyway, so no problem there. Maybe I should
just stop worrying.
> (Incidentally, the dwarf2cfi.c behaviour is described by
>
> In addition, if a register has previously been saved to a different
> register,
>
> Yup, great comment that one! Dates back to 2004, commit 60ea93bb72.)
Perhaps inspired by the REG_CFA_REGISTER name for the RTL note ;-)
> The CR2 thing is a long-standing convention for frame info about CR, a
> wart fixed by ELFv2. See elsewhere
That ELFv2 fix is why I still haven't submitted the separate shrink-wrapping
for CR fields code -- it complicates things a lot :-/
> I'l go with:
>
> /* If we see CR2 then we are here on a Darwin world save. Saves of
> CR2 signify the whole CR is being saved. This is a long-standing
> ABI wart fixed by ELFv2. As for r0/lr there is no need to check
> that CR needs to be saved. */
That is fine, thanks again.
Segher