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: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Segher Boessenkool <segher at kernel dot crashing dot org>
- 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 15:18:46 -0700
- Subject: Re: [PATCH] Add __builtin_stack_top
- Authentication-results: sourceware.org; auth=none
- References: <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> <20150819165854 dot GB32473 at gate dot crashing dot org> <CAMe9rOqDjBKWXcA7mYXeCoktUj4Q5FRWiDq+rxKRTyZiyXRBTQ at mail dot gmail dot com> <20150819174805 dot GC32473 at gate dot crashing dot org> <CAMe9rOoOiWQGrTey+J54=JRVd0wK9p65HEj0s8F1nkx0+1qg=A at mail dot gmail dot com> <CAMe9rOqo-VSwuQNgApWKK-1saPwtX4KrHwZOB3w=nsQJv3dPjA at mail dot gmail dot com> <20150819221029 dot GB26407 at gate dot crashing dot org>
On Wed, Aug 19, 2015 at 3:10 PM, Segher Boessenkool
<segher@kernel.crashing.org> wrote:
> On Wed, Aug 19, 2015 at 02:53:47PM -0700, H.J. Lu wrote:
>> How about this
>>
>> @deftypefn {Built-in Function} {void *} __builtin_argument_pointer (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. Unlike
>> @code{__builtin_frame_address}, the frame pointer register isn't
>> required.
>
> That last line isn't true, if your port uses INITIAL_FRAME_POINTER_RTX.
> Maybe it shouldn't be true otherwise either (but currently a hard frame
> pointer is forced, indeed). Have we gone full circle now? ;-)
Let's drop it:
@deftypefn {Built-in Function} {void *} __builtin_argument_pointer (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 which would be passed on the stack.
@end deftypefn
--
H.J.