Commit a2be868f by Michael Hayes Committed by Michael Hayes

loop.c (this_loop_info): Delete.

	* loop.c (this_loop_info): Delete.
	(uid_loop): Add in place of uid_loop_num.  All uses updated.
 	(loop_number_exit_count): Delete and replace with entry in loop
	structure.  All uses updated.
	(loop_number_loop_starts, loop_number_loop_ends): Likewise.
	(loop_number_loop_cont, loop_number_cont_dominator): Likewise.
	(loop_outer_loop): Likewise.
	(loop_invalid, loop_number_exit_labels): Likewise.
	(loop_used_count_register): Delete and replace with entry in
	loop_info structure.
	(find_and_verify_loops): Add loops argument.
	(verify_dominator, mark_loop_jump, prescan_loop): Replace loop_start,
	loop_end, etc. arguments with loop structure pointer.  All callers
	changed.
	(loop_reg_used_before_p, scan_loop, strength_reduce): Likewise.
	(check_dbra_loop, next_insn_in_loop, try_copy_prop): Likewise.
	(load_mems_and_recount_loop_regs_set, load_mems): Likewise.
	(insert_bct): Likewise.
	(basic_induction_var): New argument level.
	* loop.h (struct loop_info): Delete fields num, loops_enclosed,
	vtop, and cont.  Add used_count_register.
	(uid_loop): Delete declaration.
 	(loop_number_exit_count): Likewise.
	(loop_number_loop_starts, loop_number_loop_ends): Likewise.
	(loop_number_loop_cont, loop_number_cont_dominator): Likewise.
	(loop_outer_loop, loop_used_count_register): Likewise.
	(loop_invalid, loop_number_exit_labels): Likewise.
	(unroll_loop): Replace loop_start and loop_end arguments
 	with loop structure pointer.
	(loop_precondition_p, loop_iterations): Likewise.
	Include basic-block.h.
	* unroll.c: (unroll_loop): Replace loop_start and loop_end arguments
 	with loop structure pointer.
	(loop_precondition_p, loop_iterations): Likewise.
	* basic-block.h (struct loop): New entries vtop, cont,
 	cont_dominator, start, end, top, scan_start, exit_labels,
	exit_count.
	* Makefile.in (LOOP_H): Add basic-block.h to dependencies.

