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