From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31342 invoked by alias); 16 Mar 2008 00:59:07 -0000 Received: (qmail 31332 invoked by uid 22791); 16 Mar 2008 00:59:06 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sun, 16 Mar 2008 00:58:49 +0000 Received: (qmail 12953 invoked from network); 16 Mar 2008 00:58:46 -0000 Received: from unknown (HELO wren.home) (paul@127.0.0.2) by mail.codesourcery.com with ESMTPA; 16 Mar 2008 00:58:46 -0000 From: Paul Brook To: gcc-patches@gcc.gnu.org Subject: Suppress unused ARM unwinding tables Date: Sun, 16 Mar 2008 02:24:00 -0000 User-Agent: KMail/1.9.9 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200803160058.42240.paul@codesourcery.com> 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 X-SW-Source: 2008-03/txt/msg00959.txt.bz2 The ARM backend currently emits frame unwinding information for all functions. However in some cases we know we will never try and unwind through a function. In these cases we can omit the frame unwind information. This makes the tables smaller, and sometimes means we don't pull in all the unwinding library via the personality routine. Tested on arm-none-eabi. Applied to svn trunk. Paul 2008-03-15 Paul Brook gcc/ * config/arm/arm.c (arm_unwind_emit): Suppress unused unwinding annotations. (arm_output_fn_unwind): Mark functions that can not be unwound. Index: gcc/config/arm/arm.c =================================================================== --- gcc/config/arm/arm.c (revision 170267) +++ gcc/config/arm/arm.c (revision 170268) @@ -20947,6 +20947,11 @@ arm_unwind_emit (FILE * asm_out_file, rt if (!ARM_EABI_UNWIND_TABLES) return; + if (!(flag_unwind_tables || cfun->uses_eh_lsda) + && (TREE_NOTHROW (current_function_decl) + || cfun->all_throwers_are_sibcalls)) + return; + if (GET_CODE (insn) == NOTE || !RTX_FRAME_RELATED_P (insn)) return; @@ -21027,7 +21032,17 @@ arm_output_fn_unwind (FILE * f, bool pro if (prologue) fputs ("\t.fnstart\n", f); else - fputs ("\t.fnend\n", f); + { + /* If this function will never be unwound, then mark it as such. + The came condition is used in arm_unwind_emit to suppress + the frame annotations. */ + if (!(flag_unwind_tables || cfun->uses_eh_lsda) + && (TREE_NOTHROW (current_function_decl) + || cfun->all_throwers_are_sibcalls)) + fputs("\t.cantunwind\n", f); + + fputs ("\t.fnend\n", f); + } } static bool