Joseph - thanks for looking through the jit diff. I plan to fix the issues you raise as a series of separate patches.
Here's the first: On Tue, 2014-09-23 at 23:27 +0000, Joseph S. Myers wrote: > Various *_finalize functions are missing comments explaining their > semantics. Also the return type should be on the line before the function > name. I've committed the following fix to branch dmalcolm/jit: Five of the *_c_finalize functions were empty, since their files contain no state [1][2]. Delete them. Fix up the formatting of the remaining *_c_finalize functions, and ensure they have descriptive leading comments. [1] Most of these lost their state when the symbol_table class was introduced, in r214422. [2] predict.c has state in the form of these variables: static sreal real_zero, real_one, real_almost_one, real_br_prob_base, real_inv_br_prob_base, real_one_half, real_bb_freq_max; and, within function estimate_bb_frequencies: static int real_values_initialized = 0; but it seems to me that this state doesn't need to be reset between repeated in-process invocations. gcc/ChangeLog.jit: * cgraph.h (cgraphbuild_c_finalize): Delete prototype of empty function. (ipa_c_finalize): Likewise. (predict_c_finalize): Likewise. (symtab_c_finalize): Likewise. (varpool_c_finalize): Likewise. * cgraph.c (cgraph_c_finalize): Add leading comment. Put return type on line before function name. * cgraphunit.c (cgraphunit_c_finalize): Likewise. * dwarf2out.c (dwarf2out_c_finalize): Likewise. * gcse.c (gcse_c_finalize): Likewise. * ipa-cp.c (ipa_cp_c_finalize): Likewise. * ipa-reference.c (ipa_reference_c_finalize): Likewise. * params.c (params_c_finalize): Update leading comment to match format of the others mentioned above. * cgraphbuild.c (cgraphbuild_c_finalize): Delete empty function. * ipa.c (ipa_c_finalize): Likewise. * predict.c (predict_c_finalize): Likewise. * symtab.c (symtab_c_finalize): Likewise. * varpool.c (varpool_c_finalize): Likewise. * toplev.c (toplev::finalize): Remove calls to empty functions cgraphbuild_c_finalize, ipa_c_finalize, predict_c_finalize, symtab_c_finalize, varpool_c_finalize. --- gcc/cgraph.c | 6 +++++- gcc/cgraph.h | 9 --------- gcc/cgraphbuild.c | 4 ---- gcc/cgraphunit.c | 6 +++++- gcc/dwarf2out.c | 6 +++++- gcc/gcse.c | 6 +++++- gcc/ipa-cp.c | 3 +++ gcc/ipa-reference.c | 6 +++++- gcc/ipa.c | 4 ---- gcc/params.c | 3 ++- gcc/predict.c | 4 ---- gcc/symtab.c | 4 ---- gcc/toplev.c | 5 ----- gcc/varpool.c | 4 ---- 14 files changed, 30 insertions(+), 40 deletions(-) diff --git a/gcc/cgraph.c b/gcc/cgraph.c index 736dd73..1721634 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -3078,7 +3078,11 @@ gimple_check_call_matching_types (gimple call_stmt, tree callee, return true; } -void cgraph_c_finalize (void) +/* Reset all state within cgraph.c so that we can rerun the compiler + within the same process. For use by toplev::finalize. */ + +void +cgraph_c_finalize (void) { symtab = NULL; diff --git a/gcc/cgraph.h b/gcc/cgraph.h index c407a3b..fd45e01 100644 --- a/gcc/cgraph.h +++ b/gcc/cgraph.h @@ -1958,25 +1958,16 @@ void tree_function_versioning (tree, tree, vec<ipa_replace_map *, va_gc> *, /* In cgraphbuild.c */ int compute_call_stmt_bb_frequency (tree, basic_block bb); void record_references_in_initializer (tree, bool); -void cgraphbuild_c_finalize (void); /* In ipa.c */ void cgraph_build_static_cdtor (char which, tree body, int priority); void ipa_discover_readonly_nonaddressable_vars (void); -void ipa_c_finalize (void); /* In ipa-cp.c */ void ipa_cp_c_finalize (void); -/* In predict.c */ -void predict_c_finalize (void); - -/* In symtab.c */ -void symtab_c_finalize (void); - /* In varpool.c */ tree ctor_for_folding (tree); -void varpool_c_finalize (void); /* Return true when the symbol is real symbol, i.e. it is not inline clone or abstract function kept for debug info purposes only. */ diff --git a/gcc/cgraphbuild.c b/gcc/cgraphbuild.c index 5610064..96d7015 100644 --- a/gcc/cgraphbuild.c +++ b/gcc/cgraphbuild.c @@ -576,7 +576,3 @@ make_pass_remove_cgraph_callee_edges (gcc::context *ctxt) { return new pass_remove_cgraph_callee_edges (ctxt); } - -void cgraphbuild_c_finalize (void) -{ -} diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index 1f52d35..9a3834a 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -2288,7 +2288,11 @@ symbol_table::finalize_compilation_unit (void) timevar_pop (TV_CGRAPH); } -void cgraphunit_c_finalize (void) +/* Reset all state within cgraphunit.c so that we can rerun the compiler + within the same process. For use by toplev::finalize. */ + +void +cgraphunit_c_finalize (void) { gcc_assert (cgraph_new_nodes.length () == 0); cgraph_new_nodes.truncate (0); diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 5dd7188..6617119 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -24566,7 +24566,11 @@ dwarf2out_finish (const char *filename) output_indirect_strings (); } -void dwarf2out_c_finalize (void) +/* Reset all state within dwarf2out.c so that we can rerun the compiler + within the same process. For use by toplev::finalize. */ + +void +dwarf2out_c_finalize (void) { last_var_location_insn = NULL; cached_next_real_insn = NULL; diff --git a/gcc/gcse.c b/gcc/gcse.c index 085b1f6..3a59066 100644 --- a/gcc/gcse.c +++ b/gcc/gcse.c @@ -4288,7 +4288,11 @@ make_pass_rtl_hoist (gcc::context *ctxt) return new pass_rtl_hoist (ctxt); } -void gcse_c_finalize (void) +/* Reset all state within gcse.c so that we can rerun the compiler + within the same process. For use by toplev::finalize. */ + +void +gcse_c_finalize (void) { test_insn = NULL; } diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c index 33a46f2..163ed4b 100644 --- a/gcc/ipa-cp.c +++ b/gcc/ipa-cp.c @@ -3829,6 +3829,9 @@ make_pass_ipa_cp (gcc::context *ctxt) return new pass_ipa_cp (ctxt); } +/* Reset all state within ipa-cp.c so that we can rerun the compiler + within the same process. For use by toplev::finalize. */ + void ipa_cp_c_finalize (void) { diff --git a/gcc/ipa-reference.c b/gcc/ipa-reference.c index 39f6cb0..f3af47a 100644 --- a/gcc/ipa-reference.c +++ b/gcc/ipa-reference.c @@ -1174,7 +1174,11 @@ make_pass_ipa_reference (gcc::context *ctxt) return new pass_ipa_reference (ctxt); } -void ipa_reference_c_finalize (void) +/* Reset all state within ipa-reference.c so that we can rerun the compiler + within the same process. For use by toplev::finalize. */ + +void +ipa_reference_c_finalize (void) { ipa_init_p = false; } diff --git a/gcc/ipa.c b/gcc/ipa.c index f10e7bd..5afacd8 100644 --- a/gcc/ipa.c +++ b/gcc/ipa.c @@ -1090,10 +1090,6 @@ make_pass_ipa_cdtor_merge (gcc::context *ctxt) return new pass_ipa_cdtor_merge (ctxt); } -void ipa_c_finalize (void) -{ -} - /* Invalid pointer representing BOTTOM for single user dataflow. */ #define BOTTOM ((cgraph_node *)(size_t) 2) diff --git a/gcc/params.c b/gcc/params.c index 2b72c58..7aa96e2 100644 --- a/gcc/params.c +++ b/gcc/params.c @@ -84,7 +84,8 @@ finish_params (void) params_finished = true; } -/* Reset all state in params.c. */ +/* Reset all state within params.c so that we can rerun the compiler + within the same process. For use by toplev::finalize. */ void params_c_finalize (void) diff --git a/gcc/predict.c b/gcc/predict.c index b0d572f..eb5db2a 100644 --- a/gcc/predict.c +++ b/gcc/predict.c @@ -3237,7 +3237,3 @@ rebuild_frequencies (void) gcc_unreachable (); timevar_pop (TV_REBUILD_FREQUENCIES); } - -void predict_c_finalize (void) -{ -} diff --git a/gcc/symtab.c b/gcc/symtab.c index fd9cbac..792b3b5 100644 --- a/gcc/symtab.c +++ b/gcc/symtab.c @@ -1755,10 +1755,6 @@ symtab_node::semantically_equivalent_p (symtab_node *target) return bb == ba; } -void symtab_c_finalize (void) -{ -} - /* Classify symbol symtab node for partitioning. */ enum symbol_partitioning_class diff --git a/gcc/toplev.c b/gcc/toplev.c index 37f54ef..58180f4 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -2066,15 +2066,10 @@ toplev::finalize (void) this_target_rtl->target_specific_initialized = false; cgraph_c_finalize (); - cgraphbuild_c_finalize (); cgraphunit_c_finalize (); dwarf2out_c_finalize (); gcse_c_finalize (); - ipa_c_finalize (); ipa_cp_c_finalize (); ipa_reference_c_finalize (); params_c_finalize (); - predict_c_finalize (); - symtab_c_finalize (); - varpool_c_finalize (); } diff --git a/gcc/varpool.c b/gcc/varpool.c index 5b6d76b..72971d6 100644 --- a/gcc/varpool.c +++ b/gcc/varpool.c @@ -781,7 +781,3 @@ varpool_node::call_for_node_and_aliases (bool (*callback) (varpool_node *, } return false; } - -void varpool_c_finalize (void) -{ -} -- 1.7.11.7