From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 113516 invoked by alias); 19 Aug 2015 12:23:46 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 113506 invoked by uid 89); 19 Aug 2015 12:23:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-oi0-f41.google.com Received: from mail-oi0-f41.google.com (HELO mail-oi0-f41.google.com) (209.85.218.41) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 19 Aug 2015 12:23:44 +0000 Received: by oiey141 with SMTP id y141so1743587oie.1 for ; Wed, 19 Aug 2015 05:23:41 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.202.208.136 with SMTP id h130mr9041675oig.74.1439987021901; Wed, 19 Aug 2015 05:23:41 -0700 (PDT) Received: by 10.76.170.36 with HTTP; Wed, 19 Aug 2015 05:23:41 -0700 (PDT) In-Reply-To: References: <9652D8E5-C3B2-4C88-BC34-4591962D42D1@comcast.net> <20150804174332.GN11083@gate.crashing.org> <20150804192913.GO11083@gate.crashing.org> <20150804204506.GP11083@gate.crashing.org> Date: Wed, 19 Aug 2015 12:29:00 -0000 Message-ID: Subject: Re: [PATCH] Add __builtin_stack_top From: "H.J. Lu" To: Segher Boessenkool Cc: Mike Stump , GCC Patches , Uros Bizjak Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2015-08/txt/msg01067.txt.bz2 On Tue, Aug 4, 2015 at 1:50 PM, H.J. Lu wrote: > On Tue, Aug 4, 2015 at 1:45 PM, Segher Boessenkool > wrote: >> On Tue, Aug 04, 2015 at 01:00:32PM -0700, H.J. Lu wrote: >>> There is another issue with x86, maybe other targets. You >>> can't get the real stack top when stack is realigned and >>> -maccumulate-outgoing-args isn't used since ix86_expand_prologue >>> will create and return another stack frame for >>> __builtin_frame_address and __builtin_return_address. >>> It will be wrong for __builtin_stack_top, which should >>> return the real stack address. >> >> That's why I asked: >> >>> >> > 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. >> >> What would a C program do with this, that it cannot do with the frame >> address, that would be useful and cannot be much better done in straight >> assembler? Do you actually want to expose the argument pointer, maybe? >> > > Yes, we want to use the argument pointer as shown in testcases > included in my patch. > Where do we stand on this? We need the hard stack address at function entry for x86 without using frame pointer. I added __builtin_stack_top since __builtin_frame_address can't give us what we want. Should __builtin_stack_top be added to middle-end or x86 backend? Thanks. -- H.J.