element(s) to PARTS. */
static void
-most_expensive_mult_to_index (struct mem_address *parts, aff_tree *addr)
+most_expensive_mult_to_index (struct mem_address *parts, aff_tree *addr,
+ bool speed)
{
HOST_WIDE_INT coef;
double_int best_mult, amult, amult_neg;
|| !multiplier_allowed_in_address_p (coef, Pmode))
continue;
- acost = multiply_by_cost (coef, Pmode);
+ acost = multiply_by_cost (coef, Pmode, speed);
if (acost > best_mult_cost)
{
addressing modes is useless. */
static void
-addr_to_parts (aff_tree *addr, struct mem_address *parts)
+addr_to_parts (aff_tree *addr, struct mem_address *parts, bool speed)
{
tree part;
unsigned i;
/* First move the most expensive feasible multiplication
to index. */
- most_expensive_mult_to_index (parts, addr);
+ most_expensive_mult_to_index (parts, addr, speed);
/* Try to find a base of the reference. Since at the moment
there is no reliable way how to distinguish between pointer and its
of created memory reference. */
tree
-create_mem_ref (gimple_stmt_iterator *gsi, tree type, aff_tree *addr)
+create_mem_ref (gimple_stmt_iterator *gsi, tree type, aff_tree *addr,
+ bool speed)
{
tree mem_ref, tmp;
tree atype;
struct mem_address parts;
- addr_to_parts (addr, &parts);
+ addr_to_parts (addr, &parts, speed);
gimplify_mem_ref_parts (gsi, &parts);
mem_ref = create_mem_ref_raw (type, &parts);
if (mem_ref)
{
atype = TREE_TYPE (tmp);
parts.base = force_gimple_operand_gsi (gsi,
- fold_build2 (PLUS_EXPR, atype,
- fold_convert (atype, parts.base),
- tmp),
+ fold_build2 (POINTER_PLUS_EXPR, atype,
+ tmp,
+ fold_convert (sizetype, parts.base)),
true, NULL_TREE, true, GSI_SAME_STMT);
}
else