This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: What is the precise definition of NOTE_INSN_FUNCTION_BEG?
- From: Segher Boessenkool <segher at kernel dot crashing dot org>
- To: Matthew Malcomson <Matthew dot Malcomson at arm dot com>
- Cc: Jeff Law <law at redhat dot com>, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>, nd <nd at arm dot com>
- Date: Fri, 3 May 2019 11:33:57 -0500
- Subject: Re: What is the precise definition of NOTE_INSN_FUNCTION_BEG?
- References: <33913d53-d40e-8148-ce85-d7da8a1489b7@arm.com> <60fb6db0-c196-c26d-cc60-360394739ea3@redhat.com> <5f67c233-65ee-862c-c91f-a51c1b71aa69@arm.com> <76fb1991-cbc4-9c9e-76ee-498c87ef30d1@redhat.com> <13711cf8-6007-ebcd-8dc7-23e0b52c6589@arm.com> <50de1d75-1542-f480-5380-8e65834017a7@redhat.com> <20190501194022.GE8599@gate.crashing.org> <320066f2-4990-7340-4829-ef959e02567e@arm.com> <20190502153340.GG8599@gate.crashing.org> <9c0c8fc8-26be-c20a-9540-4bb196b3f7d2@arm.com>
On Fri, May 03, 2019 at 09:29:11AM +0000, Matthew Malcomson wrote:
> On 02/05/19 16:33, Segher Boessenkool wrote:
> > Because other things want to use it as the place to put stack checking,
> > for example. And that cannot be after this note, but it can also not
> > be before it.
> >
>
> I figured the stack checking could be after one note (end of argument
> setup), and before the other (start of user code)?
I don't think that can work. It needs to do its thing before anything
else (that can overflow, at least) touches the stack.
> > Is there any reason the stack checking code is inserted way before the
> > prologue/epilogue are, btw?
>
> I don't know, I'm especially curious why the prologue & epilogue are
> emitted in assembly with the TARGET_ASM_FUNCTION_{EPILOGUE,PROLOGUE}
> macros instead of emitted as rtl somewhere earlier in the pipeline.
They are emitted as RTL on most targets. Some targets *also* use some
asm text output for special things, but the usual prologue code is done
as RTL.
> I'd guess the stack checking code is earlier since it would like to be
> optimised by the RTL passes.
It cannot, or *should* not, be optimised much. Hrm.
> Are you thinking there's call for a more thorough handling of the
> introduction and placement of these almost-prologue parts like
> stack-checking, non-local goto save areas and the like?
I think we should try to no longer rely on these magic notes, which only
still work by luck, or even do nbot really work anymore.
Segher