Lines Matching refs:iv

23    doloop optimization and branch prediction.  The iv information is computed
33 iv_analysis_loop_init for it. When you no longer need iv analysis, call
38 iv_analyze (insn, reg, iv): Stores the description of the induction variable
43 iv_analyze_result (insn, def, iv): Stores to IV the description of the iv
45 iv_analyze_expr (insn, rhs, mode, iv): Stores to IV the description of iv
49 by iv analysis. */
92 struct rtx_iv iv; /* Value of the biv. */
124 dump_iv_info (FILE *file, struct rtx_iv *iv)
126 if (!iv->base)
132 if (iv->step == const0_rtx
133 && !iv->first_special)
136 print_rtl (file, iv->base);
137 if (iv->step != const0_rtx)
140 print_rtl (file, iv->step);
143 fprintf (file, " (in %s)", GET_MODE_NAME (iv->mode));
145 if (iv->mode != iv->extend_mode)
147 rtx_name[iv->extend],
148 GET_MODE_NAME (iv->extend_mode));
150 if (iv->mult != const1_rtx)
153 print_rtl (file, iv->mult);
155 if (iv->delta != const0_rtx)
158 print_rtl (file, iv->delta);
160 if (iv->first_special)
208 struct rtx_iv *iv;
214 iv = DF_REF_IV (def);
215 if (!iv)
217 free (iv);
358 consistency with other iv manipulation functions that may fail). */
361 iv_constant (struct rtx_iv *iv, rtx cst, enum machine_mode mode)
366 iv->mode = mode;
367 iv->base = cst;
368 iv->step = const0_rtx;
369 iv->first_special = false;
370 iv->extend = UNKNOWN;
371 iv->extend_mode = iv->mode;
372 iv->delta = const0_rtx;
373 iv->mult = const1_rtx;
381 iv_subreg (struct rtx_iv *iv, enum machine_mode mode)
383 /* If iv is invariant, just calculate the new value. */
384 if (iv->step == const0_rtx
385 && !iv->first_special)
387 rtx val = get_iv_value (iv, const0_rtx);
388 val = lowpart_subreg (mode, val, iv->extend_mode);
390 iv->base = val;
391 iv->extend = UNKNOWN;
392 iv->mode = iv->extend_mode = mode;
393 iv->delta = const0_rtx;
394 iv->mult = const1_rtx;
398 if (iv->extend_mode == mode)
401 if (GET_MODE_BITSIZE (mode) > GET_MODE_BITSIZE (iv->mode))
404 iv->extend = UNKNOWN;
405 iv->mode = mode;
407 iv->base = simplify_gen_binary (PLUS, iv->extend_mode, iv->delta,
408 simplify_gen_binary (MULT, iv->extend_mode,
409 iv->base, iv->mult));
410 iv->step = simplify_gen_binary (MULT, iv->extend_mode, iv->step, iv->mult);
411 iv->mult = const1_rtx;
412 iv->delta = const0_rtx;
413 iv->first_special = false;
421 iv_extend (struct rtx_iv *iv, enum rtx_code extend, enum machine_mode mode)
423 /* If iv is invariant, just calculate the new value. */
424 if (iv->step == const0_rtx
425 && !iv->first_special)
427 rtx val = get_iv_value (iv, const0_rtx);
428 val = simplify_gen_unary (extend, mode, val, iv->extend_mode);
430 iv->base = val;
431 iv->extend = UNKNOWN;
432 iv->mode = iv->extend_mode = mode;
433 iv->delta = const0_rtx;
434 iv->mult = const1_rtx;
438 if (mode != iv->extend_mode)
441 if (iv->extend != UNKNOWN
442 && iv->extend != extend)
445 iv->extend = extend;
453 iv_neg (struct rtx_iv *iv)
455 if (iv->extend == UNKNOWN)
457 iv->base = simplify_gen_unary (NEG, iv->extend_mode,
458 iv->base, iv->extend_mode);
459 iv->step = simplify_gen_unary (NEG, iv->extend_mode,
460 iv->step, iv->extend_mode);
464 iv->delta = simplify_gen_unary (NEG, iv->extend_mode,
465 iv->delta, iv->extend_mode);
466 iv->mult = simplify_gen_unary (NEG, iv->extend_mode,
467 iv->mult, iv->extend_mode);
545 iv_mult (struct rtx_iv *iv, rtx mby)
547 enum machine_mode mode = iv->extend_mode;
553 if (iv->extend == UNKNOWN)
555 iv->base = simplify_gen_binary (MULT, mode, iv->base, mby);
556 iv->step = simplify_gen_binary (MULT, mode, iv->step, mby);
560 iv->delta = simplify_gen_binary (MULT, mode, iv->delta, mby);
561 iv->mult = simplify_gen_binary (MULT, mode, iv->mult, mby);
570 iv_shift (struct rtx_iv *iv, rtx mby)
572 enum machine_mode mode = iv->extend_mode;
578 if (iv->extend == UNKNOWN)
580 iv->base = simplify_gen_binary (ASHIFT, mode, iv->base, mby);
581 iv->step = simplify_gen_binary (ASHIFT, mode, iv->step, mby);
585 iv->delta = simplify_gen_binary (ASHIFT, mode, iv->delta, mby);
586 iv->mult = simplify_gen_binary (ASHIFT, mode, iv->mult, mby);
784 record_iv (struct df_ref *def, struct rtx_iv *iv)
788 *recorded_iv = *iv;
796 analyzed_for_bivness_p (rtx def, struct rtx_iv *iv)
803 *iv = biv->iv;
808 record_biv (rtx def, struct rtx_iv *iv)
814 biv->iv = *iv;
823 iv_analyze_biv (rtx def, struct rtx_iv *iv)
842 return iv_constant (iv, def, VOIDmode);
853 return iv_constant (iv, def, VOIDmode);
855 if (analyzed_for_bivness_p (def, iv))
859 return iv->base != NULL_RTX;
865 iv->base = NULL_RTX;
875 iv->base = simplify_gen_binary (MINUS, outer_mode, def, outer_step);
876 iv->step = simplify_gen_binary (PLUS, outer_mode, inner_step, outer_step);
877 iv->mode = inner_mode;
878 iv->extend_mode = outer_mode;
879 iv->extend = extend;
880 iv->mult = const1_rtx;
881 iv->delta = outer_step;
882 iv->first_special = inner_mode != outer_mode;
888 dump_iv_info (dump_file, iv);
892 record_biv (def, iv);
893 return iv->base != NULL_RTX;
900 iv_analyze_expr (rtx insn, rtx rhs, enum machine_mode mode, struct rtx_iv *iv)
908 iv->mode = VOIDmode;
909 iv->base = NULL_RTX;
910 iv->step = NULL_RTX;
918 if (!iv_analyze_op (insn, rhs, iv))
921 if (iv->mode == VOIDmode)
923 iv->mode = mode;
924 iv->extend_mode = mode;
1014 *iv = iv0;
1015 return iv->base != NULL_RTX;
1018 /* Analyzes iv DEF and stores the result to *IV. */
1021 iv_analyze_def (struct df_ref *def, struct rtx_iv *iv)
1039 *iv = *DF_REF_IV (def);
1040 return iv->base != NULL_RTX;
1043 iv->mode = VOIDmode;
1044 iv->base = NULL_RTX;
1045 iv->step = NULL_RTX;
1057 iv_analyze_expr (insn, rhs, GET_MODE (reg), iv);
1058 record_iv (def, iv);
1066 dump_iv_info (dump_file, iv);
1070 return iv->base != NULL_RTX;
1076 iv_analyze_op (rtx insn, rtx op, struct rtx_iv *iv)
1096 if (!iv_analyze_op (insn, SUBREG_REG (op), iv))
1099 return iv_subreg (iv, GET_MODE (op));
1114 iv_constant (iv, op, VOIDmode);
1119 dump_iv_info (dump_file, iv);
1126 return iv_analyze_biv (op, iv);
1128 return iv_analyze_def (def, iv);
1134 iv_analyze (rtx insn, rtx val, struct rtx_iv *iv)
1153 return iv_analyze_op (insn, val, iv);
1159 iv_analyze_result (rtx insn, rtx def, struct rtx_iv *iv)
1167 return iv_analyze_def (adef, iv);
1177 struct rtx_iv iv;
1190 if (!iv_analyze_biv (reg, &iv))
1193 return iv.step != const0_rtx;
1199 get_iv_value (struct rtx_iv *iv, rtx iteration)
1205 gcc_assert (!iv->first_special);
1207 if (iv->step != const0_rtx && iteration != const0_rtx)
1208 val = simplify_gen_binary (PLUS, iv->extend_mode, iv->base,
1209 simplify_gen_binary (MULT, iv->extend_mode,
1210 iv->step, iteration));
1212 val = iv->base;
1214 if (iv->extend_mode == iv->mode)
1217 val = lowpart_subreg (iv->mode, val, iv->extend_mode);
1219 if (iv->extend == UNKNOWN)
1222 val = simplify_gen_unary (iv->extend, iv->extend_mode, val, iv->mode);
1223 val = simplify_gen_binary (PLUS, iv->extend_mode, iv->delta,
1224 simplify_gen_binary (MULT, iv->extend_mode,
1225 iv->mult, val));
1815 shorten_into_mode (struct rtx_iv *iv, enum machine_mode mode,
1820 get_mode_bounds (mode, signed_p, iv->extend_mode, &mmin, &mmax);
1821 cond_under = simplify_gen_relational (LT, SImode, iv->extend_mode,
1822 iv->base, mmin);
1823 cond_over = simplify_gen_relational (GT, SImode, iv->extend_mode,
1824 iv->base, mmax);
1865 iv->mode = mode;
1866 iv->extend = signed_p ? SIGN_EXTEND : ZERO_EXTEND;