]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
dwarf2out.c (is_inlined_entry_point): New
authorAlexandre Oliva <aoliva@redhat.com>
Wed, 7 Mar 2007 07:18:41 +0000 (07:18 +0000)
committerAlexandre Oliva <aoliva@gcc.gnu.org>
Wed, 7 Mar 2007 07:18:41 +0000 (07:18 +0000)
* dwarf2out.c (is_inlined_entry_point): New
(add_high_low_attributes): Emit DW_AT_entry_pc along with
DW_AT_ranges if the first subblock is the entry point.

From-SVN: r122650

gcc/ChangeLog
gcc/dwarf2out.c

index a81c91367b2929030c52e9e5e4ae491228ca734e..236b40e1698c40b00648e69bd85fe47b160fcc72 100644 (file)
@@ -1,3 +1,9 @@
+2007-03-07  Alexandre Oliva  <aoliva@redhat.com>
+
+       * dwarf2out.c (is_inlined_entry_point): New
+       (add_high_low_attributes): Emit DW_AT_entry_pc along with
+       DW_AT_ranges if the first subblock is the entry point.
+
 2007-03-06  David Daney  <ddaney@avtrex.com>
 
        * doc/install.texi (mips-*-*): Change recommended binutils
index 029d1c207f5834c132a73ca6ca2b0a7be6c16b46..476f6ebf794c70bbdd531eae318397dc7b7214f1 100644 (file)
@@ -12233,6 +12233,36 @@ add_call_src_coords_attributes (tree stmt, dw_die_ref die)
   add_AT_unsigned (die, DW_AT_call_line, s.line);
 }
 
+
+/* If STMT's abstract origin is a function declaration and STMT's
+   first subblock's abstract origin is the function's outermost block,
+   then we're looking at the main entry point.  */
+static bool
+is_inlined_entry_point (tree stmt)
+{
+  tree decl, block;
+
+  if (!stmt || TREE_CODE (stmt) != BLOCK)
+    return false;
+
+  decl = block_ultimate_origin (stmt);
+
+  if (!decl || TREE_CODE (decl) != FUNCTION_DECL)
+    return false;
+
+  block = BLOCK_SUBBLOCKS (stmt);
+
+  if (block)
+    {
+      if (TREE_CODE (block) != BLOCK)
+       return false;
+
+      block = block_ultimate_origin (block);
+    }
+
+  return block == DECL_INITIAL (decl);
+}
+
 /* A helper function for gen_lexical_block_die and gen_inlined_subroutine_die.
    Add low_pc and high_pc attributes to the DIE for a block STMT.  */
 
@@ -12245,6 +12275,13 @@ add_high_low_attributes (tree stmt, dw_die_ref die)
     {
       tree chain;
 
+      if (is_inlined_entry_point (stmt))
+       {
+         ASM_GENERATE_INTERNAL_LABEL (label, BLOCK_BEGIN_LABEL,
+                                      BLOCK_NUMBER (stmt));
+         add_AT_lbl_id (die, DW_AT_entry_pc, label);
+       }
+
       add_AT_range_list (die, DW_AT_ranges, add_ranges (stmt));
 
       chain = BLOCK_FRAGMENT_CHAIN (stmt);