This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Add __builtin_stack_top
- From: Segher Boessenkool <segher at kernel dot crashing dot org>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: Mike Stump <mikestump at comcast dot net>, GCC Patches <gcc-patches at gcc dot gnu dot org>, Uros Bizjak <ubizjak at gmail dot com>
- Date: Wed, 19 Aug 2015 11:58:54 -0500
- Subject: Re: [PATCH] Add __builtin_stack_top
- Authentication-results: sourceware.org; auth=none
- References: <20150804174332 dot GN11083 at gate dot crashing dot org> <CAMe9rOq1axEMb34Zw2uudG6+5vjkiXKg7-i_8FRqMHL8DizqEw at mail dot gmail dot com> <20150804192913 dot GO11083 at gate dot crashing dot org> <CAMe9rOrrtDZxS2E3pD5DsUYox7ze1un0m8+LJ0Eo79BBLOsZgQ at mail dot gmail dot com> <20150804204506 dot GP11083 at gate dot crashing dot org> <CAMe9rOoMzgkguZ+zY24Jytpr9HnoXvu5BUP3c7K-34Gmm2SDLg at mail dot gmail dot com> <CAMe9rOrHUnJJx68qKUe0gsVVwYXNALmCR6-4UVV_V3df4KO3_A at mail dot gmail dot com> <20150819125145 dot GC8652 at gate dot crashing dot org> <CAMe9rOrymZ3N_2HTd87C-LfoHYeZ_P7myMCL9ZvikE+uU19eRg at mail dot gmail dot com> <CAMe9rOqLxX3h_Pn2Rn1Ph-FH41e1DfEG1qPheDLBNdycPa=sNw at mail dot gmail dot com>
On Wed, Aug 19, 2015 at 08:25:49AM -0700, H.J. Lu wrote:
> Here is a patch to add __builtin_argument_pointer. I only have
Sorry to be a pain but... all the other builtins use _address
instead of _pointer, it's probably best to follow that.
> -- Built-in Function: void * __builtin_argument_pointer (void)
> This function returns the argument pointer.
>
> as documentation. Can you suggest a better description so that it can
> be implemented also by other compilers?
Maybe something like (heavily cut'n'pasted):
@deftypefn {Built-in Function} {void *} __builtin_argument_address (void)
This function is similar to @code{__builtin_frame_address} with an
argument of 0, but it returns the address of the incoming arguments to
the current function rather than the address of its frame.
The exact definition of this address depends upon the processor and the
calling convention. Usually some arguments are passed in registers and
the rest on the stack, and this builtin returns the address of the first
argument that is on the stack.
> + /* Can't use DRAP if the stack address has been taken. */
> + if (cfun->argument_pointer_taken)
> + sorry ("%<__builtin_argument_pointer%> not supported with stack"
> + " realignment. This may be worked around by adding"
> + " -maccumulate-outgoing-args.");
This doesn't work with DRAP? Pity :-(
The patch looks plausible, but I of course can not approve it.
Thanks,
Segher