diff options
Diffstat (limited to 'gcc/loop-iv.c')
-rw-r--r-- | gcc/loop-iv.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/loop-iv.c b/gcc/loop-iv.c index a7c43e31508..ed06d1dbb1e 100644 --- a/gcc/loop-iv.c +++ b/gcc/loop-iv.c @@ -1183,6 +1183,24 @@ iv_analyze (rtx insn, rtx def, struct rtx_iv *iv) return iv->base != NULL_RTX; } +/* Checks whether definition of register REG in INSN a basic induction + variable. IV analysis must have been initialized (via a call to + iv_analysis_loop_init) for this function to produce a result. */ + +bool +biv_p (rtx insn, rtx reg) +{ + struct rtx_iv iv; + + if (!REG_P (reg)) + return false; + + if (last_def[REGNO (reg)] != insn) + return false; + + return iv_analyze_biv (reg, &iv); +} + /* Calculates value of IV at ITERATION-th iteration. */ rtx |