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]

[PATCH] Fix up .debug_macro predefines handling


Hi!

Apparently the http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=177973
changes broke .debug_macro predefines handling, which are after that
change no longer emitted into a transparent include which can be comdat
optimized, as the predefines no longer have lineno 0, but usually 1.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
ok for trunk/4.7?  E.g. on cc1plus during gcc rtl checking bootstrap
with -g3 enabled, .debug_macro section shrunk from 0x1b1954 bytes
to 0x12e90c.

2012-05-14  Jakub Jelinek  <jakub@redhat.com>

	* dwarf2out.c (dwarf2out_define, dwarf2out_undef): Treat
	lineno 1 the same as lineno 0 before first start file directive.
	(optimize_macinfo_range): Likewise.

--- gcc/dwarf2out.c.jj	2012-05-14 10:34:18.000000000 +0200
+++ gcc/dwarf2out.c	2012-05-14 16:02:02.176438300 +0200
@@ -20109,7 +20109,7 @@ dwarf2out_define (unsigned int lineno AT
       macinfo_entry e;
       /* Insert a dummy first entry to be able to optimize the whole
 	 predefined macro block using DW_MACRO_GNU_transparent_include.  */
-      if (VEC_empty (macinfo_entry, macinfo_table) && lineno == 0)
+      if (VEC_empty (macinfo_entry, macinfo_table) && lineno <= 1)
 	{
 	  e.code = 0;
 	  e.lineno = 0;
@@ -20136,7 +20136,7 @@ dwarf2out_undef (unsigned int lineno ATT
       macinfo_entry e;
       /* Insert a dummy first entry to be able to optimize the whole
 	 predefined macro block using DW_MACRO_GNU_transparent_include.  */
-      if (VEC_empty (macinfo_entry, macinfo_table) && lineno == 0)
+      if (VEC_empty (macinfo_entry, macinfo_table) && lineno <= 1)
 	{
 	  e.code = 0;
 	  e.lineno = 0;
@@ -20275,13 +20275,13 @@ optimize_macinfo_range (unsigned int idx
 
   /* Optimize only if there are at least two consecutive define/undef ops,
      and either all of them are before first DW_MACINFO_start_file
-     with lineno 0 (i.e. predefined macro block), or all of them are
+     with lineno {0,1} (i.e. predefined macro block), or all of them are
      in some included header file.  */
   if (second->code != DW_MACINFO_define && second->code != DW_MACINFO_undef)
     return 0;
   if (VEC_empty (macinfo_entry, files))
     {
-      if (first->lineno != 0 || second->lineno != 0)
+      if (first->lineno > 1 || second->lineno > 1)
 	return 0;
     }
   else if (first->lineno == 0)
@@ -20294,7 +20294,7 @@ optimize_macinfo_range (unsigned int idx
   for (i = idx; VEC_iterate (macinfo_entry, macinfo_table, i, cur); i++)
     if (cur->code != DW_MACINFO_define && cur->code != DW_MACINFO_undef)
       break;
-    else if (first->lineno == 0 && cur->lineno != 0)
+    else if (VEC_empty (macinfo_entry, files) && cur->lineno > 1)
       break;
     else
       {
@@ -20308,7 +20308,7 @@ optimize_macinfo_range (unsigned int idx
 
   /* From the containing include filename (if any) pick up just
      usable characters from its basename.  */
-  if (first->lineno == 0)
+  if (VEC_empty (macinfo_entry, files))
     base = "";
   else
     base = lbasename (VEC_last (macinfo_entry, files)->info);

	Jakub


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