From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 121707 invoked by alias); 9 Sep 2016 15:44:19 -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 121697 invoked by uid 89); 9 Sep 2016 15:44:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:2257, mechanisms X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 09 Sep 2016 15:44:18 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0DC9BC00F701; Fri, 9 Sep 2016 15:44:17 +0000 (UTC) Received: from localhost.localdomain (ovpn-116-111.phx2.redhat.com [10.3.116.111]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u89FiGaE013614; Fri, 9 Sep 2016 11:44:16 -0400 Subject: Re: [PATCH 1/9] separate shrink-wrap: New command-line flag, status flag, hooks, and doc To: Bernd Schmidt , Segher Boessenkool , gcc-patches@gcc.gnu.org References: <4b44888ff2f1237b364ccd0a566a4b739db0a032.1470015604.git.segher@kernel.crashing.org> <3a3fece4-6f3a-cb07-8083-a5f6e820c693@redhat.com> From: Jeff Law Message-ID: Date: Fri, 09 Sep 2016 15:51:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2016-09/txt/msg00512.txt.bz2 On 09/09/2016 04:58 AM, Bernd Schmidt wrote: > On 09/08/2016 07:20 PM, Jeff Law wrote: >> On 08/29/2016 03:31 AM, Bernd Schmidt wrote: >>> How do these actually know where to save/restore registers? The frame >>> pointer may have been eliminated, and SP isn't necessarily constant >>> during the function. Seems like you'd have to calculate CFA reg/offset >>> much like dwarf2out does and pass it to this hook. >> So I think the confusion here is these hooks are independent of >> placement. ie, the target independent code does something like: >> >> FOR_EACH_BB >> Build the component bitmap using the incoming edge components >> Emit the prologue components at the start of the block >> Emit the epilogue components at the end of the block >> >> >> The components handled by a particular block start are set/cleared by >> the other hooks. > > Hmm? The problem is that you can't generally emit a save/restore > independent of placement, because you may not know which offset to use > from whichever base register. But these offsets aren't necessarily > constant throughout the function. Segher explained that the algorithm > deals with this by giving up in many cases, which of course limits the > usefulness. It probably makes it unusable entirely on targets that want > to use pushes for function args. On a target with ACCUMULATE_OUTGOING_ARGS the offsets are generally going to be constant. For a target that's pushing args and not using a frame pointer, this isn't likely to work. But that's OK as those targets wouldn't define the hooks or would test for those cases within the given hooks. I can envision (but will certainly not implement) separate shrink wrapping on m68k with a frame pointer in Segher's framework. Essentially the hooks push these decisions into the target machine, which is where they belong. FUrthermore, the hooks can build a custom sequence for each insertion point. That allows (as an example) the PPC LR save/restore sequence to use r0 as an intermediate register for that case. We could use those mechanisms to ensure there's a scratch register at the insertion point for address computations on targets that need them, etc. Jeff