This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Suppress unused ARM unwinding tables


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  <paul@codesourcery.com>

	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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]