/* Now accumulate cost. */
loop_vinfo->scalar_costs = init_cost (loop_vinfo, true);
- stmt_info_for_cost *si;
- int j;
- FOR_EACH_VEC_ELT (LOOP_VINFO_SCALAR_ITERATION_COST (loop_vinfo),
- j, si)
- (void) add_stmt_cost (loop_vinfo->scalar_costs, si->count,
- si->kind, si->stmt_info, si->vectype,
- si->misalign, si->where);
+ add_stmt_costs (loop_vinfo->scalar_costs,
+ &LOOP_VINFO_SCALAR_ITERATION_COST (loop_vinfo));
loop_vinfo->scalar_costs->finish_cost (nullptr);
}
iterations are unknown, count a taken branch per peeled loop. */
if (peel_iters_prologue > 0)
retval = record_stmt_cost (prologue_cost_vec, 1, cond_branch_taken,
- NULL, NULL_TREE, 0, vect_prologue);
+ vect_prologue);
if (*peel_iters_epilogue > 0)
retval += record_stmt_cost (epilogue_cost_vec, 1, cond_branch_taken,
- NULL, NULL_TREE, 0, vect_epilogue);
+ vect_epilogue);
}
stmt_info_for_cost *si;
{
/* FIXME: Make cost depend on complexity of individual check. */
unsigned len = LOOP_VINFO_MAY_MISALIGN_STMTS (loop_vinfo).length ();
- (void) add_stmt_cost (target_cost_data, len, vector_stmt,
- NULL, NULL_TREE, 0, vect_prologue);
+ (void) add_stmt_cost (target_cost_data, len, scalar_stmt, vect_prologue);
if (dump_enabled_p ())
dump_printf (MSG_NOTE,
"cost model: Adding cost of checks for loop "
{
/* FIXME: Make cost depend on complexity of individual check. */
unsigned len = LOOP_VINFO_COMP_ALIAS_DDRS (loop_vinfo).length ();
- (void) add_stmt_cost (target_cost_data, len, vector_stmt,
- NULL, NULL_TREE, 0, vect_prologue);
+ (void) add_stmt_cost (target_cost_data, len, scalar_stmt, vect_prologue);
len = LOOP_VINFO_CHECK_UNEQUAL_ADDRS (loop_vinfo).length ();
if (len)
/* Count LEN - 1 ANDs and LEN comparisons. */
(void) add_stmt_cost (target_cost_data, len * 2 - 1,
- scalar_stmt, NULL, NULL_TREE, 0, vect_prologue);
+ scalar_stmt, vect_prologue);
len = LOOP_VINFO_LOWER_BOUNDS (loop_vinfo).length ();
if (len)
{
if (!LOOP_VINFO_LOWER_BOUNDS (loop_vinfo)[i].unsigned_p)
nstmts += 1;
(void) add_stmt_cost (target_cost_data, nstmts,
- scalar_stmt, NULL, NULL_TREE, 0, vect_prologue);
+ scalar_stmt, vect_prologue);
}
if (dump_enabled_p ())
dump_printf (MSG_NOTE,
if (LOOP_REQUIRES_VERSIONING (loop_vinfo))
(void) add_stmt_cost (target_cost_data, 1, cond_branch_taken,
- NULL, NULL_TREE, 0, vect_prologue);
+ vect_prologue);
/* Count statements in scalar loop. Using this as scalar cost for a single
iteration for now.
if (prologue_need_br_taken_cost)
(void) add_stmt_cost (target_cost_data, 1, cond_branch_taken,
- NULL, NULL_TREE, 0, vect_prologue);
+ vect_prologue);
if (prologue_need_br_not_taken_cost)
(void) add_stmt_cost (target_cost_data, 1,
- cond_branch_not_taken, NULL, NULL_TREE, 0,
- vect_prologue);
+ cond_branch_not_taken, vect_prologue);
if (epilogue_need_br_taken_cost)
(void) add_stmt_cost (target_cost_data, 1, cond_branch_taken,
- NULL, NULL_TREE, 0, vect_epilogue);
+ vect_epilogue);
if (epilogue_need_br_not_taken_cost)
(void) add_stmt_cost (target_cost_data, 1,
- cond_branch_not_taken, NULL, NULL_TREE, 0,
- vect_epilogue);
+ cond_branch_not_taken, vect_epilogue);
/* Take care of special costs for rgroup controls of partial vectors. */
if (LOOP_VINFO_FULLY_MASKED_P (loop_vinfo))
}
(void) add_stmt_cost (target_cost_data, prologue_stmts,
- scalar_stmt, NULL, NULL_TREE, 0, vect_prologue);
+ scalar_stmt, vect_prologue);
(void) add_stmt_cost (target_cost_data, body_stmts,
- scalar_stmt, NULL, NULL_TREE, 0, vect_body);
+ scalar_stmt, vect_body);
}
/* FORNOW: The scalar outside cost is incremented in one of the
return cost;
}
+static inline unsigned
+add_stmt_cost (vector_costs *costs, int count, enum vect_cost_for_stmt kind,
+ enum vect_cost_model_location where)
+{
+ gcc_assert (kind == cond_branch_taken || kind == cond_branch_not_taken
+ || kind == scalar_stmt);
+ return add_stmt_cost (costs, count, kind, NULL, NULL_TREE, 0, where);
+}
+
/* Alias targetm.vectorize.add_stmt_cost. */
static inline unsigned
extern unsigned record_stmt_cost (stmt_vector_for_cost *, int,
enum vect_cost_for_stmt, stmt_vec_info,
tree, int, enum vect_cost_model_location);
+extern unsigned record_stmt_cost (stmt_vector_for_cost *, int,
+ enum vect_cost_for_stmt,
+ enum vect_cost_model_location);
/* Overload of record_stmt_cost with VECTYPE derived from STMT_INFO. */