re PR debug/41700 (g++.dg/debug/dwarf2/icf.C)
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. From-SVN: r153719
This commit is contained in:
parent
c376dbfba1
commit
d053983838
@ -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
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
@ -96,6 +97,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)
|
||||
{
|
||||
|
@ -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. */
|
||||
|
@ -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 */
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user