This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Add __builtin_stack_top


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]