summaryrefslogtreecommitdiff
path: root/gcc/dwarf2out.c
diff options
context:
space:
mode:
authoraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>2007-03-07 07:18:41 +0000
committeraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>2007-03-07 07:18:41 +0000
commit17db73b6db5f122c79667cba7e14f9b190c664c3 (patch)
tree4441bb1e926b9a7914c8b7ba50680245ac7a0bf4 /gcc/dwarf2out.c
parenta0f31a09bef8b108040befdd912bea3e637b7726 (diff)
downloadgcc-17db73b6db5f122c79667cba7e14f9b190c664c3.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@122650 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/dwarf2out.c')
-rw-r--r--gcc/dwarf2out.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 029d1c207f5..476f6ebf794 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -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);