From patchwork Thu Mar 3 12:50:00 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georg-Johann Lay X-Patchwork-Id: 85259 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 35001B70B3 for ; Thu, 3 Mar 2011 23:50:30 +1100 (EST) Received: (qmail 772 invoked by alias); 3 Mar 2011 12:50:28 -0000 Received: (qmail 760 invoked by uid 22791); 3 Mar 2011 12:50:26 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mo-p00-ob.rzone.de (HELO mo-p00-ob.rzone.de) (81.169.146.160) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 03 Mar 2011 12:50:20 +0000 X-RZG-AUTH: :LXoWVUeid/7A29J/hMvvT2k715jHQaJercGObUOFkj18odoYNahU4Q== X-RZG-CLASS-ID: mo00 Received: from [192.168.0.22] (business-188-111-022-002.static.arcor-ip.net [188.111.22.2]) by post.strato.de (cohen mo18) (RZmta 25.5) with ESMTPA id 5053c3n23CGsGW ; Thu, 3 Mar 2011 13:50:00 +0100 (MET) Message-ID: <4D6F8E78.50209@gjlay.de> Date: Thu, 03 Mar 2011 13:50:00 +0100 From: Georg-Johann Lay User-Agent: Thunderbird 2.0.0.24 (X11/20100302) MIME-Version: 1.0 To: Denis Chertykov CC: gcc-patches@gcc.gnu.org, Anatoly Sokolov , Eric Weddington Subject: Re: [Patch, AVR]: PR42240 - Fix epilogue of naked functions References: <4D63C3D4.1080000@gjlay.de> <4D68F893.5030801@gjlay.de> In-Reply-To: X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Denis Chertykov schrieb: > 2011/2/26 Georg-Johann Lay : >> Georg-Johann Lay schrieb: >> >> http://gcc.gnu.org/ml/gcc-patches/2011-02/msg01441.html >> >>> The patch implements target hook TARGET_CANNOT_MODIFY_JUMPS_P in order >>> to inhibit post-reload bb reorder for naked functions. >>> >>> It's basically the same patch as proposed in bug data base and works >>> for the test case attached there. >>> >>> The patch works just as well for gcc-4.5.2. Should I provide a >>> seperate patch against 4.5.2 (tags/gcc_4_5_2_release) or is this patch >>> (against trunk) sufficient? >>> >>> Johann >>> >>> -- >>> >>> 2011-02-11 Georg-Johann Lay >>> >>> PR target/42240 >>> * config/avr/avr.c (avr_cannot_modify_jumps_p): New function. >>> (TARGET_CANNOT_MODIFY_JUMPS_P): Define. >>> > > Applied. > > Denis. This are backports to 4.3, 4.4, 4.5 branch, respectively (branches/gcc-4_*-branch/) I think PR42240 can be closed now Johann Index: config/avr/avr.c =================================================================== --- config/avr/avr.c (revision 170651) +++ config/avr/avr.c (working copy) @@ -73,6 +73,7 @@ static void avr_file_end (void); static bool avr_legitimate_address_p (enum machine_mode, rtx, bool); static void avr_asm_function_end_prologue (FILE *); static void avr_asm_function_begin_epilogue (FILE *); +static bool avr_cannot_modify_jumps_p (void); static rtx avr_function_value (const_tree, const_tree, bool); static void avr_insert_attributes (tree, tree *); static void avr_asm_init_sections (void); @@ -196,6 +197,9 @@ static const struct attribute_spec avr_a #undef TARGET_HELP #define TARGET_HELP avr_help +#undef TARGET_CANNOT_MODIFY_JUMPS_P +#define TARGET_CANNOT_MODIFY_JUMPS_P avr_cannot_modify_jumps_p + struct gcc_target targetm = TARGET_INITIALIZER; void @@ -991,6 +995,27 @@ avr_asm_function_begin_epilogue (FILE *f fprintf (file, "/* epilogue start */\n"); } + +/* Implement TARGET_CANNOT_MODITY_JUMPS_P */ + +static bool +avr_cannot_modify_jumps_p (void) +{ + + /* Naked Functions must not have any instructions after + their epilogue, see PR42240 */ + + if (reload_completed + && cfun->machine + && cfun->machine->is_naked) + { + return true; + } + + return false; +} + + /* Return nonzero if X (an RTX) is a legitimate memory address on the target machine for a memory operand of mode MODE. */