Lines Matching defs:cand

135   struct iv_cand *cand;	/* The candidate.  */
474 dump_cand (FILE *file, struct iv_cand *cand)
476 struct iv *iv = cand->iv;
479 cand->id, cand->important ? " (important)" : "");
481 if (cand->depends_on)
484 dump_bitmap (file, cand->depends_on);
493 switch (cand->pos)
601 stmt_after_ip_original_pos (struct iv_cand *cand, tree stmt)
603 basic_block cand_bb = bb_for_stmt (cand->incremented_at);
617 if (bsi_stmt (bsi) == cand->incremented_at)
628 stmt_after_increment (struct loop *loop, struct iv_cand *cand, tree stmt)
630 switch (cand->pos)
639 return stmt_after_ip_original_pos (cand, stmt);
1981 struct iv_cand *cand = NULL;
1998 cand = iv_cand (data, i);
2000 if (cand->pos != pos)
2003 if (cand->incremented_at != incremented_at)
2006 if (!cand->iv)
2017 if (!operand_equal_p (base, cand->iv->base, 0))
2020 if (zero_p (cand->iv->step))
2027 if (step && operand_equal_p (step, cand->iv->step, 0))
2034 cand = XCNEW (struct iv_cand);
2035 cand->id = i;
2038 cand->iv = NULL;
2040 cand->iv = alloc_iv (base, step);
2042 cand->pos = pos;
2043 if (pos != IP_ORIGINAL && cand->iv)
2045 cand->var_before = create_tmp_var_raw (TREE_TYPE (base), "ivtmp");
2046 cand->var_after = cand->var_before;
2048 cand->important = important;
2049 cand->incremented_at = incremented_at;
2050 VEC_safe_push (iv_cand_p, heap, data->iv_candidates, cand);
2056 walk_tree (&step, find_depends, &cand->depends_on, NULL);
2060 dump_cand (dump_file, cand);
2063 if (important && !cand->important)
2065 cand->important = true;
2067 fprintf (dump_file, "Candidate %d is important\n", cand->id);
2075 cand->id, use->id);
2078 return cand;
2148 struct iv_cand *cand;
2163 cand = add_candidate_1 (data,
2166 cand->var_before = iv->ssa_name;
2167 cand->var_after = def;
2251 struct iv_cand *cand = iv_cand (data, i);
2253 if (cand->important)
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);
2360 if (!use->cost_map[i].cand)
2363 if (!use->cost_map[i].cand)
2369 use->cost_map[i].cand = cand;
2379 struct iv_cand *cand)
2384 if (!cand)
2389 ret = use->cost_map + cand->id;
2390 if (!ret->cand)
2397 s = cand->id & (use->n_map_members - 1);
2399 if (use->cost_map[i].cand == cand)
2403 if (use->cost_map[i].cand == cand)
2532 var_at_stmt (struct loop *loop, struct iv_cand *cand, tree stmt)
2534 if (stmt_after_increment (loop, cand, stmt))
2535 return cand->var_after;
2537 return cand->var_before;
3032 struct iv_use *use, struct iv_cand *cand, tree at,
3037 tree cbase = cand->iv->base;
3038 tree cstep = cand->iv->step;
3056 expr = var_at_stmt (loop, cand, at);
3124 if (stmt_after_increment (loop, cand, at))
3199 struct iv_use *use, struct iv_cand *cand, tree at)
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);
3847 struct iv_use *use, struct iv_cand *cand,
3861 if (!cand->iv)
3864 cbase = cand->iv->base;
3865 cstep = cand->iv->step;
3882 && cand->iv->base_object
3883 && !operand_equal_p (use->iv->base_object, cand->iv->base_object, 0))
3959 if (stmt_after_increment (data->current_loop, cand, at))
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)
4033 if (cand->pos == IP_ORIGINAL
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);
4077 cand_value_at (struct loop *loop, struct iv_cand *cand, tree at, tree niter)
4079 tree val = iv_value (cand->iv, niter);
4080 tree type = TREE_TYPE (cand->iv->base);
4082 if (stmt_after_increment (loop, cand, at))
4083 val = fold_build2 (PLUS_EXPR, type, val, cand->iv->step);
4133 struct iv_use *use, struct iv_cand *cand, tree *bound)
4141 if (TREE_CODE (cand->iv->step) != INTEGER_CST)
4168 period = iv_period (cand->iv);
4184 *bound = fold_affine_expr (cand_value_at (loop, cand, use->stmt, nit));
4192 struct iv_use *use, struct iv_cand *cand)
4199 if (!cand->iv)
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);
4232 set_use_iv_cost (data, use, cand, cost, depends_on, NULL);
4241 struct iv_use *use, struct iv_cand *cand)
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);
4266 struct iv_cand *cand;
4279 cand = iv_cand (data, j);
4280 determine_use_iv_cost (data, use, cand);
4289 cand = iv_cand (data, j);
4290 if (!determine_use_iv_cost (data, use, cand))
4312 fprintf (dump_file, " cand\tcost\tdepends on\n");
4315 if (!use->cost_map[j].cand
4320 use->cost_map[j].cand->id,
4337 determine_iv_cost (struct ivopts_data *data, struct iv_cand *cand)
4342 if (!cand->iv)
4344 cand->cost = 0;
4352 base = cand->iv->base;
4356 cand->cost = cost_step + cost_base / AVG_LOOP_NITER (current_loop);
4361 if (cand->pos == IP_ORIGINAL
4362 && !DECL_ARTIFICIAL (SSA_NAME_VAR (cand->var_before)))
4363 cand->cost--;
4367 if (cand->pos == IP_END
4369 cand->cost++;
4382 fprintf (dump_file, " cand\tcost\n");
4387 struct iv_cand *cand = iv_cand (data, i);
4389 determine_iv_cost (data, cand);
4392 fprintf (dump_file, " %d\t%d\n", i, cand->cost);
4501 if (a->cand->cost < b->cand->cost)
4552 cid = cp->cand->id;
4562 if (cp->cand->iv)
4565 ivs->cand_cost -= cp->cand->cost;
4567 iv_ca_set_remove_invariants (ivs, cp->cand->depends_on);
4611 cid = cp->cand->id;
4620 if (cp->cand->iv)
4623 ivs->cand_cost += cp->cand->cost;
4625 iv_ca_set_add_invariants (ivs, cp->cand->depends_on);
4788 iv_ca_cand_used_p (struct iv_ca *ivs, struct iv_cand *cand)
4790 return ivs->n_cand_uses[cand->id] > 0;
4878 struct iv_cand *cand, struct iv_ca_delta **delta,
4892 && old_cp->cand == cand)
4895 new_cp = get_use_iv_cost (data, use, cand);
4922 struct iv_cand *cand, struct iv_ca_delta **delta)
4937 if (old_cp->cand != cand)
4946 if (ci == cand->id)
4967 if (ci == cand->id)
5012 struct iv_cand *cand;
5019 cand = iv_cand (data, i);
5021 if (cand == except_cand)
5024 acost = iv_ca_narrow (data, ivs, cand, &act_delta);
5060 struct iv_cand *cand;
5084 cand = iv_cand (data, i);
5086 if (iv_ca_cand_used_p (ivs, cand))
5089 cp = get_use_iv_cost (data, use, cand);
5094 act_cost = iv_ca_extend (data, ivs, cand, &act_delta, NULL);
5114 cand = cp->cand;
5115 if (!cand)
5119 if (cand->important)
5122 if (iv_ca_cand_used_p (ivs, cand))
5127 act_cost = iv_ca_extend (data, ivs, cand, &act_delta, NULL);
5176 struct iv_cand *cand;
5181 cand = iv_cand (data, i);
5183 if (iv_ca_cand_used_p (ivs, cand))
5186 acost = iv_ca_extend (data, ivs, cand, &act_delta, &n_ivs);
5195 acost = iv_ca_prune (data, ivs, cand, &tmp_delta);
5267 use->selected = iv_ca_cand_for_use (set, use)->cand;
5276 create_new_iv (struct ivopts_data *data, struct iv_cand *cand)
5282 if (!cand->iv)
5285 switch (cand->pos)
5298 name_info (data, cand->var_before)->preserve_biv = true;
5299 name_info (data, cand->var_after)->preserve_biv = true;
5302 find_interesting_uses_op (data, cand->var_after)->selected = cand;
5307 gimple_add_tmp_var (cand->var_before);
5308 add_referenced_var (cand->var_before);
5310 base = unshare_expr (cand->iv->base);
5312 create_iv (base, unshare_expr (cand->iv->step),
5313 cand->var_before, data->current_loop,
5314 &incr_pos, after, &cand->var_before, &cand->var_after);
5323 struct iv_cand *cand;
5328 cand = iv_cand (data, i);
5329 create_new_iv (data, cand);
5361 struct iv_use *use, struct iv_cand *cand)
5371 if (cand->pos == IP_ORIGINAL
5372 && cand->incremented_at == use->stmt)
5378 gcc_assert (TREE_OPERAND (use->stmt, 0) == cand->var_after);
5380 step = cand->iv->step;
5382 utype = TREE_TYPE (cand->var_after);
5398 if (TREE_OPERAND (op, 0) == cand->var_before)
5401 && TREE_OPERAND (op, 1) == cand->var_before)
5416 op = fold_convert (ctype, cand->var_before);
5422 comp = get_computation (data->current_loop, use, cand);
5586 struct iv_use *use, struct iv_cand *cand)
5592 get_computation_aff (data->current_loop, use, cand, use->stmt, &aff);
5605 struct iv_use *use, struct iv_cand *cand)
5611 struct cost_pair *cp = get_use_iv_cost (data, use, cand);
5616 tree var = var_at_stmt (data->current_loop, cand, use->stmt);
5634 comp = get_computation (data->current_loop, use, cand);
5653 struct iv_use *use, struct iv_cand *cand)
5658 rewrite_use_nonlinear_expr (data, use, cand);
5662 rewrite_use_address (data, use, cand);
5666 rewrite_use_compare (data, use, cand);
5681 struct iv_cand *cand;
5687 cand = use->selected;
5688 gcc_assert (cand);
5690 rewrite_use (data, use, cand);
5758 struct iv_cand *cand = iv_cand (data, i);
5760 if (cand->iv)
5761 free (cand->iv);
5762 if (cand->depends_on)
5763 BITMAP_FREE (cand->depends_on);
5764 free (cand);