@@ -1,5 +1,49 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Use subclasses of gimple in various places
+
+ * asan.c (insert_if_then_before_iter): Require a gimple cond
+ rathern than a plain gimple.
+ (asan_expand_check_ifn): Add a checked cast to gimple_cond.
+
+ * cfgloopmanip.c (create_empty_if_region_on_edge): Likewise.
+
+ * omp-low.c (simd_clone_adjust): Strengthen local from gimple
+ to gimple_phi.
+
+ * sese.c (set_ifsese_condition): Strengthen local from gimple to
+ gimple_cond.
+
+ * tree-call-cdce.c (gen_one_condition): Strengthen locals from
+ gimple to gimple_assign and gimple_cond.
+
+ * tree-ssa-phiopt.c (minmax_replacement): Likewise.
+ (cond_store_replacement): Strengthen locals from gimple to
+ gimple_phi and gimple_assign.
+ (cond_if_else_store_replacement_1): Likewise.
+
+ * tree-ssa-pre.c (do_regular_insertion): Strengthen local from
+ gimple to gimple_assign.
+
+ * tree-switch-conversion.c (hoist_edge_and_branch_if_true):
+ Strengthen local from gimple to gimple_cond.
+ (gen_def_assigns): Return a gimple_assign rather than a plain
+ gimple.
+ (gen_inbound_check): Strengthen locals from gimple to gimple_cond
+ and gimple_assign.
+
+ * tree-vect-loop-manip.c (slpeel_add_loop_guard): Strengthen local
+ from gimple to gimple_cond.
+ (set_prologue_iterations): Strengthen locals from gimple to
+ gimple_phi and gimple_cond.
+
+ * value-prof.c (gimple_ic): Strengthen local from gimple to
+ gimple_phi.
+ (gimple_stringop_fixed_value): Strengthen locals from gimple to
+ gimple_assign, gimple_cond, gimple_call, and gimple_phi.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Introduce gimple_eh_dispatch
* coretypes.h (gimple_eh_dispatch): New typedef.
@@ -1487,7 +1487,7 @@ create_cond_insert_point (gimple_stmt_iterator *iter,
pointing to initially. */
static void
-insert_if_then_before_iter (gimple cond,
+insert_if_then_before_iter (gimple_cond cond,
gimple_stmt_iterator *iter,
bool then_more_likely_p,
basic_block *then_bb,
@@ -2577,8 +2577,9 @@ asan_expand_check_ifn (gimple_stmt_iterator *iter, bool use_calls)
gimple_set_location (g, loc);
basic_block then_bb, fallthrough_bb;
- insert_if_then_before_iter (g, iter, /*then_more_likely_p=*/true,
- &then_bb, &fallthrough_bb);
+ insert_if_then_before_iter (as_a <gimple_cond> (g), iter,
+ /*then_more_likely_p=*/true,
+ &then_bb, &fallthrough_bb);
/* Note that fallthrough_bb starts with the statement that was
pointed to by ITER. */
@@ -690,7 +690,7 @@ create_empty_if_region_on_edge (edge entry_edge, tree condition)
basic_block cond_bb, true_bb, false_bb, join_bb;
edge e_true, e_false, exit_edge;
- gimple cond_stmt;
+ gimple_cond cond_stmt;
tree simple_cond;
gimple_stmt_iterator gsi;
@@ -12070,7 +12070,7 @@ simd_clone_adjust (struct cgraph_node *node)
make_edge (incr_bb, latch_bb, EDGE_TRUE_VALUE); */
FALLTHRU_EDGE (incr_bb)->flags = EDGE_TRUE_VALUE;
- gimple phi = create_phi_node (iter1, body_bb);
+ gimple_phi phi = create_phi_node (iter1, body_bb);
edge preheader_edge = find_edge (entry_bb, body_bb);
edge latch_edge = single_succ_edge (latch_bb);
add_phi_arg (phi, build_zero_cst (unsigned_type_node), preheader_edge,
@@ -726,7 +726,7 @@ set_ifsese_condition (ifsese if_region, tree condition)
basic_block bb = entry->dest;
gimple last = last_stmt (bb);
gimple_stmt_iterator gsi = gsi_last_bb (bb);
- gimple cond_stmt;
+ gimple_cond cond_stmt;
gcc_assert (gimple_code (last) == GIMPLE_COND);
@@ -332,7 +332,9 @@ gen_one_condition (tree arg, int lbub,
{
tree lbub_real_cst, lbub_cst, float_type;
tree temp, tempn, tempc, tempcn;
- gimple stmt1, stmt2, stmt3;
+ gimple_assign stmt1;
+ gimple_assign stmt2;
+ gimple_cond stmt3;
float_type = TREE_TYPE (arg);
lbub_cst = build_int_cst (integer_type_node, lbub);
@@ -910,7 +910,8 @@ minmax_replacement (basic_block cond_bb, basic_block middle_bb,
tree arg0, tree arg1)
{
tree result, type;
- gimple cond, new_stmt;
+ gimple_cond cond;
+ gimple_assign new_stmt;
edge true_edge, false_edge;
enum tree_code cmp, minmax, ass_code;
tree smaller, larger, arg_true, arg_false;
@@ -922,7 +923,7 @@ minmax_replacement (basic_block cond_bb, basic_block middle_bb,
if (HONOR_NANS (TYPE_MODE (type)))
return false;
- cond = last_stmt (cond_bb);
+ cond = as_a <gimple_cond> (last_stmt (cond_bb));
cmp = gimple_cond_code (cond);
/* This transformation is only valid for order comparisons. Record which
@@ -1638,7 +1639,8 @@ cond_store_replacement (basic_block middle_bb, basic_block join_bb,
{
gimple assign = last_and_only_stmt (middle_bb);
tree lhs, rhs, name, name2;
- gimple newphi, new_stmt;
+ gimple_phi newphi;
+ gimple_assign new_stmt;
gimple_stmt_iterator gsi;
source_location locus;
@@ -1711,7 +1713,8 @@ cond_if_else_store_replacement_1 (basic_block then_bb, basic_block else_bb,
tree lhs_base, lhs, then_rhs, else_rhs, name;
source_location then_locus, else_locus;
gimple_stmt_iterator gsi;
- gimple newphi, new_stmt;
+ gimple_phi newphi;
+ gimple_assign new_stmt;
if (then_assign == NULL
|| !gimple_assign_single_p (then_assign)
@@ -3313,8 +3313,11 @@ do_regular_insertion (basic_block block, basic_block dom)
tree temp = make_temp_ssa_name (get_expr_type (expr),
NULL, "pretmp");
- gimple assign = gimple_build_assign (temp,
- edoubleprime->kind == CONSTANT ? PRE_EXPR_CONSTANT (edoubleprime) : PRE_EXPR_NAME (edoubleprime));
+ gimple_assign assign =
+ gimple_build_assign (temp,
+ edoubleprime->kind == CONSTANT ?
+ PRE_EXPR_CONSTANT (edoubleprime) :
+ PRE_EXPR_NAME (edoubleprime));
gimple_stmt_iterator gsi = gsi_after_labels (block);
gsi_insert_before (&gsi, assign, GSI_NEW_STMT);
@@ -85,7 +85,7 @@ hoist_edge_and_branch_if_true (gimple_stmt_iterator *gsip,
bool update_dominators)
{
tree tmp;
- gimple cond_stmt;
+ gimple_cond cond_stmt;
edge e_false;
basic_block new_bb, split_bb = gsi_bb (*gsip);
bool dominated_e_true = false;
@@ -1156,11 +1156,11 @@ build_arrays (gimple_switch swtch, struct switch_conv_info *info)
/* Generates and appropriately inserts loads of default values at the position
given by BSI. Returns the last inserted statement. */
-static gimple
+static gimple_assign
gen_def_assigns (gimple_stmt_iterator *gsi, struct switch_conv_info *info)
{
int i;
- gimple assign = NULL;
+ gimple_assign assign = NULL;
for (i = 0; i < info->phi_count; i++)
{
@@ -1247,9 +1247,9 @@ gen_inbound_check (gimple_switch swtch, struct switch_conv_info *info)
tree utype, tidx;
tree bound;
- gimple cond_stmt;
+ gimple_cond cond_stmt;
- gimple last_assign;
+ gimple_assign last_assign;
gimple_stmt_iterator gsi;
basic_block bb0, bb1, bb2, bbf, bbd;
edge e01, e02, e21, e1d, e1f, e2f;
@@ -929,7 +929,7 @@ slpeel_add_loop_guard (basic_block guard_bb, tree cond,
{
gimple_stmt_iterator gsi;
edge new_e, enter_e;
- gimple cond_stmt;
+ gimple_cond cond_stmt;
gimple_seq gimplify_stmt_list = NULL;
enter_e = EDGE_SUCC (guard_bb, 0);
@@ -1042,9 +1042,9 @@ set_prologue_iterations (basic_block bb_before_first_loop,
basic_block cond_bb, then_bb;
tree var, prologue_after_cost_adjust_name;
gimple_stmt_iterator gsi;
- gimple newphi;
+ gimple_phi newphi;
edge e_true, e_false, e_fallthru;
- gimple cond_stmt;
+ gimple_cond cond_stmt;
gimple_seq stmts = NULL;
tree cost_pre_condition = NULL_TREE;
tree scalar_loop_iters =
@@ -1468,7 +1468,7 @@ gimple_ic (gimple icall_stmt, struct cgraph_node *direct_call,
&& (dflags & ECF_NORETURN) == 0)
{
tree result = gimple_call_lhs (icall_stmt);
- gimple phi = create_phi_node (result, join_bb);
+ gimple_phi phi = create_phi_node (result, join_bb);
gimple_call_set_lhs (icall_stmt,
duplicate_ssa_name (result, icall_stmt));
add_phi_arg (phi, gimple_call_lhs (icall_stmt), e_ij, UNKNOWN_LOCATION);
@@ -1636,7 +1636,9 @@ static void
gimple_stringop_fixed_value (gimple_call vcall_stmt, tree icall_size, int prob,
gcov_type count, gcov_type all)
{
- gimple tmp_stmt, cond_stmt, icall_stmt;
+ gimple_assign tmp_stmt;
+ gimple_cond cond_stmt;
+ gimple_call icall_stmt;
tree tmp0, tmp1, vcall_size, optype;
basic_block cond_bb, icall_bb, vcall_bb, join_bb;
edge e_ci, e_cv, e_iv, e_ij, e_vj;
@@ -1668,7 +1670,7 @@ gimple_stringop_fixed_value (gimple_call vcall_stmt, tree icall_size, int prob,
gimple_set_vdef (vcall_stmt, NULL);
gimple_set_vuse (vcall_stmt, NULL);
update_stmt (vcall_stmt);
- icall_stmt = gimple_copy (vcall_stmt);
+ icall_stmt = as_a <gimple_call> (gimple_copy (vcall_stmt));
gimple_call_set_arg (icall_stmt, size_arg, icall_size);
gsi_insert_before (&gsi, icall_stmt, GSI_SAME_STMT);
@@ -1708,7 +1710,7 @@ gimple_stringop_fixed_value (gimple_call vcall_stmt, tree icall_size, int prob,
&& TREE_CODE (gimple_call_lhs (vcall_stmt)) == SSA_NAME)
{
tree result = gimple_call_lhs (vcall_stmt);
- gimple phi = create_phi_node (result, join_bb);
+ gimple_phi phi = create_phi_node (result, join_bb);
gimple_call_set_lhs (vcall_stmt,
duplicate_ssa_name (result, vcall_stmt));
add_phi_arg (phi, gimple_call_lhs (vcall_stmt), e_vj, UNKNOWN_LOCATION);
This corresponds to: [PATCH 31/89] Use subclasses of gimple in various places https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01171.html from the original 89-patch kit That earlier patch was approved by Jeff: > OK once any prerequisites are in and any renaming done. in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00634.html gcc/ * asan.c (insert_if_then_before_iter): Require a gimple cond rathern than a plain gimple. (asan_expand_check_ifn): Add a checked cast to gimple_cond. * cfgloopmanip.c (create_empty_if_region_on_edge): Likewise. * omp-low.c (simd_clone_adjust): Strengthen local from gimple to gimple_phi. * sese.c (set_ifsese_condition): Strengthen local from gimple to gimple_cond. * tree-call-cdce.c (gen_one_condition): Strengthen locals from gimple to gimple_assign and gimple_cond. * tree-ssa-phiopt.c (minmax_replacement): Likewise. (cond_store_replacement): Strengthen locals from gimple to gimple_phi and gimple_assign. (cond_if_else_store_replacement_1): Likewise. * tree-ssa-pre.c (do_regular_insertion): Strengthen local from gimple to gimple_assign. * tree-switch-conversion.c (hoist_edge_and_branch_if_true): Strengthen local from gimple to gimple_cond. (gen_def_assigns): Return a gimple_assign rather than a plain gimple. (gen_inbound_check): Strengthen locals from gimple to gimple_cond and gimple_assign. * tree-vect-loop-manip.c (slpeel_add_loop_guard): Strengthen local from gimple to gimple_cond. (set_prologue_iterations): Strengthen locals from gimple to gimple_phi and gimple_cond. * value-prof.c (gimple_ic): Strengthen local from gimple to gimple_phi. (gimple_stringop_fixed_value): Strengthen locals from gimple to gimple_assign, gimple_cond, gimple_call, and gimple_phi. --- gcc/ChangeLog.gimple-classes | 44 ++++++++++++++++++++++++++++++++++++++++++++ gcc/asan.c | 7 ++++--- gcc/cfgloopmanip.c | 2 +- gcc/omp-low.c | 2 +- gcc/sese.c | 2 +- gcc/tree-call-cdce.c | 4 +++- gcc/tree-ssa-phiopt.c | 11 +++++++---- gcc/tree-ssa-pre.c | 7 +++++-- gcc/tree-switch-conversion.c | 10 +++++----- gcc/tree-vect-loop-manip.c | 6 +++--- gcc/value-prof.c | 10 ++++++---- 11 files changed, 80 insertions(+), 25 deletions(-)