From patchwork Fri Oct 8 10:59:39 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Nathan Froyd X-Patchwork-Id: 67169 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 CA716B70A7 for ; Fri, 8 Oct 2010 21:59:53 +1100 (EST) Received: (qmail 23751 invoked by alias); 8 Oct 2010 10:59:50 -0000 Received: (qmail 23740 invoked by uid 22791); 8 Oct 2010 10:59:49 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 08 Oct 2010 10:59:43 +0000 Received: (qmail 31137 invoked from network); 8 Oct 2010 10:59:41 -0000 Received: from unknown (HELO codesourcery.com) (froydnj@127.0.0.2) by mail.codesourcery.com with ESMTPA; 8 Oct 2010 10:59:41 -0000 Date: Fri, 8 Oct 2010 06:59:39 -0400 From: Nathan Froyd To: gcc-patches@gcc.gnu.org Cc: nickc@redhat.com Subject: [PATCH] fix fr30 libgcc build Message-ID: <20101008105938.GM17388@nightcrawler> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) 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 Building fr30-elf currently dies in libgcc with: ../.././gcc/dp-bit.c: In function ‘__make_dp’: ../.././gcc/dp-bit.c:1566:1: internal compiler error: in cselib_record_set, at cselib.c:2009 I think this is a problem with the machine description: (define_insn "leave_func" [(set (reg:SI 15) (reg:SI 14)) (set (reg:SI 14) (mem:SI (post_inc:SI (reg:SI 15))))] "reload_completed" "leave" ) The above ICE in cselib comes from processing this insn: (insn 78 77 79 2 (parallel [ (set (reg/f:SI 15 sp) (plus:SI (reg/f:SI 20 ap) (const_int -8 [0xfffffffffffffff8]))) (set (reg/f:SI 14 fp) (mem:SI (reg/f:SI 15 sp) [0 S4 A32])) (set (reg/f:SI 15 sp) (plus:SI (reg/f:SI 15 sp) (const_int 4 [0x4]))) ]) ../.././gcc/dp-bit.c:1566 39 {leave_func} (nil)) cselib gets confused by the multiple sets of r15 in a single parallel. I have seen this sort of failure on other targets, too. This can be fixed by rewriting the pattern to avoid the multiple sets of r15, though the pattern is now slightly uglier. The patch below does this, and also adds a suitable definition of TARGET_EXCEPT_UNWIND_INFO. Tested with cross to fr30-elf. OK to commit? -Nathan * config/fr30/fr30.c (TARGET_EXCEPT_UNWIND_INFO): Define. * config/fr30/fr30.md (leave_func): Rewrite without post_inc. Index: config/fr30/fr30.md =================================================================== --- config/fr30/fr30.md (revision 165159) +++ config/fr30/fr30.md (working copy) @@ -1203,8 +1203,8 @@ (define_insn "return_from_func" ) (define_insn "leave_func" - [(set (reg:SI 15) (reg:SI 14)) - (set (reg:SI 14) (mem:SI (post_inc:SI (reg:SI 15))))] + [(set (reg:SI 15) (plus:SI (reg:SI 14) (const_int 4))) + (set (reg:SI 14) (mem:SI (minus:SI (reg:SI 15) (const_int 4))))] "reload_completed" "leave" ) Index: config/fr30/fr30.c =================================================================== --- config/fr30/fr30.c (revision 165159) +++ config/fr30/fr30.c (working copy) @@ -172,6 +172,9 @@ static void fr30_trampoline_init (rtx, t #undef TARGET_TRAMPOLINE_INIT #define TARGET_TRAMPOLINE_INIT fr30_trampoline_init +#undef TARGET_EXCEPT_UNWIND_INFO +#define TARGET_EXCEPT_UNWIND_INFO sjlj_except_unwind_info + struct gcc_target targetm = TARGET_INITIALIZER;