summaryrefslogtreecommitdiff
path: root/gcc/final.c
diff options
context:
space:
mode:
authorccoutant <ccoutant@138bc75d-0d04-0410-961f-82ee72b054a4>2009-10-08 21:00:04 +0000
committerccoutant <ccoutant@138bc75d-0d04-0410-961f-82ee72b054a4>2009-10-08 21:00:04 +0000
commitd907ec515e45bd1c853b50fd0f20ffa9908c5473 (patch)
treed4e268cc74aaa313626c0a3a838960f89e919d48 /gcc/final.c
parent209e5acf6b5b9ae6ad8936181d4f3d6ee448ba29 (diff)
downloadgcc-d907ec515e45bd1c853b50fd0f20ffa9908c5473.tar.gz
gcc/ChangeLog:
Add support for debugging with ICF (Identical Code Folding). * calls.c (debug.h): New #include. (emit_call_1): Call virtual_call_token debug hook. * common.opt (-fenable-icf-debug): New option. * dwarf2out.c (dwarf2_debug_hooks): Add entries for new hooks (two locations in the source). (poc_label_num): New variable. (dcall_entry, vcall_entry): New typedefs. (dcall_table, vcall_table): New variables. (struct vcall_insn): New type. (vcall_insn_table): New variable. (DEBUG_DCALL_SECTION, DEBUG_VCALL_SECTION): New macros. (size_of_dcall_table): New function. (output_dcall_table): New function. (size_of_vcall_table): New function. (output_vcall_table): New function. (dwarf2out_direct_call): New function. (vcall_insn_table_hash): New function. (vcall_insn_table_eq): New function. (dwarf2out_virtual_call_token): New function. (dwarf2out_virtual_call): New function. (dwarf2out_init): Allocate new tables and sections. (prune_unused_types): Mark DIEs referenced from direct call table. (dwarf2out_finish): Output direct and virtual call tables. * final.c (final_scan_insn): Call direct_call and virtual_call debug hooks. * debug.h (struct gcc_debug_hooks): Add direct_call, virtual_call_token, virtual_call hooks. (debug_nothing_uid): New function. * debug.c (do_nothing_debug_hooks): Add dummy entries for new hooks. (debug_nothing_uid): New function. * dbxout.c (dbx_debug_hooks): Add dummy entries for new hooks. * sdbout.c (sdb_debug_hooks): Likewise. * vmsdbgout.c (vmsdbg_debug_hooks): Likewise. * doc/invoke.texi (-fenable-icf-debug): New option. gcc/testsuite/ChangeLog: Add support for debugging with ICF (Identical Code Folding). * g++.dg/debug/dwarf2/icf.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@152577 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/final.c')
-rw-r--r--gcc/final.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/final.c b/gcc/final.c
index f121da1b5cd..b8f5e513817 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -2684,6 +2684,26 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED,
/* Output assembler code from the template. */
output_asm_insn (templ, recog_data.operand);
+ /* Record point-of-call information for ICF debugging. */
+ if (flag_enable_icf_debug && CALL_P (insn))
+ {
+ rtx x = call_from_call_insn (insn);
+ x = XEXP (x, 0);
+ if (x && MEM_P (x))
+ {
+ if (GET_CODE (XEXP (x, 0)) == SYMBOL_REF)
+ {
+ tree t;
+ x = XEXP (x, 0);
+ t = SYMBOL_REF_DECL (x);
+ if (t)
+ (*debug_hooks->direct_call) (t);
+ }
+ else
+ (*debug_hooks->virtual_call) (INSN_UID (insn));
+ }
+ }
+
/* Some target machines need to postscan each insn after
it is output. */
if (targetm.asm_out.final_postscan_insn)