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: Tue, 4 Aug 2015 14:29:13 -0500
- 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> <CAMe9rOq1axEMb34Zw2uudG6+5vjkiXKg7-i_8FRqMHL8DizqEw at mail dot gmail dot com>
On Tue, Aug 04, 2015 at 11:50:00AM -0700, H.J. Lu wrote:
> >> 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.
Not if you have INITIAL_FRAME_ADDRESS_RTX. I don't see why the generic code
cannot just use frame_pointer_rtx (instead of hard_frame_pointer_rtx) for
a count of 0; but making it target-specific is certainly more conservative.
You say i386 doesn't have that target macro defined currently. Yes I know;
so change that? Or change the generic code, but that is much more testing.
Segher