On Tue, Nov 24, 2015 at 05:31:11PM +0100, Pierre-Marie de Rodat wrote: > On 11/23/2015 10:11 PM, Jason Merrill wrote: > >Jakub, since DW_TAG_GNU_call_site is your feature, could you review this? > > As Jeff Law suggested in the “GCC 6 Status Report” thread, I’ve added > Alexandre Oliva to the discussion to review the var-tracking part. > > Also, I’ve rebased+bootstrapped+regtested the patch: the updated version is > attached. > > Thanks in advance for your review!
The new pass is IMNSHO completely useless and undesirable, both for compile time (another whole IL traversal) reasons and for the unnecessary creation of memory allocations. final.c already calls dwarf2out_var_location on all calls, so you can do is just add some code there: if (CALL_P (loc_note)) { call_site_count++; if (SIBLING_CALL_P (loc_note)) tail_call_site_count++; + if (optimize == 0 && !flag_var_tracking) + { + ... + } } Detect the case you are interested in (indirect calls), set up a few vars and jump through down to the label creation (and arrange for that case to understand that the current insn is not the note, but the call itself). You'll need a small change on the final.c side, because if (!DECL_IGNORED_P (current_function_decl)) debug_hooks->var_location (insn); is called for calls before output_asm_insn, while you want to call it after them (perhaps even after the unwind emit and final_postscan_insn), so also replace if (rtx_call_insn *call_insn = dyn_cast <rtx_call_insn *> (insn)) with rtx_call_insn *call_insn = dyn_cast <rtx_call_insn *> (insn); if (call_insn) and use that condition again for the var_location call. I'd say you can just leave call_arg_loc_note NULL in that case and use for (arg = (ca_loc->call_arg_loc_note ? NOTE_VAR_LOCATION (ca_loc->call_arg_loc_note) : NULL_RTX); arg; arg = next_arg) or so, no need to add any notes. > + /* Emit a not only for calls that have a pattern that is not: s/not/note/, but I hope this code is going away. Jakub