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 10:53:25 -0700
- Subject: Re: [PATCH] Add __builtin_stack_top
- Authentication-results: sourceware.org; auth=none
- References: <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> <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>
On Wed, Aug 19, 2015 at 10:48 AM, Segher Boessenkool
<segher@kernel.crashing.org> wrote:
> On Wed, Aug 19, 2015 at 10:08:01AM -0700, H.J. Lu wrote:
>> > 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.
>>
>> This doesn't make senses when there is no argument or arguments
>> are passed in registers.
>
> Sure, but see the weasel-words below ("The exact...")
>
>> To me, argument pointer is a virtual concept
>> and an implementation detail internal to GCC. I am not sure if another
>> compiler can implement it based on this description.
>
> The same is true for frame_address, on many machines.
Stack frame is well understood unlike argument pointer which is
pretty vague.
>> > 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.
>
>
> Segher
--
H.J.