https://gcc.gnu.org/g:b7e4c1e1eae70b2df98e8a6eacc26b533c4730de
commit b7e4c1e1eae70b2df98e8a6eacc26b533c4730de Author: Michael Matz <[email protected]> Date: Mon Mar 5 03:12:33 2018 +0100 Add SSA opcache statistics also move printing of SSA names statistics (and the new one) outside GATHER_STATISTICS, as they are already tracked always anyway. Diff: --- gcc/tree-ssa-operands.c | 16 ++++++++++++++-- gcc/tree-ssa-operands.h | 1 + gcc/tree.c | 3 ++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/gcc/tree-ssa-operands.c b/gcc/tree-ssa-operands.c index a038dffaefcc..1a998268db28 100644 --- a/gcc/tree-ssa-operands.c +++ b/gcc/tree-ssa-operands.c @@ -107,6 +107,8 @@ static void get_expr_operands (gimple *, tree *, int); /* Number of functions with initialized ssa_operands. */ static int n_initialized = 0; +static unsigned use_ops_created; +static unsigned use_ops_reused; /* Accessor to tree-ssa-operands.c caches. */ static inline struct ssa_operands * @@ -260,6 +262,12 @@ ssa_operand_alloc (struct function *fn, unsigned size) return ptr; } +void +ssa_opcache_print_statistics (void) +{ + fprintf (stderr, "SSA cache use-ops allocated: %u\n", use_ops_created); + fprintf (stderr, "SSA cache use-ops reused: %u\n", use_ops_reused); +} /* Allocate a USE operand. */ @@ -272,10 +280,14 @@ alloc_use (struct function *fn) ret = gimple_ssa_operands (fn)->free_uses; gimple_ssa_operands (fn)->free_uses = gimple_ssa_operands (fn)->free_uses->next; + use_ops_reused++; } else - ret = (struct use_optype_d *) - ssa_operand_alloc (fn, sizeof (struct use_optype_d)); + { + ret = (struct use_optype_d *) + ssa_operand_alloc (fn, sizeof (struct use_optype_d)); + use_ops_created++; + } return ret; } diff --git a/gcc/tree-ssa-operands.h b/gcc/tree-ssa-operands.h index ef0eaaa0e5eb..ea16e18e132a 100644 --- a/gcc/tree-ssa-operands.h +++ b/gcc/tree-ssa-operands.h @@ -103,6 +103,7 @@ extern void dump_immediate_uses_for (FILE *file, tree var); extern void dump_immediate_uses (FILE *file); extern void debug_immediate_uses (void); extern void debug_immediate_uses_for (tree var); +extern void ssa_opcache_print_statistics (void); extern void unlink_stmt_vdef (gimple *); diff --git a/gcc/tree.c b/gcc/tree.c index 77a73b4495e2..3f37d2bb4222 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -9107,7 +9107,6 @@ dump_tree_statistics (void) get_tree_code_name ((enum tree_code) i), tree_code_counts[i]); mem_usage::print_dash_line (TREE_MEM_USAGE_SPACES); fprintf (stderr, "\n"); - ssanames_print_statistics (); fprintf (stderr, "\n"); phinodes_print_statistics (); fprintf (stderr, "\n"); @@ -9119,6 +9118,8 @@ dump_tree_statistics (void) print_debug_expr_statistics (); print_value_expr_statistics (); lang_hooks.print_statistics (); + ssanames_print_statistics (); + ssa_opcache_print_statistics (); } #define FILE_FUNCTION_FORMAT "_GLOBAL__%s_%s"
