aboutsummaryrefslogtreecommitdiff
path: root/gcc/cfgrtl.c
diff options
context:
space:
mode:
authorSteven Bosscher <steven@gcc.gnu.org>2012-09-13 13:41:46 +0000
committerSteven Bosscher <steven@gcc.gnu.org>2012-09-13 13:41:46 +0000
commitdf92c6403cb342aac3fe8720895d979b6d677321 (patch)
treeccf42e9cc160d21ec43421b4abfe25c8a1812cda /gcc/cfgrtl.c
parent17742d62a2438144b6235b8f29141ec931c3bf96 (diff)
downloadgcc-df92c6403cb342aac3fe8720895d979b6d677321.zip
gcc-df92c6403cb342aac3fe8720895d979b6d677321.tar.gz
gcc-df92c6403cb342aac3fe8720895d979b6d677321.tar.bz2
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
Diffstat (limited to 'gcc/cfgrtl.c')
-rw-r--r--gcc/cfgrtl.c53
1 files changed, 51 insertions, 2 deletions
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index c62b5bc..4df289d 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -4120,6 +4120,51 @@ rtl_make_forwarder_block (edge fallthru ATTRIBUTE_UNUSED)
{
}
+/* Return true if BB contains only labels or non-executable
+ instructions. */
+
+static bool
+rtl_block_empty_p (basic_block bb)
+{
+ rtx insn;
+
+ if (bb == ENTRY_BLOCK_PTR || bb == EXIT_BLOCK_PTR)
+ return true;
+
+ FOR_BB_INSNS (bb, insn)
+ if (NONDEBUG_INSN_P (insn) && !any_uncondjump_p (insn))
+ return false;
+
+ return true;
+}
+
+/* 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
+rtl_split_block_before_cond_jump (basic_block bb)
+{
+ rtx insn;
+ rtx split_point = NULL;
+ rtx last = NULL;
+ bool found_code = false;
+
+ FOR_BB_INSNS (bb, insn)
+ {
+ if (any_condjump_p (insn))
+ split_point = last;
+ else if (NONDEBUG_INSN_P (insn))
+ found_code = true;
+ last = insn;
+ }
+
+ /* Did not find everything. */
+ if (found_code && split_point)
+ return split_block (bb, split_point)->dest;
+ else
+ return NULL;
+}
+
/* Return 1 if BB ends with a call, possibly followed by some
instructions that must stay with the call, 0 otherwise. */
@@ -4432,7 +4477,9 @@ struct cfg_hooks rtl_cfg_hooks = {
NULL, /* lv_add_condition_to_bb */
NULL, /* lv_adjust_loop_header_phi*/
NULL, /* extract_cond_bb_edges */
- NULL /* flush_pending_stmts */
+ NULL, /* flush_pending_stmts */
+ rtl_block_empty_p, /* block_empty_p */
+ rtl_split_block_before_cond_jump, /* split_block_before_cond_jump */
};
/* Implementation of CFG manipulation for cfg layout RTL, where
@@ -4470,7 +4517,9 @@ struct cfg_hooks cfg_layout_rtl_cfg_hooks = {
rtl_lv_add_condition_to_bb, /* lv_add_condition_to_bb */
NULL, /* lv_adjust_loop_header_phi*/
rtl_extract_cond_bb_edges, /* extract_cond_bb_edges */
- NULL /* flush_pending_stmts */
+ NULL, /* flush_pending_stmts */
+ rtl_block_empty_p, /* block_empty_p */
+ rtl_split_block_before_cond_jump, /* split_block_before_cond_jump */
};
#include "gt-cfgrtl.h"