+2018-03-14 Martin Liska <mliska@suse.cz>
+
+ * tree.c (record_node_allocation_statistics): Use
+ get_stats_node_kind.
+ (get_stats_node_kind): New function extracted from
+ record_node_allocation_statistics.
+ (free_node): Use get_stats_node_kind.
+
2018-03-14 Richard Biener <rguenther@suse.de>
* tree-ssa-pre.c (compute_antic_aux): Remove code that asserts
}
}
-/* Record interesting allocation statistics for a tree node with CODE
- and LENGTH. */
+/* Return tree node kind based on tree CODE. */
-static void
-record_node_allocation_statistics (enum tree_code code ATTRIBUTE_UNUSED,
- size_t length ATTRIBUTE_UNUSED)
+static tree_node_kind
+get_stats_node_kind (enum tree_code code)
{
enum tree_code_class type = TREE_CODE_CLASS (code);
- tree_node_kind kind;
-
- if (!GATHER_STATISTICS)
- return;
switch (type)
{
case tcc_declaration: /* A decl node */
- kind = d_kind;
- break;
-
+ return d_kind;
case tcc_type: /* a type node */
- kind = t_kind;
- break;
-
+ return t_kind;
case tcc_statement: /* an expression with side effects */
- kind = s_kind;
- break;
-
+ return s_kind;
case tcc_reference: /* a reference */
- kind = r_kind;
- break;
-
+ return r_kind;
case tcc_expression: /* an expression */
case tcc_comparison: /* a comparison expression */
case tcc_unary: /* a unary arithmetic expression */
case tcc_binary: /* a binary arithmetic expression */
- kind = e_kind;
- break;
-
+ return e_kind;
case tcc_constant: /* a constant */
- kind = c_kind;
- break;
-
+ return c_kind;
case tcc_exceptional: /* something random, like an identifier. */
switch (code)
{
case IDENTIFIER_NODE:
- kind = id_kind;
- break;
-
+ return id_kind;
case TREE_VEC:
- kind = vec_kind;
- break;
-
+ return vec_kind;
case TREE_BINFO:
- kind = binfo_kind;
- break;
-
+ return binfo_kind;
case SSA_NAME:
- kind = ssa_name_kind;
- break;
-
+ return ssa_name_kind;
case BLOCK:
- kind = b_kind;
- break;
-
+ return b_kind;
case CONSTRUCTOR:
- kind = constr_kind;
- break;
-
+ return constr_kind;
case OMP_CLAUSE:
- kind = omp_clause_kind;
- break;
-
+ return omp_clause_kind;
default:
- kind = x_kind;
- break;
+ return x_kind;
}
break;
-
case tcc_vl_exp:
- kind = e_kind;
- break;
-
+ return e_kind;
default:
gcc_unreachable ();
}
+}
+
+/* Record interesting allocation statistics for a tree node with CODE
+ and LENGTH. */
+
+static void
+record_node_allocation_statistics (enum tree_code code, size_t length)
+{
+ if (!GATHER_STATISTICS)
+ return;
+
+ tree_node_kind kind = get_stats_node_kind (code);
tree_code_counts[(int) code]++;
tree_node_counts[(int) kind]++;
enum tree_code code = TREE_CODE (node);
if (GATHER_STATISTICS)
{
+ enum tree_node_kind kind = get_stats_node_kind (code);
+
+ gcc_checking_assert (tree_code_counts[(int) TREE_CODE (node)] != 0);
+ gcc_checking_assert (tree_node_counts[(int) kind] != 0);
+ gcc_checking_assert (tree_node_sizes[(int) kind] >= tree_size (node));
+
tree_code_counts[(int) TREE_CODE (node)]--;
- tree_node_counts[(int) t_kind]--;
- tree_node_sizes[(int) t_kind] -= tree_size (node);
+ tree_node_counts[(int) kind]--;
+ tree_node_sizes[(int) kind] -= tree_size (node);
}
if (CODE_CONTAINS_STRUCT (code, TS_CONSTRUCTOR))
vec_free (CONSTRUCTOR_ELTS (node));