summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorccoutant <ccoutant@138bc75d-0d04-0410-961f-82ee72b054a4>2009-10-29 18:13:27 +0000
committerccoutant <ccoutant@138bc75d-0d04-0410-961f-82ee72b054a4>2009-10-29 18:13:27 +0000
commitb922281abe41c6d48002ac95e2fa34dab15b4572 (patch)
tree7087fae8b2855105cb47e6bdcf53fef7dda8d854
parent57bb39d9fee50cd68eba31a440501cf0777f657e (diff)
downloadgcc-b922281abe41c6d48002ac95e2fa34dab15b4572.tar.gz
gcc/ChangeLog:
PR debug/41700 * dwarf2out.c (dwarf2_debug_hooks): Add entries for new hook (two locations in the source). (store_vcall_insn): New function. (lookup_vcall_insn): New function. (dwarf2out_virtual_call_token): Use store_vcall_insn. (dwarf2out_copy_call_info): New function. (dwarf2out_virtual_call): Use lookup_vcall_insn. * emit-rtl.c (try_split): Call copy_call_info debug hook. * debug.h (struct gcc_debug_hooks): Add copy_call_info hook. * debug.c (do_nothing_debug_hooks): Add dummy entry for new hook. (debug_nothing_rtx_rtx): New dummy hook. * dbxout.c (dbx_debug_hooks): Add dummy entry for new hook. (xcoff_debug_hooks): Likewise. * sdbout.c (sdb_debug_hooks): Likewise. * vmsdbgout.c (vmsdbg_debug_hooks): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@153719 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog19
-rw-r--r--gcc/dbxout.c2
-rw-r--r--gcc/debug.c7
-rw-r--r--gcc/debug.h7
-rw-r--r--gcc/dwarf2out.c77
-rw-r--r--gcc/emit-rtl.c4
-rw-r--r--gcc/sdbout.c2
-rw-r--r--gcc/vmsdbgout.c1
8 files changed, 98 insertions, 21 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 7c6d21154d2..bc0413cb531 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,22 @@
+2009-10-29 Cary Coutant <ccoutant@google.com>
+
+ PR debug/41700
+ * dwarf2out.c (dwarf2_debug_hooks): Add entries for new hook (two
+ locations in the source).
+ (store_vcall_insn): New function.
+ (lookup_vcall_insn): New function.
+ (dwarf2out_virtual_call_token): Use store_vcall_insn.
+ (dwarf2out_copy_call_info): New function.
+ (dwarf2out_virtual_call): Use lookup_vcall_insn.
+ * emit-rtl.c (try_split): Call copy_call_info debug hook.
+ * debug.h (struct gcc_debug_hooks): Add copy_call_info hook.
+ * debug.c (do_nothing_debug_hooks): Add dummy entry for new hook.
+ (debug_nothing_rtx_rtx): New dummy hook.
+ * dbxout.c (dbx_debug_hooks): Add dummy entry for new hook.
+ (xcoff_debug_hooks): Likewise.
+ * sdbout.c (sdb_debug_hooks): Likewise.
+ * vmsdbgout.c (vmsdbg_debug_hooks): Likewise.
+
2009-10-29 David Daney <ddaney@caviumnetworks.com>
* doc/invoke.texi (mmcount-ra-address): Document new command line
diff --git a/gcc/dbxout.c b/gcc/dbxout.c
index 0bf5e3cec2e..a7bae6003f6 100644
--- a/gcc/dbxout.c
+++ b/gcc/dbxout.c
@@ -376,6 +376,7 @@ const struct gcc_debug_hooks dbx_debug_hooks =
debug_nothing_void, /* switch_text_section */
debug_nothing_tree, /* direct_call */
debug_nothing_tree_int, /* virtual_call_token */
+ debug_nothing_rtx_rtx, /* copy_call_info */
debug_nothing_uid, /* virtual_call */
debug_nothing_tree_tree, /* set_name */
0 /* start_end_main_source_file */
@@ -413,6 +414,7 @@ const struct gcc_debug_hooks xcoff_debug_hooks =
debug_nothing_void, /* switch_text_section */
debug_nothing_tree, /* direct_call */
debug_nothing_tree_int, /* virtual_call_token */
+ debug_nothing_rtx_rtx, /* copy_call_info */
debug_nothing_uid, /* virtual_call */
debug_nothing_tree_tree, /* set_name */
0 /* start_end_main_source_file */
diff --git a/gcc/debug.c b/gcc/debug.c
index c413595078b..c60a78d4708 100644
--- a/gcc/debug.c
+++ b/gcc/debug.c
@@ -53,6 +53,7 @@ const struct gcc_debug_hooks do_nothing_debug_hooks =
debug_nothing_void, /* switch_text_section */
debug_nothing_tree, /* direct_call */
debug_nothing_tree_int, /* virtual_call_token */
+ debug_nothing_rtx_rtx, /* copy_call_info */
debug_nothing_uid, /* virtual_call */
debug_nothing_tree_tree, /* set_name */
0 /* start_end_main_source_file */
@@ -97,6 +98,12 @@ debug_nothing_rtx (rtx insn ATTRIBUTE_UNUSED)
}
void
+debug_nothing_rtx_rtx (rtx insn ATTRIBUTE_UNUSED,
+ rtx new_insn ATTRIBUTE_UNUSED)
+{
+}
+
+void
debug_nothing_charstar (const char *main_filename ATTRIBUTE_UNUSED)
{
}
diff --git a/gcc/debug.h b/gcc/debug.h
index ef611d43572..079ecb623ad 100644
--- a/gcc/debug.h
+++ b/gcc/debug.h
@@ -143,6 +143,12 @@ struct gcc_debug_hooks
point. */
void (* virtual_call_token) (tree addr, int insn_uid);
+ /* Copies the OBJ_TYPE_REF_TOKEN for a virtual call from OLD_INSN to
+ NEW_INSN. Called from emit-rtl.c:try_split when a CALL_INSN is
+ split, so that the vtable slot index remains associated with the
+ new CALL_INSN. */
+ void (* copy_call_info) (rtx old_insn, rtx new_insn);
+
/* Records a virtual call given INSN_UID, which is the UID of the call
instruction. The UID is then mapped to the vtable slot index noted
during the lowering phase. Called from final_scan_insn when ICF
@@ -174,6 +180,7 @@ extern void debug_nothing_tree_int (tree, int);
extern void debug_nothing_tree_tree_tree_bool (tree, tree, tree, bool);
extern bool debug_true_const_tree (const_tree);
extern void debug_nothing_rtx (rtx);
+extern void debug_nothing_rtx_rtx (rtx, rtx);
extern void debug_nothing_uid (int);
/* Hooks for various debug formats. */
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 732b6a6694b..e5648090f9c 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -5418,6 +5418,7 @@ static void dwarf2out_abstract_function (tree);
static void dwarf2out_var_location (rtx);
static void dwarf2out_direct_call (tree);
static void dwarf2out_virtual_call_token (tree, int);
+static void dwarf2out_copy_call_info (rtx, rtx);
static void dwarf2out_virtual_call (int);
static void dwarf2out_begin_function (tree);
static void dwarf2out_set_name (tree, tree);
@@ -5457,6 +5458,7 @@ const struct gcc_debug_hooks dwarf2_debug_hooks =
dwarf2out_switch_text_section,
dwarf2out_direct_call,
dwarf2out_virtual_call_token,
+ dwarf2out_copy_call_info,
dwarf2out_virtual_call,
dwarf2out_set_name,
1 /* start_end_main_source_file */
@@ -19995,6 +19997,42 @@ vcall_insn_table_eq (const void *x, const void *y)
== ((const struct vcall_insn *) y)->insn_uid);
}
+/* Associate VTABLE_SLOT with INSN_UID in the VCALL_INSN_TABLE. */
+
+static void
+store_vcall_insn (unsigned int vtable_slot, int insn_uid)
+{
+ struct vcall_insn *item = GGC_NEW (struct vcall_insn);
+ struct vcall_insn **slot;
+
+ gcc_assert (item);
+ item->insn_uid = insn_uid;
+ item->vtable_slot = vtable_slot;
+ slot = (struct vcall_insn **)
+ htab_find_slot_with_hash (vcall_insn_table, &item,
+ (hashval_t) insn_uid, INSERT);
+ *slot = item;
+}
+
+/* Return the VTABLE_SLOT associated with INSN_UID. */
+
+static unsigned int
+lookup_vcall_insn (unsigned int insn_uid)
+{
+ struct vcall_insn item;
+ struct vcall_insn *p;
+
+ item.insn_uid = insn_uid;
+ item.vtable_slot = 0;
+ p = (struct vcall_insn *) htab_find_with_hash (vcall_insn_table,
+ (void *) &item,
+ (hashval_t) insn_uid);
+ if (p == NULL)
+ return (unsigned int) -1;
+ return p->vtable_slot;
+}
+
+
/* Called when lowering indirect calls to RTL. We make a note of INSN_UID
and the OBJ_TYPE_REF_TOKEN from ADDR. For C++ virtual calls, the token
is the vtable slot index that we will need to put in the virtual call
@@ -20007,21 +20045,23 @@ dwarf2out_virtual_call_token (tree addr, int insn_uid)
{
tree token = OBJ_TYPE_REF_TOKEN (addr);
if (TREE_CODE (token) == INTEGER_CST)
- {
- struct vcall_insn *item = GGC_NEW (struct vcall_insn);
- struct vcall_insn **slot;
-
- gcc_assert (item);
- item->insn_uid = insn_uid;
- item->vtable_slot = TREE_INT_CST_LOW (token);
- slot = (struct vcall_insn **)
- htab_find_slot_with_hash (vcall_insn_table, &item,
- (hashval_t) insn_uid, INSERT);
- *slot = item;
- }
+ store_vcall_insn (TREE_INT_CST_LOW (token), insn_uid);
}
}
+/* Called when scheduling RTL, when a CALL_INSN is split. Copies the
+ OBJ_TYPE_REF_TOKEN previously associated with OLD_INSN and associates it
+ with NEW_INSN. */
+
+static void
+dwarf2out_copy_call_info (rtx old_insn, rtx new_insn)
+{
+ unsigned int vtable_slot = lookup_vcall_insn (INSN_UID (old_insn));
+
+ if (vtable_slot != (unsigned int) -1)
+ store_vcall_insn (vtable_slot, INSN_UID (new_insn));
+}
+
/* Called by the final INSN scan whenever we see a virtual function call.
Make an entry into the virtual call table, recording the point of call
and the slot index of the vtable entry used to call the virtual member
@@ -20031,20 +20071,14 @@ dwarf2out_virtual_call_token (tree addr, int insn_uid)
static void
dwarf2out_virtual_call (int insn_uid)
{
+ unsigned int vtable_slot = lookup_vcall_insn (insn_uid);
vcall_entry e;
- struct vcall_insn item;
- struct vcall_insn *p;
- item.insn_uid = insn_uid;
- item.vtable_slot = 0;
- p = (struct vcall_insn *) htab_find_with_hash (vcall_insn_table,
- (void *) &item,
- (hashval_t) insn_uid);
- if (p == NULL)
+ if (vtable_slot == (unsigned int) -1)
return;
e.poc_label_num = poc_label_num++;
- e.vtable_slot = p->vtable_slot;
+ e.vtable_slot = vtable_slot;
VEC_safe_push (vcall_entry, gc, vcall_table, &e);
/* Drop a label at the return point to mark the point of call. */
@@ -21335,6 +21369,7 @@ const struct gcc_debug_hooks dwarf2_debug_hooks =
0, /* switch_text_section */
0, /* direct_call */
0, /* virtual_call_token */
+ 0, /* copy_call_info */
0, /* virtual_call */
0, /* set_name */
0 /* start_end_main_source_file */
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index d7600bccc26..674bcc4e4b9 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -3516,6 +3516,10 @@ try_split (rtx pat, rtx trial, int last)
p = &XEXP (*p, 1);
*p = CALL_INSN_FUNCTION_USAGE (trial);
SIBLING_CALL_P (insn) = SIBLING_CALL_P (trial);
+
+ /* Update the debug information for the CALL_INSN. */
+ if (flag_enable_icf_debug)
+ (*debug_hooks->copy_call_info) (trial, insn);
}
}
diff --git a/gcc/sdbout.c b/gcc/sdbout.c
index e7d52a63c70..7d5c820e8d0 100644
--- a/gcc/sdbout.c
+++ b/gcc/sdbout.c
@@ -340,6 +340,7 @@ const struct gcc_debug_hooks sdb_debug_hooks =
debug_nothing_void, /* switch_text_section */
debug_nothing_tree, /* direct_call */
debug_nothing_tree_int, /* virtual_call_token */
+ debug_nothing_rtx_rtx, /* copy_call_info */
debug_nothing_uid, /* virtual_call */
debug_nothing_tree_tree, /* set_name */
0 /* start_end_main_source_file */
@@ -1732,6 +1733,7 @@ const struct gcc_debug_hooks sdb_debug_hooks =
0, /* switch_text_section */
0, /* direct_call */
0, /* virtual_call_token */
+ 0, /* copy_call_info */
0, /* virtual_call */
0, /* set_name */
0 /* start_end_main_source_file */
diff --git a/gcc/vmsdbgout.c b/gcc/vmsdbgout.c
index b16e76e61c0..74285af56c6 100644
--- a/gcc/vmsdbgout.c
+++ b/gcc/vmsdbgout.c
@@ -217,6 +217,7 @@ const struct gcc_debug_hooks vmsdbg_debug_hooks
debug_nothing_void, /* switch_text_section */
debug_nothing_tree, /* direct_call */
debug_nothing_tree_int, /* virtual_call_token */
+ debug_nothing_rtx_rtx, /* copy_call_info */
debug_nothing_uid, /* virtual_call */
debug_nothing_tree_tree, /* set_name */
0 /* start_end_main_source_file */