Lines Matching refs:use

44       -- The use costs.  Each of the interesting uses chooses the best induction
57 4) The trees are transformed to use the new variables, the dead code is
96 /* The expected number of loop iterations. TODO -- use profiling instead of
109 bool have_use_for; /* Do we already have a use for it? */
110 unsigned use_id; /* The identifier in the use if it is the case. */
147 unsigned id; /* The id of the use. */
148 enum use_type type; /* Type of the use. */
234 use. */
248 /* Candidate assigned to a use, together with the related costs. */
280 /* Changed use. */
281 struct iv_use *use;
323 /* Ith use recorded in DATA. */
412 dump_use (FILE *file, struct iv_use *use)
414 fprintf (file, "use %d\n", use->id);
416 switch (use->type)
435 print_generic_expr (file, use->stmt, TDF_SLIM);
439 if (use->op_p)
440 print_generic_expr (file, *use->op_p, TDF_SLIM);
443 dump_iv (file, use->iv);
445 if (use->related_cands)
448 dump_bitmap (file, use->related_cands);
459 struct iv_use *use;
463 use = iv_use (data, i);
465 dump_use (file, use);
1134 /* Records a use of type USE_TYPE at *USE_P in STMT whose value is IV. */
1140 struct iv_use *use = XCNEW (struct iv_use);
1142 use->id = n_iv_uses (data);
1143 use->type = use_type;
1144 use->iv = iv;
1145 use->stmt = stmt;
1146 use->op_p = use_p;
1147 use->related_cands = BITMAP_ALLOC (NULL);
1154 dump_use (dump_file, use);
1156 VEC_safe_push (iv_use_p, heap, data->iv_uses, use);
1158 return use;
1188 /* Checks whether the use OP is interesting and if so, records it. */
1196 struct iv_use *use;
1207 use = iv_use (data, iv->use_id);
1209 gcc_assert (use->type == USE_NONLINEAR_EXPR);
1210 return use;
1227 use = record_use (data, NULL, civ, stmt, USE_NONLINEAR_EXPR);
1228 iv->use_id = use->id;
1230 return use;
1420 /* Records use in index IDX. Callback for for_each_index. Ivopts data
1978 struct iv_use *use, tree incremented_at)
2070 if (use)
2072 bitmap_set_bit (use->related_cands, i);
2074 fprintf (dump_file, "Candidate %d is related to use %d\n",
2075 cand->id, use->id);
2108 tree base, tree step, bool important, struct iv_use *use)
2111 add_candidate_1 (data, base, step, important, IP_NORMAL, use, NULL_TREE);
2114 add_candidate_1 (data, base, step, important, IP_END, use, NULL_TREE);
2192 struct iv *iv, struct iv_use *use)
2197 add_candidate (data, iv->base, iv->step, false, use);
2203 iv->step, true, use);
2208 add_candidate (data, base, iv->step, false, use);
2220 struct iv_use *use = iv_use (data, i);
2222 if (!use)
2225 switch (use->type)
2231 add_iv_value_candidates (data, use->iv, use);
2247 struct iv_use *use;
2266 use = iv_use (data, i);
2267 BITMAP_FREE (use->related_cands);
2297 /* Allocates the data structure mapping the (use, candidate) pairs to costs.
2298 If consider_all_candidates is true, we use a two-dimensional array, otherwise
2299 we allocate a simple list to every use. */
2308 struct iv_use *use = iv_use (data, i);
2316 EXECUTE_IF_SET_IN_BITMAP (use->related_cands, 0, j, bi)
2326 use->n_map_members = size;
2327 use->cost_map = XCNEWVEC (struct cost_pair, size);
2337 struct iv_use *use, struct iv_cand *cand, unsigned cost,
2350 use->cost_map[cand->id].cand = cand;
2351 use->cost_map[cand->id].cost = cost;
2352 use->cost_map[cand->id].depends_on = depends_on;
2353 use->cost_map[cand->id].value = value;
2358 s = cand->id & (use->n_map_members - 1);
2359 for (i = s; i < use->n_map_members; i++)
2360 if (!use->cost_map[i].cand)
2363 if (!use->cost_map[i].cand)
2369 use->cost_map[i].cand = cand;
2370 use->cost_map[i].cost = cost;
2371 use->cost_map[i].depends_on = depends_on;
2372 use->cost_map[i].value = value;
2378 get_use_iv_cost (struct ivopts_data *data, struct iv_use *use,
2389 ret = use->cost_map + cand->id;
2397 s = cand->id & (use->n_map_members - 1);
2398 for (i = s; i < use->n_map_members; i++)
2399 if (use->cost_map[i].cand == cand)
2400 return use->cost_map + i;
2403 if (use->cost_map[i].cand == cand)
2404 return use->cost_map + i;
3032 struct iv_use *use, struct iv_cand *cand, tree at,
3035 tree ubase = use->iv->base;
3036 tree ustep = use->iv->step;
3052 /* We do not have a precision to express the values of use. */
3131 /* use = ubase - ratio * cbase + ratio * var.
3199 struct iv_use *use, struct iv_cand *cand, tree at)
3202 tree type = TREE_TYPE (use->iv->base);
3204 if (!get_computation_aff (loop, use, cand, at, &aff))
3214 get_computation (struct loop *loop, struct iv_use *use, struct iv_cand *cand)
3216 return get_computation_at (loop, use, cand, use->stmt);
3489 var is cheaper, use this mode with small penalty.
3492 if this is the case, use it. */
3847 struct iv_use *use, struct iv_cand *cand,
3850 tree ubase = use->iv->base, ustep = use->iv->step;
3870 /* We do not have a precision to express the values of use. */
3881 if (use->iv->base_object
3883 && !operand_equal_p (use->iv->base_object, cand->iv->base_object, 0))
3894 increment. If the step is not constant, we use zero instead.
3925 /* use = ubase + ratio * (var - cbase). If either cbase is a constant
3992 tree comp = get_computation_at (data->current_loop, use, cand, at);
4012 struct iv_use *use, struct iv_cand *cand,
4016 use, cand, address_p, depends_on, use->stmt);
4024 struct iv_use *use, struct iv_cand *cand)
4031 cost of increment twice -- once at this use and once in the cost of
4034 && cand->incremented_at == use->stmt)
4036 set_use_iv_cost (data, use, cand, 0, NULL, NULL_TREE);
4040 cost = get_computation_cost (data, use, cand, false, &depends_on);
4041 set_use_iv_cost (data, use, cand, cost, depends_on, NULL_TREE);
4050 struct iv_use *use, struct iv_cand *cand)
4053 unsigned cost = get_computation_cost (data, use, cand, true, &depends_on);
4055 set_use_iv_cost (data, use, cand, cost, depends_on, NULL_TREE);
4114 iv_elimination_compare (struct ivopts_data *data, struct iv_use *use)
4120 ex_bb = bb_for_stmt (use->stmt);
4133 struct iv_use *use, struct iv_cand *cand, tree *bound)
4146 ex_bb = bb_for_stmt (use->stmt);
4147 if (use->stmt != last_stmt (ex_bb)
4148 || TREE_CODE (use->stmt) != COND_EXPR)
4165 /* Determine whether we may use the variable to test whether niter iterations
4184 *bound = fold_affine_expr (cand_value_at (loop, cand, use->stmt, nit));
4192 struct iv_use *use, struct iv_cand *cand)
4201 set_use_iv_cost (data, use, cand, INFTY, NULL, NULL_TREE);
4205 if (may_eliminate_iv (data, use, cand, &bound))
4209 set_use_iv_cost (data, use, cand, cost, depends_on, bound);
4216 cost = get_computation_cost (data, use, cand, false, &depends_on);
4218 cond = *use->op_p;
4232 set_use_iv_cost (data, use, cand, cost, depends_on, NULL);
4241 struct iv_use *use, struct iv_cand *cand)
4243 switch (use->type)
4246 return determine_use_iv_cost_generic (data, use, cand);
4249 return determine_use_iv_cost_address (data, use, cand);
4252 return determine_use_iv_cost_condition (data, use, cand);
4259 /* Determines costs of basing the use of the iv on an iv candidate. */
4265 struct iv_use *use;
4273 use = iv_use (data, i);
4280 determine_use_iv_cost (data, use, cand);
4287 EXECUTE_IF_SET_IN_BITMAP (use->related_cands, 0, j, bi)
4290 if (!determine_use_iv_cost (data, use, cand))
4296 bitmap_and_compl_into (use->related_cands, to_clear);
4309 use = iv_use (data, i);
4313 for (j = 0; j < use->n_map_members; j++)
4315 if (!use->cost_map[j].cand
4316 || use->cost_map[j].cost == INFTY)
4320 use->cost_map[j].cand->id,
4321 use->cost_map[j].cost);
4322 if (use->cost_map[j].depends_on)
4324 use->cost_map[j].depends_on, "","");
4417 /* We use the following model (definitely improvable, especially the
4544 struct iv_use *use)
4546 unsigned uid = use->id, cid;
4599 struct iv_use *use, struct cost_pair *cp)
4601 unsigned uid = use->id, cid;
4607 iv_ca_set_no_cp (data, ivs, use);
4639 struct iv_use *use)
4645 gcc_assert (ivs->upto >= use->id);
4647 if (ivs->upto == use->id)
4655 cp = get_use_iv_cost (data, use, iv_cand (data, i));
4661 iv_ca_set_cp (data, ivs, use, best_cp);
4696 iv_ca_delta_add (struct iv_use *use, struct cost_pair *old_cp,
4701 change->use = use;
4733 iv_ca_cand_for_use (struct iv_ca *ivs, struct iv_use *use)
4735 return ivs->cand_for_use[use->id];
4777 gcc_assert (iv_ca_cand_for_use (ivs, act->use) == from);
4778 iv_ca_set_cp (data, ivs, act->use, to);
4872 /* Try changing candidate in IVS to CAND for each use. Return cost of the
4882 struct iv_use *use;
4888 use = iv_use (data, i);
4889 old_cp = iv_ca_cand_for_use (ivs, use);
4895 new_cp = get_use_iv_cost (data, use, cand);
4905 *delta = iv_ca_delta_add (use, old_cp, new_cp, *delta);
4925 struct iv_use *use;
4934 use = iv_use (data, i);
4936 old_cp = iv_ca_cand_for_use (ivs, use);
4951 cp = get_use_iv_cost (data, use, cnd);
4965 EXECUTE_IF_AND_IN_BITMAP (use->related_cands, ivs->cands, 0, ci, bi)
4972 cp = get_use_iv_cost (data, use, cnd);
4991 *delta = iv_ca_delta_add (use, old_cp, new_cp, *delta);
5055 struct iv_use *use)
5064 iv_ca_add_use (data, ivs, use);
5067 cp = iv_ca_cand_for_use (ivs, use);
5070 best_delta = iv_ca_delta_add (use, NULL, cp, NULL);
5071 iv_ca_set_no_cp (data, ivs, use);
5075 Rationale -- in loops with many variables the best choice often is to use
5080 ivs, replacing an expensive use by a specific iv should always be a
5089 cp = get_use_iv_cost (data, use, cand);
5093 iv_ca_set_cp (data, ivs, use, cp);
5095 iv_ca_set_no_cp (data, ivs, use);
5096 act_delta = iv_ca_delta_add (use, NULL, cp, act_delta);
5111 for (i = 0; i < use->n_map_members; i++)
5113 cp = use->cost_map + i;
5126 iv_ca_set_cp (data, ivs, use, cp);
5128 iv_ca_set_no_cp (data, ivs, use);
5129 act_delta = iv_ca_delta_add (use, iv_ca_cand_for_use (ivs, use),
5235 struct iv_use *use;
5266 use = iv_use (data, i);
5267 use->selected = iv_ca_cand_for_use (set, use)->cand;
5361 struct iv_use *use, struct iv_cand *cand)
5372 && cand->incremented_at == use->stmt)
5377 gcc_assert (TREE_CODE (use->stmt) == MODIFY_EXPR);
5378 gcc_assert (TREE_OPERAND (use->stmt, 0) == cand->var_after);
5394 op = TREE_OPERAND (use->stmt, 1);
5422 comp = get_computation (data->current_loop, use, cand);
5424 switch (TREE_CODE (use->stmt))
5427 tgt = PHI_RESULT (use->stmt);
5433 pbsi = bsi = bsi_start (bb_for_stmt (use->stmt));
5443 tgt = TREE_OPERAND (use->stmt, 0);
5444 bsi = bsi_for_stmt (use->stmt);
5453 if (TREE_CODE (use->stmt) == PHI_NODE)
5459 remove_statement (use->stmt, false);
5466 TREE_OPERAND (use->stmt, 1) = op;
5538 tag. If it does not have one, use its symbol memory tag. */
5586 struct iv_use *use, struct iv_cand *cand)
5589 block_stmt_iterator bsi = bsi_for_stmt (use->stmt);
5592 get_computation_aff (data->current_loop, use, cand, use->stmt, &aff);
5595 ref = create_mem_ref (&bsi, TREE_TYPE (*use->op_p), &aff);
5596 copy_ref_info (ref, *use->op_p);
5597 *use->op_p = ref;
5605 struct iv_use *use, struct iv_cand *cand)
5609 block_stmt_iterator bsi = bsi_for_stmt (use->stmt);
5611 struct cost_pair *cp = get_use_iv_cost (data, use, cand);
5616 tree var = var_at_stmt (data->current_loop, cand, use->stmt);
5619 compare = iv_elimination_compare (data, use);
5627 *use->op_p = build2 (compare, boolean_type_node, var, op);
5628 update_stmt (use->stmt);
5634 comp = get_computation (data->current_loop, use, cand);
5636 cond = *use->op_p;
5653 struct iv_use *use, struct iv_cand *cand)
5655 switch (use->type)
5658 rewrite_use_nonlinear_expr (data, use, cand);
5662 rewrite_use_address (data, use, cand);
5666 rewrite_use_compare (data, use, cand);
5672 mark_new_vars_to_rename (use->stmt);
5682 struct iv_use *use;
5686 use = iv_use (data, i);
5687 cand = use->selected;
5690 rewrite_use (data, use, cand);
5744 struct iv_use *use = iv_use (data, i);
5746 free (use->iv);
5747 BITMAP_FREE (use->related_cands);
5748 for (j = 0; j < use->n_map_members; j++)
5749 if (use->cost_map[j].depends_on)
5750 BITMAP_FREE (use->cost_map[j].depends_on);
5751 free (use->cost_map);
5752 free (use);