On 14/03/13 16:11, Vladimir Makarov wrote: > On 03/14/2013 05:34 AM, Tom de Vries wrote: >> On 13/02/13 23:35, Vladimir Makarov wrote: >> > Actually, I am done with it. In general, it is ok. Although I have > some minors comments: >
Vladimir, Thanks for the review. I split the patch up into 10 patches, to facilitate further review: ... 0001-Add-command-line-option.patch 0002-Add-new-reg-note-REG_CALL_DECL.patch 0003-Add-implicit-parameter-to-find_all_hard_reg_sets.patch 0004-Add-TARGET_FN_OTHER_HARD_REG_USAGE-hook.patch 0005-Implement-TARGET_FN_OTHER_HARD_REG_USAGE-hook-for-ARM.patch 0006-Collect-register-usage-information.patch 0007-Use-collected-register-usage-information.patch 0008-Enable-by-default-at-O2-and-higher.patch 0009-Add-documentation.patch 0010-Add-test-case.patch ... I'll post these in reply to this email. > In Changelog, you missed '*" before cgraph.h: > > * haifa-sched.c (recompute_todo_spec, check_clobbered_conditions): Add > new argument to find_all_hard_reg_sets call. > cgraph.h (struct cgraph_node): Add function_used_regs, > function_used_regs_initialized and function_used_regs_valid fields. > Fixed (in the log of 0006-Collect-register-usage-information.patch). > > @@ -3391,6 +3394,7 @@ df_get_call_refs (struct df_collection_r > } > } > else if (TEST_HARD_REG_BIT (regs_invalidated_by_call, i) > > I'd remove the test of regs_invalidated_by_call. > > + && TEST_HARD_REG_BIT (fn_reg_set_usage, i) > /* no clobbers for regs that are the result of the call */ > && !TEST_HARD_REG_BIT (defs_generated, i) > Fixed (in 0007-Use-collected-register-usage-information.patch). > +static void > +collect_fn_hard_reg_usage (void) > +{ > + rtx insn; > + int i; > + struct cgraph_node *node; > + struct hard_reg_set_container other_usage; > + > + if (!flag_use_caller_save) > + return; > + > + node = cgraph_get_node (current_function_decl); > + gcc_assert (node != NULL); > + > + gcc_assert (!node->function_used_regs_initialized); > + node->function_used_regs_initialized = 1; > + > + for (insn = get_insns (); insn != NULL_RTX; insn = next_insn (insn)) > + { > + HARD_REG_SET insn_used_regs; > + > + if (!NONDEBUG_INSN_P (insn)) > + continue; > + > + find_all_hard_reg_sets (insn, &insn_used_regs, false); > + > + if (CALL_P (insn) > + && !get_call_reg_set_usage (insn, &insn_used_regs, > call_used_reg_set)) > + { > + CLEAR_HARD_REG_SET (node->function_used_regs); > + return; > + } > + > > I'd put it before find_all_hard_reg_sets > > + IOR_HARD_REG_SET (node->function_used_regs, insn_used_regs); > + } > + > > insn_used_regs is set by both find_all_hard_reg_sets, and by get_call_reg_set_usage. If we move the IOR to before find_all_hard_reg_sets, we're using an undefined value. > > But you can ignore my two last 2 comments. > > The patch is ok for me for trunk at stage1. But I think you need a > formal approval for df-scan.c, arm.c, mips.c, GCC testsuite expect files > (lib/target-supports.exp and gcc.target/mips/mips.exp) as I am not a > maintainer of these parts although these changes look ok for me. > I'm assuming you've ok'ed patch 1, 2, 3, 4, 6, 8, 9 and the non-df-scan part of 7. I'll ask other maintainers about the other parts (5, 10 and the df-scan part of 7). Thanks, - Tom