[PATCH] Two small optimizations in dwarf2out

Jakub Jelinek jakub@redhat.com
Sat Mar 27 00:24:00 GMT 2010


Hi!

The following patch removes an unused (only ever set) field from struct
var_loc_node and drops the decl_loc_table hash table content earlier (after
debug info for the current function is emitted, instead of at the start of
final pass for next function.
Both of these should save some memory for functions with lots of
VAR_LOCATION notes.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2010-03-26  Jakub Jelinek  <jakub@redhat.com>

	* dwarf2out.c (dwarf2_debug_hooks): Use dwarf2out_function_decl
	instead of dwarf2out_decl.
	(struct var_loc_node): Remove section_label field.
	(dwarf2out_function_decl): New function.
	(dwarf2out_var_location): Don't set section_label field.
	(dwarf2out_begin_function): Don't empty decl_loc_table here.

--- gcc/dwarf2out.c.jj	2010-03-26 22:00:32.000000000 +0100
+++ gcc/dwarf2out.c	2010-03-26 22:08:21.000000000 +0100
@@ -5410,6 +5410,7 @@ static void dwarf2out_define (unsigned i
 static void dwarf2out_undef (unsigned int, const char *);
 static void dwarf2out_start_source_file (unsigned, const char *);
 static void dwarf2out_end_source_file (unsigned);
+static void dwarf2out_function_decl (tree);
 static void dwarf2out_begin_block (unsigned, unsigned);
 static void dwarf2out_end_block (unsigned, unsigned);
 static bool dwarf2out_ignore_block (const_tree);
@@ -5447,7 +5448,7 @@ const struct gcc_debug_hooks dwarf2_debu
   dwarf2out_end_epilogue,
   dwarf2out_begin_function,
   debug_nothing_int,		/* end_function */
-  dwarf2out_decl,		/* function_decl */
+  dwarf2out_function_decl,	/* function_decl */
   dwarf2out_global_decl,
   dwarf2out_type_decl,		/* type_decl */
   dwarf2out_imported_module_or_decl,
@@ -5731,7 +5732,6 @@ DEF_VEC_ALLOC_O(die_arg_entry,gc);
 struct GTY ((chain_next ("%h.next"))) var_loc_node {
   rtx GTY (()) var_loc_note;
   const char * GTY (()) label;
-  const char * GTY (()) section_label;
   struct var_loc_node * GTY (()) next;
 };
 
@@ -19925,6 +19925,16 @@ dwarf2out_decl (tree decl)
   gen_decl_die (decl, NULL, context_die);
 }
 
+/* Write the debugging output for DECL.  */
+
+static void
+dwarf2out_function_decl (tree decl)
+{
+  dwarf2out_decl (decl);
+
+  htab_empty (decl_loc_table);
+}
+
 /* Output a marker (i.e. a label) for the beginning of the generated code for
    a lexical block.  */
 
@@ -20317,11 +20327,6 @@ dwarf2out_var_location (rtx loc_note)
       newloc->label = last_postcall_label;
     }
 
-  if (cfun && in_cold_section_p)
-    newloc->section_label = crtl->subsections.cold_section_label;
-  else
-    newloc->section_label = text_section_label;
-
   last_var_location_insn = next_real;
   last_in_cold_section_p = in_cold_section_p;
 }
@@ -20334,8 +20339,6 @@ dwarf2out_var_location (rtx loc_note)
 static void
 dwarf2out_begin_function (tree fun)
 {
-  htab_empty (decl_loc_table);
-
   if (function_section (fun) != text_section)
     have_multiple_function_sections = true;
 

	Jakub



More information about the Gcc-patches mailing list