From 2eb712b4020785ab8784e71edd29969e2d38d256 Mon Sep 17 00:00:00 2001 From: Martin Jambor Date: Fri, 24 Aug 2012 14:57:24 +0200 Subject: predict.c (maybe_hot_frequency_p): New parameter fun. 2012-08-24 Martin Jambor * predict.c (maybe_hot_frequency_p): New parameter fun. Use its decl instead of current_function_decl, use profile_status_for_function and ENTRY_BLOCK_PTR_FOR_FUNCTION with fun instead of their cfun variants. (maybe_hot_count_p): New parameter fun, use profile_status_for_function instead of its cfun_variant. (maybe_hot_bb_p): New parameter fun, checking-assert it, pass it to all callees. (maybe_hot_edge_p): Pass cfun to maybe_hot_count_p and maybe_hot_frequency_p. (probably_never_executed_bb_p): New parameter fun, use its decl instead of current_function_decl. (optimize_bb_for_size_p): Pass cfun to maybe_hot_bb_p. (rtl_profile_for_bb): Likewise. (compute_function_frequency): Pass cfun to maybe_hot_bb_p and probably_never_executed_bb_p. * tree-ssa-operands.c (ssa_operands_active): New operator fun. Use it instead of cfun. (update_stmt_operands): Pass cfun as an argument of ssa_operands_active. (swap_tree_operands): Likewise. * gimple-iterator.c (update_modified_stmt): Likewise. (update_modified_stmts): Likewise. * tree-flow-inline.h (delink_stmt_imm_use): Likewise. * tree-ssa.c (delete_tree_ssa): Likewise. * bb-reorder.c (bb_to_key): Pass cfun to probably_never_executed_bb_p. (push_to_next_round_p): Likewise. (find_rarely_executed_basic_blocks_and_crossing_edges ): Likewise. * cfg.c: Inlude tree.h. (check_bb_profile): Use profile_status_for_function, EXIT_BLOCK_PTR_FOR_FUNCTION and ENTRY_BLOCK_PTR_FOR_FUNCTION with DECL_STRUCT_FUNCTION (current_function_decl) instead of their cfun variants. (dump_bb_info): Pass DECL_STRUCT_FUNCTION (current_function_decl) to maybe_hot_bb_p and probably_never_executed_bb_p. * gimple-pretty-print.c (gimple_dump_bb_buff): Checking-assert that DECL_STRUCT_FUNCTION (current_function_decl) is not NULL. Pass it to dump_histograms_for_stmt. (dump_gimple_mem_ops): Pass DECL_STRUCT_FUNCTION (current_function_decl) as an argument to dump_gimple_mem_ops. * tree-cfg.c (dump_function_to_file): Rename parameter fn to fndecl. Do not change cfun. Change and restore current_function_decl. * Makefile.in (cfg.o): Include TREE_H in dependencies. From-SVN: r190645 --- gcc/cfg.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'gcc/cfg.c') diff --git a/gcc/cfg.c b/gcc/cfg.c index ba83208..3f14d49 100644 --- a/gcc/cfg.c +++ b/gcc/cfg.c @@ -55,6 +55,7 @@ along with GCC; see the file COPYING3. If not see #include "ggc.h" #include "hashtab.h" #include "alloc-pool.h" +#include "tree.h" #include "basic-block.h" #include "df.h" #include "cfgloop.h" /* FIXME: For struct loop. */ @@ -404,14 +405,15 @@ check_bb_profile (basic_block bb, FILE * file, int indent, int flags) int sum = 0; gcov_type lsum; edge_iterator ei; + struct function *fun = DECL_STRUCT_FUNCTION (current_function_decl); char *s_indent = (char *) alloca ((size_t) indent + 1); memset ((void *) s_indent, ' ', (size_t) indent); s_indent[indent] = '\0'; - if (profile_status == PROFILE_ABSENT) + if (profile_status_for_function (fun) == PROFILE_ABSENT) return; - if (bb != EXIT_BLOCK_PTR) + if (bb != EXIT_BLOCK_PTR_FOR_FUNCTION (fun)) { FOR_EACH_EDGE (e, ei, bb->succs) sum += e->probability; @@ -428,7 +430,7 @@ check_bb_profile (basic_block bb, FILE * file, int indent, int flags) (flags & TDF_COMMENT) ? ";; " : "", s_indent, (int) lsum, (int) bb->count); } - if (bb != ENTRY_BLOCK_PTR) + if (bb != ENTRY_BLOCK_PTR_FOR_FUNCTION (fun)) { sum = 0; FOR_EACH_EDGE (e, ei, bb->preds) @@ -701,12 +703,13 @@ dump_bb_info (FILE *outf, basic_block bb, int indent, int flags, s_indent, bb->index, bb_loop_depth (bb)); if (flags & TDF_DETAILS) { + struct function *fun = DECL_STRUCT_FUNCTION (current_function_decl); fprintf (outf, ", count " HOST_WIDEST_INT_PRINT_DEC, (HOST_WIDEST_INT) bb->count); fprintf (outf, ", freq %i", bb->frequency); - if (maybe_hot_bb_p (bb)) + if (maybe_hot_bb_p (fun, bb)) fputs (", maybe hot", outf); - if (probably_never_executed_bb_p (bb)) + if (probably_never_executed_bb_p (fun, bb)) fputs (", probably never executed", outf); } fputc ('\n', outf); -- cgit v1.1