From df92c6403cb342aac3fe8720895d979b6d677321 Mon Sep 17 00:00:00 2001 From: Steven Bosscher Date: Thu, 13 Sep 2012 13:41:46 +0000 Subject: ipa-pure-const.c (state_from_flags, [...]): Use current_function_name instead of lang_hooks.decl_printable_name. * ipa-pure-const.c (state_from_flags, local_pure_const): Use current_function_name instead of lang_hooks.decl_printable_name. * function.h (fndecl_name): New prototype. * function.c (fndecl_name): New function. * vecir.h (cgraph_node_p): New standard IR VEC type. * trans-mem.c (cgraph_node_p): No need anymore to define it here. * ipa-utils.h (ipa_get_nodes_in_cycle): New prototype. * ipa-utils.c (ipa_get_nodes_in_cycle): New function. * ipa-reference.c: Don't include langhooks.h, and certainly not twice. Fix many formatting issues (long lines, short lines, spacing, etc.). (get_static_name): Use fndecl_name. (dump_static_vars_set_to_file): New function split out from propagate. (union_static_var_sets): New function, union two sets and collapse to all_module_statics as quickly as possible. (intersect_static_var_sets): New function, similar to above. (copy_static_var_set): Renamed from copy_global_bitmap and rewritten to allocate a copy on the same bitmap_obstack as the source set. (propagate_bits): Simplify, and clarify by using union_static_var_sets. (generate_summary): Remove bm_temp. Print UID of promotable globals. (read_write_all_from_decl): Use pass-by-reference, bless C++. (get_read_write_all_from_node): New function, split out from propagate. (propagate): Simplify and clarify with helper functions. Use ipa_get_nodes_in_cycle to walk all nodes in a reduced node. (ipa_reference_read_optimization_summary): Use fndecl_name instead of lang_hooks.decl_printable_name. * rtl.h (print_rtl_single_with_indent): New prototype. * print-rtl.c (print_rtl_single_with_indent): New function. * cfghooks.h (empty_block_p, split_block_before_cond_jump): New hooks. * cfghooks.c (empty_block_p, split_block_before_cond_jump): Implement. * cfgrtl.c (rtl_block_empty_p, rtl_split_block_before_cond_jump): Implement RTL specific hooks. (rtl_cfg_hooks, cfg_layout_rtl_cfg_hooks): Register the new hooks. * tree-cfg.c (gimple_empty_block_p, gimple_split_block_before_cond_jump): Implement GIMPLE specific hooks. (gimple_cfg_hooks): Register the new hooks. * tree-ssa-phiopt.c (empty_block_p): Remove in favor of new hook. From-SVN: r191255 --- gcc/tree-cfg.c | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) (limited to 'gcc/tree-cfg.c') diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 0c350a6..1a166cc49 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -5335,6 +5335,44 @@ gimple_move_block_after (basic_block bb, basic_block after) } +/* Return TRUE if block BB has no executable statements, otherwise return + FALSE. */ + +bool +gimple_empty_block_p (basic_block bb) +{ + /* BB must have no executable statements. */ + gimple_stmt_iterator gsi = gsi_after_labels (bb); + if (phi_nodes (bb)) + return false; + if (gsi_end_p (gsi)) + return true; + if (is_gimple_debug (gsi_stmt (gsi))) + gsi_next_nondebug (&gsi); + return gsi_end_p (gsi); +} + + +/* Split a basic block if it ends with a conditional branch and if the + other part of the block is not empty. */ + +static basic_block +gimple_split_block_before_cond_jump (basic_block bb) +{ + gimple last, split_point; + gimple_stmt_iterator gsi = gsi_last_nondebug_bb (bb); + if (gsi_end_p (gsi)) + return NULL; + last = gsi_stmt (gsi); + if (gimple_code (last) != GIMPLE_COND + && gimple_code (last) != GIMPLE_SWITCH) + return NULL; + gsi_prev_nondebug (&gsi); + split_point = gsi_stmt (gsi); + return split_block (bb, split_point)->dest; +} + + /* Return true if basic_block can be duplicated. */ static bool @@ -7492,7 +7530,9 @@ struct cfg_hooks gimple_cfg_hooks = { gimple_lv_add_condition_to_bb, /* lv_add_condition_to_bb */ gimple_lv_adjust_loop_header_phi, /* lv_adjust_loop_header_phi*/ extract_true_false_edges_from_block, /* extract_cond_bb_edges */ - flush_pending_stmts /* flush_pending_stmts */ + flush_pending_stmts, /* flush_pending_stmts */ + gimple_empty_block_p, /* block_empty_p */ + gimple_split_block_before_cond_jump, /* split_block_before_cond_jump */ }; -- cgit v1.1