2007-07-10 Zdenek Dvorak <dvorakz@suse.cz>
+ * tree-scalar-evolution.c (scev_const_prop): Add arguments to
+ force_gimple_operand_bsi.
+ * tree-ssa-loop-ivopts.c (rewrite_use_nonlinear_expr,
+ rewrite_use_compare): Ditto.
+ * tree-ssa-address.c (gimplify_mem_ref_parts, create_mem_ref):
+ Ditto.
+ * tree-ssa-ifcombine.c (ifcombine_ifandif): Ditto.
+ * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Ditto.
+ * lambda-code.c (replace_uses_equiv_to_x_with_y): Ditto.
+ * tree-profile.c (prepare_instrumented_value,
+ tree_gen_interval_profiler, tree_gen_pow2_profiler,
+ tree_gen_one_value_profiler, tree_gen_ic_profiler,
+ tree_gen_ic_func_profiler, tree_gen_average_profiler,
+ tree_gen_ior_profiler): Ditto.
+ * tree-ssa-reassoc.c (negate_value): Ditto.
+ * matrix-reorg.c (transform_access_sites, transform_allocation_sites):
+ Use force_gimple_operand_bsi.
+ * tree-vect-transform.c (vect_update_ivs_after_vectorizer): Ditto.
+ * tree-if-conv.c (add_to_dst_predicate_list,
+ find_phi_replacement_condition): Ditto.
+ * gimplify.c (force_gimple_operand_bsi): Add before and m arguments.
+ Call mark_symbols_for_renaming for new statements.
+ * tree-flow.h (force_gimple_operand_bsi): Declaration changed.
+
+2007-07-10 Zdenek Dvorak <dvorakz@suse.cz>
+
* cfghooks.c (remove_edge): New function.
(redirect_edge_and_branch, remove_branch, merge_blocks): Updated
loop exit rescans.
}
/* Invokes force_gimple_operand for EXPR with parameters SIMPLE_P and VAR. If
- some statements are produced, emits them before BSI. */
+ some statements are produced, emits them at BSI. If BEFORE is true.
+ the statements are appended before BSI, otherwise they are appended after
+ it. M specifies the way BSI moves after insertion (BSI_SAME_STMT or
+ BSI_CONTINUE_LINKING are the usual values). */
tree
force_gimple_operand_bsi (block_stmt_iterator *bsi, tree expr,
- bool simple_p, tree var)
+ bool simple_p, tree var, bool before,
+ enum bsi_iterator_update m)
{
tree stmts;
expr = force_gimple_operand (expr, &stmts, simple_p, var);
if (stmts)
- bsi_insert_before (bsi, stmts, BSI_SAME_STMT);
+ {
+ if (gimple_in_ssa_p (cfun))
+ {
+ tree_stmt_iterator tsi;
+
+ for (tsi = tsi_start (stmts); !tsi_end_p (tsi); tsi_next (&tsi))
+ mark_symbols_for_renaming (tsi_stmt (tsi));
+ }
+
+ if (before)
+ bsi_insert_before (bsi, stmts, m);
+ else
+ bsi_insert_after (bsi, stmts, m);
+ }
return expr;
}
which sets Y. */
var = create_tmp_var (TREE_TYPE (use), "perfecttmp");
add_referenced_var (var);
- val = force_gimple_operand_bsi (firstbsi, val, false, NULL);
+ val = force_gimple_operand_bsi (firstbsi, val, false, NULL,
+ true, BSI_SAME_STMT);
setstmt = build_gimple_modify_stmt (var, val);
var = make_ssa_name (var, setstmt);
GIMPLE_STMT_OPERAND (setstmt, 0) = var;
static int
transform_access_sites (void **slot, void *data ATTRIBUTE_UNUSED)
{
- tree stmts;
block_stmt_iterator bsi;
struct matrix_info *mi = *slot;
int min_escape_l = mi->min_indirect_level_escape;
total_elements = new_offset;
if (new_offset != offset)
{
- tmp1 =
- force_gimple_operand (total_elements, &stmts, true,
- NULL);
- if (stmts)
- {
- tree_stmt_iterator tsi;
-
- for (tsi = tsi_start (stmts); !tsi_end_p (tsi);
- tsi_next (&tsi))
- mark_symbols_for_renaming (tsi_stmt (tsi));
- bsi = bsi_for_stmt (acc_info->stmt);
- bsi_insert_before (&bsi, stmts, BSI_SAME_STMT);
- }
+ bsi = bsi_for_stmt (acc_info->stmt);
+ tmp1 = force_gimple_operand_bsi (&bsi, total_elements,
+ true, NULL,
+ true, BSI_SAME_STMT);
}
else
tmp1 = offset;
num_elements =
fold_build2 (MULT_EXPR, sizetype, fold_convert (sizetype, acc_info->index),
fold_convert (sizetype, d_size));
- tmp1 = force_gimple_operand (num_elements, &stmts, true, NULL);
add_referenced_var (d_size);
- if (stmts)
- {
- tree_stmt_iterator tsi;
-
- for (tsi = tsi_start (stmts); !tsi_end_p (tsi);
- tsi_next (&tsi))
- mark_symbols_for_renaming (tsi_stmt (tsi));
- bsi = bsi_for_stmt (acc_info->stmt);
- bsi_insert_before (&bsi, stmts, BSI_SAME_STMT);
- }
+ bsi = bsi_for_stmt (acc_info->stmt);
+ tmp1 = force_gimple_operand_bsi (&bsi, num_elements, true,
+ NULL, true, BSI_SAME_STMT);
}
/* Replace the offset if needed. */
if (tmp1 != offset)
{
int i;
struct matrix_info *mi;
- tree type, call_stmt_0, malloc_stmt, oldfn, stmts, prev_dim_size, use_stmt;
+ tree type, call_stmt_0, malloc_stmt, oldfn, prev_dim_size, use_stmt;
struct cgraph_node *c_node;
struct cgraph_edge *e;
block_stmt_iterator bsi;
{
tree dim_size, dim_var, tmp;
tree d_type_size;
- tree_stmt_iterator tsi;
/* Now put the size expression in a global variable and initialize it to
the size expression before the malloc of level 0. */
dim_size = fold_build2 (MULT_EXPR, type, dim_size, prev_dim_size);
}
- dim_size = force_gimple_operand (dim_size, &stmts, true, NULL);
- if (stmts)
- {
- for (tsi = tsi_start (stmts); !tsi_end_p (tsi); tsi_next (&tsi))
- mark_symbols_for_renaming (tsi_stmt (tsi));
- bsi_insert_before (&bsi, stmts, BSI_SAME_STMT);
- bsi = bsi_for_stmt (call_stmt_0);
- }
+ dim_size = force_gimple_operand_bsi (&bsi, dim_size, true, NULL,
+ true, BSI_SAME_STMT);
/* GLOBAL_HOLDING_THE_SIZE = DIM_SIZE. */
tmp = fold_build2 (GIMPLE_MODIFY_STMT, type, dim_var, dim_size);
GIMPLE_STMT_OPERAND (tmp, 0) = dim_var;
mark_symbols_for_renaming (tmp);
- bsi_insert_before (&bsi, tmp, BSI_NEW_STMT);
- bsi = bsi_for_stmt (call_stmt_0);
+ bsi_insert_before (&bsi, tmp, BSI_SAME_STMT);
prev_dim_size = mi->dimension_size[i] = dim_var;
}
malloc_stmt = GIMPLE_STMT_OPERAND (call_stmt_0, 1);
c_node = cgraph_node (mi->allocation_function_decl);
old_size_0 = CALL_EXPR_ARG (malloc_stmt, 0);
- bsi = bsi_for_stmt (call_stmt_0);
- tmp = force_gimple_operand (mi->dimension_size[0], &stmts, true, NULL);
- if (stmts)
- {
- tree_stmt_iterator tsi;
-
- for (tsi = tsi_start (stmts); !tsi_end_p (tsi); tsi_next (&tsi))
- mark_symbols_for_renaming (tsi_stmt (tsi));
- bsi_insert_before (&bsi, stmts, BSI_SAME_STMT);
- bsi = bsi_for_stmt (call_stmt_0);
- }
+ tmp = force_gimple_operand_bsi (&bsi, mi->dimension_size[0], true,
+ NULL, true, BSI_SAME_STMT);
if (TREE_CODE (old_size_0) == SSA_NAME)
{
FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter, old_size_0)
/* In gimplify.c */
tree force_gimple_operand (tree, tree *, bool, tree);
-tree force_gimple_operand_bsi (block_stmt_iterator *, tree, bool, tree);
+tree force_gimple_operand_bsi (block_stmt_iterator *, tree, bool, tree,
+ bool, enum bsi_iterator_update);
/* In tree-ssa-structalias.c */
bool find_what_p_points_to (tree);
{
tree tmp;
tree tmp_stmt = NULL_TREE;
- tree tmp_stmts1 = NULL_TREE;
- tree tmp_stmts2 = NULL_TREE;
- prev_cond = force_gimple_operand (unshare_expr (prev_cond),
- &tmp_stmts1, true, NULL);
- if (tmp_stmts1)
- bsi_insert_before (bsi, tmp_stmts1, BSI_SAME_STMT);
-
- cond = force_gimple_operand (unshare_expr (cond),
- &tmp_stmts2, true, NULL);
- if (tmp_stmts2)
- bsi_insert_before (bsi, tmp_stmts2, BSI_SAME_STMT);
+
+ prev_cond = force_gimple_operand_bsi (bsi, unshare_expr (prev_cond),
+ true, NULL, true, BSI_SAME_STMT);
+
+ cond = force_gimple_operand_bsi (bsi, unshare_expr (cond),
+ true, NULL, true, BSI_SAME_STMT);
/* Add the condition to aux field of the edge. In case edge
destination is a PHI node, this condition will be ANDed with
block_stmt_iterator *bsi)
{
edge first_edge, second_edge;
- tree tmp_cond, new_stmts;
+ tree tmp_cond;
gcc_assert (EDGE_COUNT (bb->preds) == 2);
first_edge = EDGE_PRED (bb, 0);
value as condition. Various targets use different means to communicate
condition in vector compare operation. Using gimple value allows compiler
to emit vector compare and select RTL without exposing compare's result. */
- *cond = force_gimple_operand (*cond, &new_stmts, false, NULL_TREE);
- if (new_stmts)
- bsi_insert_before (bsi, new_stmts, BSI_SAME_STMT);
+ *cond = force_gimple_operand_bsi (bsi, *cond, false, NULL_TREE,
+ true, BSI_SAME_STMT);
if (!is_gimple_reg (*cond) && !is_gimple_condexpr (*cond))
{
tree new_stmt;
{
tree val = value->hvalue.value;
return force_gimple_operand_bsi (bsi, fold_convert (gcov_type_node, val),
- true, NULL_TREE);
+ true, NULL_TREE, true, BSI_SAME_STMT);
}
/* Output instructions as GIMPLE trees to increment the interval histogram
ref_ptr = force_gimple_operand_bsi (&bsi,
build_addr (ref, current_function_decl),
- true, NULL_TREE);
+ true, NULL_TREE, true, BSI_SAME_STMT);
val = prepare_instrumented_value (&bsi, value);
call = build_call_expr (tree_interval_profiler_fn, 4,
ref_ptr, val, start, steps);
ref_ptr = force_gimple_operand_bsi (&bsi,
build_addr (ref, current_function_decl),
- true, NULL_TREE);
+ true, NULL_TREE, true, BSI_SAME_STMT);
val = prepare_instrumented_value (&bsi, value);
call = build_call_expr (tree_pow2_profiler_fn, 2, ref_ptr, val);
bsi_insert_before (&bsi, call, BSI_SAME_STMT);
ref_ptr = force_gimple_operand_bsi (&bsi,
build_addr (ref, current_function_decl),
- true, NULL_TREE);
+ true, NULL_TREE, true, BSI_SAME_STMT);
val = prepare_instrumented_value (&bsi, value);
call = build_call_expr (tree_one_value_profiler_fn, 2, ref_ptr, val);
bsi_insert_before (&bsi, call, BSI_SAME_STMT);
ref_ptr = force_gimple_operand_bsi (&bsi,
build_addr (ref, current_function_decl),
- true, NULL_TREE);
+ true, NULL_TREE, true, BSI_SAME_STMT);
/* Insert code:
cur_func = force_gimple_operand_bsi (&bsi,
build_addr (current_function_decl,
current_function_decl),
- true, NULL_TREE);
+ true, NULL_TREE,
+ true, BSI_SAME_STMT);
tree_uid = build_int_cst (gcov_type_node, c_node->pid);
stmt1 = build_call_expr (tree_indirect_call_profiler_fn, 4,
ic_gcov_type_ptr_var,
ref_ptr = force_gimple_operand_bsi (&bsi,
build_addr (ref, current_function_decl),
- true, NULL_TREE);
+ true, NULL_TREE,
+ true, BSI_SAME_STMT);
val = prepare_instrumented_value (&bsi, value);
call = build_call_expr (tree_average_profiler_fn, 2, ref_ptr, val);
bsi_insert_before (&bsi, call, BSI_SAME_STMT);
ref_ptr = force_gimple_operand_bsi (&bsi,
build_addr (ref, current_function_decl),
- true, NULL_TREE);
+ true, NULL_TREE, true, BSI_SAME_STMT);
val = prepare_instrumented_value (&bsi, value);
call = build_call_expr (tree_ior_profiler_fn, 2, ref_ptr, val);
bsi_insert_before (&bsi, call, BSI_SAME_STMT);
{
block_stmt_iterator dest = bsi;
bsi_insert_before (&dest, ass, BSI_NEW_STMT);
- def = force_gimple_operand_bsi (&dest, def, false, NULL_TREE);
+ def = force_gimple_operand_bsi (&dest, def, false, NULL_TREE,
+ true, BSI_SAME_STMT);
}
GIMPLE_STMT_OPERAND (ass, 1) = def;
update_stmt (ass);
{
if (parts->base)
parts->base = force_gimple_operand_bsi (bsi, parts->base,
- true, NULL_TREE);
+ true, NULL_TREE,
+ true, BSI_SAME_STMT);
if (parts->index)
parts->index = force_gimple_operand_bsi (bsi, parts->index,
- true, NULL_TREE);
+ true, NULL_TREE,
+ true, BSI_SAME_STMT);
}
/* Creates and returns a TARGET_MEM_REF for address ADDR. If necessary
parts.index = force_gimple_operand_bsi (bsi,
fold_build2 (MULT_EXPR, sizetype,
parts.index, parts.step),
- true, NULL_TREE);
+ true, NULL_TREE, true, BSI_SAME_STMT);
parts.step = NULL_TREE;
mem_ref = create_mem_ref_raw (type, &parts);
fold_build2 (PLUS_EXPR, atype,
fold_convert (atype, parts.base),
tmp),
- true, NULL_TREE);
+ true, NULL_TREE, true, BSI_SAME_STMT);
}
else
{
fold_build2 (PLUS_EXPR, atype,
parts.base,
fold_convert (atype, parts.index)),
- true, NULL_TREE);
+ true, NULL_TREE, true, BSI_SAME_STMT);
}
else
parts.base = parts.index;
fold_build2 (POINTER_PLUS_EXPR, atype,
parts.base,
fold_convert (sizetype, parts.offset)),
- true, NULL_TREE);
+ true, NULL_TREE, true, BSI_SAME_STMT);
}
else
parts.base = parts.offset;
t2 = fold_build2 (LSHIFT_EXPR, TREE_TYPE (name1),
integer_one_node, bit2);
t = fold_build2 (BIT_IOR_EXPR, TREE_TYPE (name1), t, t2);
- t = force_gimple_operand_bsi (&bsi, t, true, NULL_TREE);
+ t = force_gimple_operand_bsi (&bsi, t, true, NULL_TREE,
+ true, BSI_SAME_STMT);
t2 = fold_build2 (BIT_AND_EXPR, TREE_TYPE (name1), name1, t);
- t2 = force_gimple_operand_bsi (&bsi, t2, true, NULL_TREE);
+ t2 = force_gimple_operand_bsi (&bsi, t2, true, NULL_TREE,
+ true, BSI_SAME_STMT);
COND_EXPR_COND (inner_cond) = fold_build2 (EQ_EXPR, boolean_type_node,
t2, t);
update_stmt (inner_cond);
/* Do it. */
bsi = bsi_for_stmt (inner_cond);
t = fold_build2 (BIT_IOR_EXPR, TREE_TYPE (name1), bits1, bits2);
- t = force_gimple_operand_bsi (&bsi, t, true, NULL_TREE);
+ t = force_gimple_operand_bsi (&bsi, t, true, NULL_TREE,
+ true, BSI_SAME_STMT);
t = fold_build2 (BIT_AND_EXPR, TREE_TYPE (name1), name1, t);
- t = force_gimple_operand_bsi (&bsi, t, true, NULL_TREE);
+ t = force_gimple_operand_bsi (&bsi, t, true, NULL_TREE,
+ true, BSI_SAME_STMT);
COND_EXPR_COND (inner_cond) = fold_build2 (NE_EXPR, boolean_type_node, t,
build_int_cst (TREE_TYPE (t), 0));
update_stmt (inner_cond);
struct iv_use *use, struct iv_cand *cand)
{
tree comp;
- tree op, stmts, tgt, ass;
+ tree op, tgt, ass;
block_stmt_iterator bsi;
/* An important special case -- if we are asked to express value of
gcc_unreachable ();
}
- op = force_gimple_operand (comp, &stmts, false, SSA_NAME_VAR (tgt));
- if (stmts)
- bsi_insert_before (&bsi, stmts, BSI_SAME_STMT);
+ op = force_gimple_operand_bsi (&bsi, comp, false, SSA_NAME_VAR (tgt),
+ true, BSI_SAME_STMT);
if (TREE_CODE (use->stmt) == PHI_NODE)
{
compare = iv_elimination_compare (data, use);
bound = unshare_expr (fold_convert (var_type, bound));
- op = force_gimple_operand_bsi (&bsi, bound, true, NULL_TREE);
+ op = force_gimple_operand_bsi (&bsi, bound, true, NULL_TREE,
+ true, BSI_SAME_STMT);
*use->op_p = build2 (compare, boolean_type_node, var, op);
return;
ok = extract_cond_operands (data, use->op_p, &var_p, NULL, NULL, NULL);
gcc_assert (ok);
- *var_p = force_gimple_operand_bsi (&bsi, comp, true, SSA_NAME_VAR (*var_p));
+ *var_p = force_gimple_operand_bsi (&bsi, comp, true, SSA_NAME_VAR (*var_p),
+ true, BSI_SAME_STMT);
}
/* Rewrites USE using candidate CAND. */
n_prefetches = ((unroll_factor + ref->prefetch_mod - 1)
/ ref->prefetch_mod);
addr_base = build_fold_addr_expr_with_type (ref->mem, ptr_type_node);
- addr_base = force_gimple_operand_bsi (&bsi, unshare_expr (addr_base), true, NULL);
+ addr_base = force_gimple_operand_bsi (&bsi, unshare_expr (addr_base),
+ true, NULL, true, BSI_SAME_STMT);
write_p = ref->write_p ? integer_one_node : integer_zero_node;
local = build_int_cst (integer_type_node, nontemporal ? 0 : 3);
delta = (ahead + ap * ref->prefetch_mod) * ref->group->step;
addr = fold_build2 (POINTER_PLUS_EXPR, ptr_type_node,
addr_base, size_int (delta));
- addr = force_gimple_operand_bsi (&bsi, unshare_expr (addr), true, NULL);
+ addr = force_gimple_operand_bsi (&bsi, unshare_expr (addr), true, NULL,
+ true, BSI_SAME_STMT);
/* Create the prefetch instruction. */
prefetch = build_call_expr (built_in_decls[BUILT_IN_PREFETCH],
tonegate = fold_build1 (NEGATE_EXPR, TREE_TYPE (tonegate), tonegate);
resultofnegate = force_gimple_operand_bsi (bsi, tonegate, true,
- NULL_TREE);
+ NULL_TREE, true, BSI_SAME_STMT);
VEC_safe_push (tree, heap, broken_up_subtracts, resultofnegate);
return resultofnegate;
tree evolution_part;
tree init_expr;
tree step_expr;
- tree var, stmt, ni, ni_name;
+ tree var, ni, ni_name;
block_stmt_iterator last_bsi;
if (vect_print_dump_info (REPORT_DETAILS))
var = create_tmp_var (TREE_TYPE (init_expr), "tmp");
add_referenced_var (var);
- ni_name = force_gimple_operand (ni, &stmt, false, var);
-
- /* Insert stmt into exit_bb. */
last_bsi = bsi_last (exit_bb);
- if (stmt)
- bsi_insert_before (&last_bsi, stmt, BSI_SAME_STMT);
-
+ ni_name = force_gimple_operand_bsi (&last_bsi, ni, false, var,
+ true, BSI_SAME_STMT);
+
/* Fix phi expressions in the successor bb. */
SET_PHI_ARG_DEF (phi1, update_e->dest_idx, ni_name);
}