dwarf2out.c (size_of_locs): Don't fill dw_loc_addr if there are no branches.
authorGeoffrey Keating <geoffk@apple.com>
Wed, 26 Apr 2006 06:57:01 +0000 (06:57 +0000)
committerGeoffrey Keating <geoffk@gcc.gnu.org>
Wed, 26 Apr 2006 06:57:01 +0000 (06:57 +0000)
* dwarf2out.c (size_of_locs): Don't fill dw_loc_addr if there
are no branches.

From-SVN: r113267

gcc/ChangeLog
gcc/dwarf2out.c

index 7bf04eff71a91823d70bd49a247708b104e38baf..3600d043a98dfb56d7b34d1fbee8105cdf963b4c 100644 (file)
@@ -20,6 +20,9 @@
 
 2006-04-25  Geoffrey Keating  <geoffk@apple.com>
 
+       * dwarf2out.c (size_of_locs): Don't fill dw_loc_addr if there
+       are no branches.
+
        * dwarf2asm.c (dw2_asm_output_data): Don't generate RTL just
        to print an integer.
 
index 39a8c5c249606500b1b563cc695ddb9fcdd2625e..4ef7d029b6f58849646c7224689abc6ca75a5b27 100644 (file)
@@ -3228,12 +3228,24 @@ size_of_loc_descr (dw_loc_descr_ref loc)
 static unsigned long
 size_of_locs (dw_loc_descr_ref loc)
 {
+  dw_loc_descr_ref l;
   unsigned long size;
 
-  for (size = 0; loc != NULL; loc = loc->dw_loc_next)
+  /* If there are no skip or bra opcodes, don't fill in the dw_loc_addr
+     field, to avoid writing to a PCH file.  */
+  for (size = 0, l = loc; l != NULL; l = l->dw_loc_next)
     {
-      loc->dw_loc_addr = size;
-      size += size_of_loc_descr (loc);
+      if (l->dw_loc_opc == DW_OP_skip || l->dw_loc_opc == DW_OP_bra)
+       break;
+      size += size_of_loc_descr (l);
+    }
+  if (! l)
+    return size;
+
+  for (size = 0, l = loc; l != NULL; l = l->dw_loc_next)
+    {
+      l->dw_loc_addr = size;
+      size += size_of_loc_descr (l);
     }
 
   return size;