From-SVN: r31434
parent d07ecc3b
2000-01-15 Michael Hayes <m.hayes@elec.canterbury.ac.nz>
* loop.c (this_loop_info): Delete.
(uid_loop): Add in place of uid_loop_num. All uses updated.
(loop_number_exit_count): Delete and replace with entry in loop
structure. All uses updated.
(loop_number_loop_starts, loop_number_loop_ends): Likewise.
(loop_number_loop_cont, loop_number_cont_dominator): Likewise.
(loop_outer_loop): Likewise.
(loop_invalid, loop_number_exit_labels): Likewise.
(loop_used_count_register): Delete and replace with entry in
loop_info structure.
(find_and_verify_loops): Add loops argument.
(verify_dominator, mark_loop_jump, prescan_loop): Replace loop_start,
loop_end, etc. arguments with loop structure pointer. All callers
changed.
(loop_reg_used_before_p, scan_loop, strength_reduce): Likewise.
(check_dbra_loop, next_insn_in_loop, try_copy_prop): Likewise.
(load_mems_and_recount_loop_regs_set, load_mems): Likewise.
(insert_bct): Likewise.
(basic_induction_var): New argument level.
* loop.h (struct loop_info): Delete fields num, loops_enclosed,
vtop, and cont. Add used_count_register.
(uid_loop): Delete declaration.
(loop_number_exit_count): Likewise.
(loop_number_loop_starts, loop_number_loop_ends): Likewise.
(loop_number_loop_cont, loop_number_cont_dominator): Likewise.
(loop_outer_loop, loop_used_count_register): Likewise.
(loop_invalid, loop_number_exit_labels): Likewise.
(unroll_loop): Replace loop_start and loop_end arguments
with loop structure pointer.
(loop_precondition_p, loop_iterations): Likewise.
Include basic-block.h.
* unroll.c: (unroll_loop): Replace loop_start and loop_end arguments
with loop structure pointer.
(loop_precondition_p, loop_iterations): Likewise.
* basic-block.h (struct loop): New entries vtop, cont,
cont_dominator, start, end, top, scan_start, exit_labels,
exit_count.
* Makefile.in (LOOP_H): Add basic-block.h to dependencies.
2000-01-15 Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at> 2000-01-15 Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
* defaults.h (ASM_OUTPUT_ASCII): Use ISDIGIT. * defaults.h (ASM_OUTPUT_ASCII): Use ISDIGIT.
......
...@@ -756,7 +756,7 @@ RECOG_H = recog.h ...@@ -756,7 +756,7 @@ RECOG_H = recog.h
EXPR_H = expr.h insn-codes.h EXPR_H = expr.h insn-codes.h
REGS_H = regs.h varray.h $(MACHMODE_H) REGS_H = regs.h varray.h $(MACHMODE_H)
INTEGRATE_H = integrate.h varray.h INTEGRATE_H = integrate.h varray.h
LOOP_H = loop.h varray.h LOOP_H = loop.h varray.h basic-block.h
# #
# Language makefile fragments. # Language makefile fragments.
......
...@@ -275,6 +275,47 @@ struct loop ...@@ -275,6 +275,47 @@ struct loop
/* Auxiliary info specific to a pass. */ /* Auxiliary info specific to a pass. */
void *info; void *info;
/* The following are currently used by loop.c but they are likely to
disappear as loop.c is converted to use the CFG. */
/* Non-zero if the loop has a NOTE_INSN_LOOP_VTOP. */
rtx vtop;
/* Non-zero if the loop has a NOTE_INSN_LOOP_CONT.
A continue statement will generate a branch to NEXT_INSN (cont). */
rtx cont;
/* The dominator of cont. */
rtx cont_dominator;
/* The NOTE_INSN_LOOP_BEG. */
rtx start;
/* The NOTE_INSN_LOOP_END. */
rtx end;
/* For a rotated loop that is entered near the bottom,
this is the label at the top. Otherwise it is zero. */
rtx top;
/* Place in the loop where control enters. */
rtx scan_start;
/* List of all LABEL_REFs which refer to code labels outside the
loop. Used by routines that need to know all loop exits, such as
final_biv_value and final_giv_value.
This does not include loop exits due to return instructions.
This is because all bivs and givs are pseudos, and hence must be
dead after a return, so the presense of a return does not affect
any of the optimizations that use this info. It is simpler to
just not include return instructions on this list. */
rtx exit_labels;
/* The number of LABEL_REFs on exit_labels for this loop and all
loops nested inside it. */
int exit_count;
}; };
......
...@@ -19,6 +19,7 @@ the Free Software Foundation, 59 Temple Place - Suite 330, ...@@ -19,6 +19,7 @@ the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#include "varray.h" #include "varray.h"
#include "basic-block.h"
/* Get the luid of an insn. Catch the error of trying to reference the LUID /* Get the luid of an insn. Catch the error of trying to reference the LUID
of an insn added during loop, since these don't have LUIDs. */ of an insn added during loop, since these don't have LUIDs. */
...@@ -159,10 +160,6 @@ struct iv_class { ...@@ -159,10 +160,6 @@ struct iv_class {
struct loop_info struct loop_info
{ {
/* Loop number. */
int num;
/* Loops enclosed by this loop including itself. */
int loops_enclosed;
/* Nonzero if there is a subroutine call in the current loop. */ /* Nonzero if there is a subroutine call in the current loop. */
int has_call; int has_call;
/* Nonzero if there is a volatile memory reference in the current /* Nonzero if there is a volatile memory reference in the current
...@@ -200,11 +197,7 @@ struct loop_info ...@@ -200,11 +197,7 @@ struct loop_info
unsigned HOST_WIDE_INT n_iterations; unsigned HOST_WIDE_INT n_iterations;
/* The number of times the loop body was unrolled. */ /* The number of times the loop body was unrolled. */
unsigned int unroll_number; unsigned int unroll_number;
/* Non-zero if the loop has a NOTE_INSN_LOOP_VTOP. */ int used_count_register;
rtx vtop;
/* Non-zero if the loop has a NOTE_INSN_LOOP_CONT.
A continue statement will generate a branch to NEXT_INSN (cont). */
rtx cont;
}; };
/* Definitions used by the basic induction variable discovery code. */ /* Definitions used by the basic induction variable discovery code. */
...@@ -215,12 +208,8 @@ enum iv_mode { UNKNOWN_INDUCT, BASIC_INDUCT, NOT_BASIC_INDUCT, ...@@ -215,12 +208,8 @@ enum iv_mode { UNKNOWN_INDUCT, BASIC_INDUCT, NOT_BASIC_INDUCT,
extern int *uid_luid; extern int *uid_luid;
extern int max_uid_for_loop; extern int max_uid_for_loop;
extern int *uid_loop_num;
extern int *loop_outer_loop;
extern rtx *loop_number_exit_labels;
extern int *loop_number_exit_count;
extern int max_reg_before_loop; extern int max_reg_before_loop;
extern struct loop **uid_loop;
extern FILE *loop_dump_stream; extern FILE *loop_dump_stream;
extern varray_type reg_iv_type; extern varray_type reg_iv_type;
...@@ -243,9 +232,9 @@ rtx get_condition_for_loop PROTO((rtx)); ...@@ -243,9 +232,9 @@ rtx get_condition_for_loop PROTO((rtx));
void emit_iv_add_mult PROTO((rtx, rtx, rtx, rtx, rtx)); void emit_iv_add_mult PROTO((rtx, rtx, rtx, rtx, rtx));
rtx express_from PROTO((struct induction *, struct induction *)); rtx express_from PROTO((struct induction *, struct induction *));
void unroll_loop PROTO((rtx, int, rtx, rtx, struct loop_info *, int)); void unroll_loop PROTO((struct loop *, int, rtx, int));
rtx biv_total_increment PROTO((struct iv_class *, rtx, rtx)); rtx biv_total_increment PROTO((struct iv_class *, rtx, rtx));
unsigned HOST_WIDE_INT loop_iterations PROTO((rtx, rtx, struct loop_info *)); unsigned HOST_WIDE_INT loop_iterations PROTO((struct loop *));
int precondition_loop_p PROTO((rtx, struct loop_info *, int precondition_loop_p PROTO((rtx, struct loop_info *,
rtx *, rtx *, rtx *, rtx *, rtx *, rtx *,
enum machine_mode *mode)); enum machine_mode *mode));
...@@ -261,4 +250,3 @@ int loop_insn_first_p PROTO((rtx, rtx)); ...@@ -261,4 +250,3 @@ int loop_insn_first_p PROTO((rtx, rtx));
/* Forward declarations for non-static functions declared in stmt.c. */ /* Forward declarations for non-static functions declared in stmt.c. */
void find_loop_tree_blocks PROTO((void)); void find_loop_tree_blocks PROTO((void));
void unroll_block_trees PROTO((void)); void unroll_block_trees PROTO((void));
...@@ -225,13 +225,10 @@ static rtx loop_find_equiv_value PROTO((rtx, rtx)); ...@@ -225,13 +225,10 @@ static rtx loop_find_equiv_value PROTO((rtx, rtx));
in loop.c. */ in loop.c. */
void void
unroll_loop (loop_end, insn_count, loop_start, end_insert_before, unroll_loop (loop, insn_count, end_insert_before, strength_reduce_p)
loop_info, strength_reduce_p) struct loop *loop;
rtx loop_end;
int insn_count; int insn_count;
rtx loop_start;
rtx end_insert_before; rtx end_insert_before;
struct loop_info *loop_info;
int strength_reduce_p; int strength_reduce_p;
{ {
int i, j; int i, j;
...@@ -257,6 +254,9 @@ unroll_loop (loop_end, insn_count, loop_start, end_insert_before, ...@@ -257,6 +254,9 @@ unroll_loop (loop_end, insn_count, loop_start, end_insert_before,
a JUMP_INSN (for conditional jumps) or a BARRIER (for unconditional a JUMP_INSN (for conditional jumps) or a BARRIER (for unconditional
jumps). */ jumps). */
rtx last_loop_insn; rtx last_loop_insn;
rtx loop_start = loop->start;
rtx loop_end = loop->end;
struct loop_info *loop_info = loop->info;
/* Don't bother unrolling huge loops. Since the minimum factor is /* Don't bother unrolling huge loops. Since the minimum factor is
two, loops greater than one half of MAX_UNROLLED_INSNS will never two, loops greater than one half of MAX_UNROLLED_INSNS will never
...@@ -370,10 +370,10 @@ unroll_loop (loop_end, insn_count, loop_start, end_insert_before, ...@@ -370,10 +370,10 @@ unroll_loop (loop_end, insn_count, loop_start, end_insert_before,
} }
/* Remove the loop notes since this is no longer a loop. */ /* Remove the loop notes since this is no longer a loop. */
if (loop_info->vtop) if (loop->vtop)
delete_insn (loop_info->vtop); delete_insn (loop->vtop);
if (loop_info->cont) if (loop->cont)
delete_insn (loop_info->cont); delete_insn (loop->cont);
if (loop_start) if (loop_start)
delete_insn (loop_start); delete_insn (loop_start);
if (loop_end) if (loop_end)
...@@ -1310,10 +1310,10 @@ unroll_loop (loop_end, insn_count, loop_start, end_insert_before, ...@@ -1310,10 +1310,10 @@ unroll_loop (loop_end, insn_count, loop_start, end_insert_before,
if (unroll_type == UNROLL_COMPLETELY) if (unroll_type == UNROLL_COMPLETELY)
{ {
/* Remove the loop notes since this is no longer a loop. */ /* Remove the loop notes since this is no longer a loop. */
if (loop_info->vtop) if (loop->vtop)
delete_insn (loop_info->vtop); delete_insn (loop->vtop);
if (loop_info->cont) if (loop->cont)
delete_insn (loop_info->cont); delete_insn (loop->cont);
if (loop_start) if (loop_start)
delete_insn (loop_start); delete_insn (loop_start);
if (loop_end) if (loop_end)
...@@ -2600,7 +2600,7 @@ find_splittable_regs (unroll_type, loop_start, loop_end, end_insert_before, ...@@ -2600,7 +2600,7 @@ find_splittable_regs (unroll_type, loop_start, loop_end, end_insert_before,
biv_splittable = 1; biv_splittable = 1;
biv_final_value = 0; biv_final_value = 0;
if (unroll_type != UNROLL_COMPLETELY if (unroll_type != UNROLL_COMPLETELY
&& (loop_number_exit_count[uid_loop_num[INSN_UID (loop_start)]] && (uid_loop[INSN_UID (loop_start)]->exit_count
|| unroll_type == UNROLL_NAIVE) || unroll_type == UNROLL_NAIVE)
&& (uid_luid[REGNO_LAST_UID (bl->regno)] >= INSN_LUID (loop_end) && (uid_luid[REGNO_LAST_UID (bl->regno)] >= INSN_LUID (loop_end)
|| ! bl->init_insn || ! bl->init_insn
...@@ -2690,7 +2690,7 @@ find_splittable_regs (unroll_type, loop_start, loop_end, end_insert_before, ...@@ -2690,7 +2690,7 @@ find_splittable_regs (unroll_type, loop_start, loop_end, end_insert_before,
loop to ensure that it will always be executed no matter loop to ensure that it will always be executed no matter
how the loop exits. Otherwise emit the insn after the loop, how the loop exits. Otherwise emit the insn after the loop,
since this is slightly more efficient. */ since this is slightly more efficient. */
if (! loop_number_exit_count[uid_loop_num[INSN_UID (loop_start)]]) if (! uid_loop[INSN_UID (loop_start)]->exit_count)
emit_insn_before (gen_move_insn (bl->biv->src_reg, emit_insn_before (gen_move_insn (bl->biv->src_reg,
biv_final_value), biv_final_value),
end_insert_before); end_insert_before);
...@@ -2817,7 +2817,7 @@ find_splittable_givs (bl, unroll_type, loop_start, loop_end, increment, ...@@ -2817,7 +2817,7 @@ find_splittable_givs (bl, unroll_type, loop_start, loop_end, increment,
final_value = 0; final_value = 0;
if (unroll_type != UNROLL_COMPLETELY if (unroll_type != UNROLL_COMPLETELY
&& (loop_number_exit_count[uid_loop_num[INSN_UID (loop_start)]] && (uid_loop[INSN_UID (loop_start)]->exit_count
|| unroll_type == UNROLL_NAIVE) || unroll_type == UNROLL_NAIVE)
&& v->giv_type != DEST_ADDR && v->giv_type != DEST_ADDR
/* The next part is true if the pseudo is used outside the loop. /* The next part is true if the pseudo is used outside the loop.
...@@ -3245,25 +3245,24 @@ reg_dead_after_loop (reg, loop_start, loop_end) ...@@ -3245,25 +3245,24 @@ reg_dead_after_loop (reg, loop_start, loop_end)
enum rtx_code code; enum rtx_code code;
int jump_count = 0; int jump_count = 0;
int label_count = 0; int label_count = 0;
int this_loop_num = uid_loop_num[INSN_UID (loop_start)]; struct loop *loop = uid_loop[INSN_UID (loop_start)];
/* In addition to checking all exits of this loop, we must also check /* In addition to checking all exits of this loop, we must also check
all exits of inner nested loops that would exit this loop. We don't all exits of inner nested loops that would exit this loop. We don't
have any way to identify those, so we just give up if there are any have any way to identify those, so we just give up if there are any
such inner loop exits. */ such inner loop exits. */
for (label = loop_number_exit_labels[this_loop_num]; label; for (label = loop->exit_labels; label; label = LABEL_NEXTREF (label))
label = LABEL_NEXTREF (label))
label_count++; label_count++;
if (label_count != loop_number_exit_count[this_loop_num]) if (label_count != loop->exit_count)
return 0; return 0;
/* HACK: Must also search the loop fall through exit, create a label_ref /* HACK: Must also search the loop fall through exit, create a label_ref
here which points to the loop_end, and append the loop_number_exit_labels here which points to the loop_end, and append the loop_number_exit_labels
list to it. */ list to it. */
label = gen_rtx_LABEL_REF (VOIDmode, loop_end); label = gen_rtx_LABEL_REF (VOIDmode, loop_end);
LABEL_NEXTREF (label) = loop_number_exit_labels[this_loop_num]; LABEL_NEXTREF (label) = loop->exit_labels;
for ( ; label; label = LABEL_NEXTREF (label)) for ( ; label; label = LABEL_NEXTREF (label))
{ {
...@@ -3343,7 +3342,7 @@ final_biv_value (bl, loop_start, loop_end, n_iterations) ...@@ -3343,7 +3342,7 @@ final_biv_value (bl, loop_start, loop_end, n_iterations)
value of the biv must be invariant. */ value of the biv must be invariant. */
if (n_iterations != 0 if (n_iterations != 0
&& ! loop_number_exit_count[uid_loop_num[INSN_UID (loop_start)]] && ! uid_loop[INSN_UID (loop_start)]->exit_count
&& invariant_p (bl->initial_value)) && invariant_p (bl->initial_value))
{ {
increment = biv_total_increment (bl, loop_start, loop_end); increment = biv_total_increment (bl, loop_start, loop_end);
...@@ -3423,7 +3422,7 @@ final_giv_value (v, loop_start, loop_end, n_iterations) ...@@ -3423,7 +3422,7 @@ final_giv_value (v, loop_start, loop_end, n_iterations)
to be known. */ to be known. */
if (n_iterations != 0 if (n_iterations != 0
&& ! loop_number_exit_count[uid_loop_num[INSN_UID (loop_start)]]) && ! uid_loop[INSN_UID (loop_start)]->exit_count)
{ {
/* ?? It is tempting to use the biv's value here since these insns will /* ?? It is tempting to use the biv's value here since these insns will
be put after the loop, and hence the biv will have its final value be put after the loop, and hence the biv will have its final value
...@@ -3623,9 +3622,8 @@ find_common_reg_term (op0, op1) ...@@ -3623,9 +3622,8 @@ find_common_reg_term (op0, op1)
iterations if it can be calculated, otherwise returns zero. */ iterations if it can be calculated, otherwise returns zero. */
unsigned HOST_WIDE_INT unsigned HOST_WIDE_INT
loop_iterations (loop_start, loop_end, loop_info) loop_iterations (loop)
rtx loop_start, loop_end; struct loop *loop;
struct loop_info *loop_info;
{ {
rtx comparison, comparison_value; rtx comparison, comparison_value;
rtx iteration_var, initial_value, increment, final_value; rtx iteration_var, initial_value, increment, final_value;
...@@ -3637,6 +3635,7 @@ loop_iterations (loop_start, loop_end, loop_info) ...@@ -3637,6 +3635,7 @@ loop_iterations (loop_start, loop_end, loop_info)
int unsigned_p, compare_dir, final_larger; int unsigned_p, compare_dir, final_larger;
rtx last_loop_insn; rtx last_loop_insn;
rtx reg_term; rtx reg_term;
struct loop_info *loop_info = loop->info;
loop_info->n_iterations = 0; loop_info->n_iterations = 0;
loop_info->initial_value = 0; loop_info->initial_value = 0;
...@@ -3652,7 +3651,7 @@ loop_iterations (loop_start, loop_end, loop_info) ...@@ -3652,7 +3651,7 @@ loop_iterations (loop_start, loop_end, loop_info)
accidentally get the branch for a contained loop if the branch for this accidentally get the branch for a contained loop if the branch for this
loop was deleted. We can only trust branches immediately before the loop was deleted. We can only trust branches immediately before the
loop_end. */ loop_end. */
last_loop_insn = PREV_INSN (loop_end); last_loop_insn = PREV_INSN (loop->end);
/* ??? We should probably try harder to find the jump insn /* ??? We should probably try harder to find the jump insn
at the end of the loop. The following code assumes that at the end of the loop. The following code assumes that
...@@ -3703,12 +3702,14 @@ loop_iterations (loop_start, loop_end, loop_info) ...@@ -3703,12 +3702,14 @@ loop_iterations (loop_start, loop_end, loop_info)
return 0; return 0;
} }
/* This can happen due to optimization in load_mems. */ /* The only new registers that care created before loop iterations are
givs made from biv increments, so this should never occur. */
if ((unsigned) REGNO (iteration_var) >= reg_iv_type->num_elements) if ((unsigned) REGNO (iteration_var) >= reg_iv_type->num_elements)
return 0; abort ();
iteration_info (iteration_var, &initial_value, &increment, iteration_info (iteration_var, &initial_value, &increment,
loop_start, loop_end); loop->start, loop->end);
if (initial_value == 0) if (initial_value == 0)
/* iteration_info already printed a message. */ /* iteration_info already printed a message. */
return 0; return 0;
...@@ -3755,7 +3756,7 @@ loop_iterations (loop_start, loop_end, loop_info) ...@@ -3755,7 +3756,7 @@ loop_iterations (loop_start, loop_end, loop_info)
final_value = comparison_value; final_value = comparison_value;
if (GET_CODE (comparison_value) == REG && invariant_p (comparison_value)) if (GET_CODE (comparison_value) == REG && invariant_p (comparison_value))
{ {
final_value = loop_find_equiv_value (loop_start, comparison_value); final_value = loop_find_equiv_value (loop->start, comparison_value);
/* If we don't get an invariant final value, we are better /* If we don't get an invariant final value, we are better
off with the original register. */ off with the original register. */
if (!invariant_p (final_value)) if (!invariant_p (final_value))
...@@ -3815,7 +3816,7 @@ loop_iterations (loop_start, loop_end, loop_info) ...@@ -3815,7 +3816,7 @@ loop_iterations (loop_start, loop_end, loop_info)
/* Find what reg1 is equivalent to. Hopefully it will /* Find what reg1 is equivalent to. Hopefully it will
either be reg2 or reg2 plus a constant. */ either be reg2 or reg2 plus a constant. */
temp = loop_find_equiv_value (loop_start, reg1); temp = loop_find_equiv_value (loop->start, reg1);
if (find_common_reg_term (temp, reg2)) if (find_common_reg_term (temp, reg2))
initial_value = temp; initial_value = temp;
else else
...@@ -3823,7 +3824,7 @@ loop_iterations (loop_start, loop_end, loop_info) ...@@ -3823,7 +3824,7 @@ loop_iterations (loop_start, loop_end, loop_info)
/* Find what reg2 is equivalent to. Hopefully it will /* Find what reg2 is equivalent to. Hopefully it will
either be reg1 or reg1 plus a constant. Let's ignore either be reg1 or reg1 plus a constant. Let's ignore
the latter case for now since it is not so common. */ the latter case for now since it is not so common. */
temp = loop_find_equiv_value (loop_start, reg2); temp = loop_find_equiv_value (loop->start, reg2);
if (temp == loop_info->iteration_var) if (temp == loop_info->iteration_var)
temp = initial_value; temp = initial_value;
if (temp == reg1) if (temp == reg1)
...@@ -3831,7 +3832,7 @@ loop_iterations (loop_start, loop_end, loop_info) ...@@ -3831,7 +3832,7 @@ loop_iterations (loop_start, loop_end, loop_info)
? reg1 : gen_rtx_PLUS (GET_MODE (reg1), reg1, const2); ? reg1 : gen_rtx_PLUS (GET_MODE (reg1), reg1, const2);
} }
} }
else if (loop_info->vtop && GET_CODE (reg2) == CONST_INT) else if (loop->vtop && GET_CODE (reg2) == CONST_INT)
{ {
rtx temp; rtx temp;
...@@ -3842,10 +3843,10 @@ loop_iterations (loop_start, loop_end, loop_info) ...@@ -3842,10 +3843,10 @@ loop_iterations (loop_start, loop_end, loop_info)
where temp2 = init + const. If the loop has a vtop we where temp2 = init + const. If the loop has a vtop we
can replace initial_value with const. */ can replace initial_value with const. */
temp = loop_find_equiv_value (loop_start, reg1); temp = loop_find_equiv_value (loop->start, reg1);
if (GET_CODE (temp) == MINUS && REG_P (XEXP (temp, 0))) if (GET_CODE (temp) == MINUS && REG_P (XEXP (temp, 0)))
{ {
rtx temp2 = loop_find_equiv_value (loop_start, XEXP (temp, 0)); rtx temp2 = loop_find_equiv_value (loop->start, XEXP (temp, 0));
if (GET_CODE (temp2) == PLUS if (GET_CODE (temp2) == PLUS
&& XEXP (temp2, 0) == XEXP (temp, 1)) && XEXP (temp2, 0) == XEXP (temp, 1))
initial_value = XEXP (temp2, 1); initial_value = XEXP (temp2, 1);
...@@ -3862,7 +3863,7 @@ loop_iterations (loop_start, loop_end, loop_info) ...@@ -3862,7 +3863,7 @@ loop_iterations (loop_start, loop_end, loop_info)
??? Without a vtop we could still perform the optimization if we check ??? Without a vtop we could still perform the optimization if we check
the initial and final values carefully. */ the initial and final values carefully. */
if (loop_info->vtop if (loop->vtop
&& (reg_term = find_common_reg_term (initial_value, final_value))) && (reg_term = find_common_reg_term (initial_value, final_value)))
{ {
initial_value = subtract_reg_term (initial_value, reg_term); initial_value = subtract_reg_term (initial_value, reg_term);
...@@ -3892,7 +3893,7 @@ loop_iterations (loop_start, loop_end, loop_info) ...@@ -3892,7 +3893,7 @@ loop_iterations (loop_start, loop_end, loop_info)
/* ??? Other RTL, such as (neg (reg)) is possible here, but it isn't /* ??? Other RTL, such as (neg (reg)) is possible here, but it isn't
clear if it is worthwhile to try to handle such RTL. */ clear if it is worthwhile to try to handle such RTL. */
if (GET_CODE (increment) == REG || GET_CODE (increment) == SUBREG) if (GET_CODE (increment) == REG || GET_CODE (increment) == SUBREG)
increment = loop_find_equiv_value (loop_start, increment); increment = loop_find_equiv_value (loop->start, increment);
if (GET_CODE (increment) != CONST_INT) if (GET_CODE (increment) != CONST_INT)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment