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: Tue, 4 Aug 2015 11:50:00 -0700
- Subject: Re: [PATCH] Add __builtin_stack_top
- Authentication-results: sourceware.org; auth=none
- References: <CAMe9rOofnngGMTLWCe0fpXe56Y-psu8Ay7xujtBsBnKo9XyVJQ at mail dot gmail dot com> <C6ACFA8C-8ABF-47E7-9739-5298B87A0E7A at comcast dot net> <CAMe9rOro4BPFkG=qyBu6XYcfzc3YNqVqxKPrpC5dSxrtngxQTw at mail dot gmail dot com> <9652D8E5-C3B2-4C88-BC34-4591962D42D1 at comcast dot net> <CAMe9rOqKEJjTzP1jmzZ1tnZm9a1TXKSsUfnfw4OexNFNxfVPog at mail dot gmail dot com> <20150804174332 dot GN11083 at gate dot crashing dot org>
On Tue, Aug 4, 2015 at 10:43 AM, Segher Boessenkool
<segher@kernel.crashing.org> wrote:
> On Tue, Aug 04, 2015 at 10:28:00AM -0700, H.J. Lu wrote:
>> >> Any comments on my middle-end patch?
>> >
>> > So, if the answer is the same as frame_address (0), why not have the fallback just expand to that? Then, one can use this builtin everywhere that frame address is used today. People that want a faster, tighter port can then implement the hook and achieve higher performance.
>>
>> The motivation of __builtin_stack_top is that frame_address requires a
>> frame pointer register, which isn't desirable for x86. __builtin_stack_top
>> doesn't require a frame pointer register.
>
> If the target just returns frame_pointer_rtx from INITIAL_FRAME_ADDRESS_RTX,
> you don't get crtl->accesses_prior_frames set either, and as far as I can
> see everything works fine? For __builtin_frame_address(0).
>
> You might have a reason why you want the entry stack address instead of the
> frame address, but you didn't really explain I think? Or I missed it.
>
expand_builtin_return_addr sets
crtl->accesses_prior_frames = 1;
for __builtin_frame_address, which requires a frame pointer register.
__builtin_stack_top doesn't set crtl->accesses_prior_frames and frame
pointer register isn't required.
--
H.J.