Commit 3c748bb6 by Michael Hayes Committed by Jeff Law

loop.c (this_loop_info): New variable.

        * loop.c (this_loop_info): New variable.
        (loop_has_call, loop_has_volatile, loop_has_tablejump,
        loop_continue, loops_enclosed): Replace with fields in this_loop_info.
        All uses updated.
        (prescan_loop, strength_reduce): New argument loop_info.  All callers
        updated.
        (scan_loop): New variable loop_info, initialise to address of
        this_loop_info.
        (prescan_loop): Set loop_info->vtop if find NOTE_INSN_LOOP_VTOP.
        Delete variable loop_has_multiple_exit targets and replace with
        field in this_loop_info.
        (find_and_verify_loops): Rename this_loop to this_loop_num.
        (strength_reduce): Delete loop_iteration_info.  Replace variable
        loop_info with function argument of same name.
        (insert_bct): Rework test for loop being completely unrolled.

        * loop.h (struct loop_info): New fields num, loops_enclosed,
        has_call, has_volatile, has_tablejump, has_multiple_exit_targets,
        has_indirect_jump, and cont.  Redefine use of unroll_number.
        (loop_unroll_number): Delete.

        * unroll.c (unroll_loop): Store loop unroll count in unroll_number
        field of loop_info.
        (loop_iterations): Delete variable vtop and instead use
        loop_info->vtop computed in prescan_loop.

From-SVN: r28961
parent ceb45eb8
1999-08-29 Michael Hayes <m.hayes@elec.canterbury.ac.nz>
* loop.c (this_loop_info): New variable.
(loop_has_call, loop_has_volatile, loop_has_tablejump,
loop_continue, loops_enclosed): Replace with fields in this_loop_info.
All uses updated.
(prescan_loop, strength_reduce): New argument loop_info. All callers
updated.
(scan_loop): New variable loop_info, initialise to address of
this_loop_info.
(prescan_loop): Set loop_info->vtop if find NOTE_INSN_LOOP_VTOP.
Delete variable loop_has_multiple_exit targets and replace with
field in this_loop_info.
(find_and_verify_loops): Rename this_loop to this_loop_num.
(strength_reduce): Delete loop_iteration_info. Replace variable
loop_info with function argument of same name.
(insert_bct): Rework test for loop being completely unrolled.
* loop.h (struct loop_info): New fields num, loops_enclosed,
has_call, has_volatile, has_tablejump, has_multiple_exit_targets,
has_indirect_jump, and cont. Redefine use of unroll_number.
(loop_unroll_number): Delete.
* unroll.c (unroll_loop): Store loop unroll count in unroll_number
field of loop_info.
(loop_iterations): Delete variable vtop and instead use
loop_info->vtop computed in prescan_loop.
Sun Aug 29 03:27:23 1999 Scott Weikart <scott@igc.apc.org>
* fix-header.c (main): Do not pass a null pointer to strcmp.
......
......@@ -158,6 +158,22 @@ struct iv_class {
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. */
int has_call;
/* Nonzero if there is a volatile memory reference in the current
loop. */
int has_volatile;
/* Nonzero if there is a tablejump in the current loop. */
int has_tablejump;
/* Nonzero if there are ways to leave the loop other than falling
off the end. */
int has_multiple_exit_targets;
/* Nonzero if there is an indirect jump in the current function. */
int has_indirect_jump;
/* Register or constant initial loop value. */
rtx initial_value;
/* Register or constant value used for comparison test. */
......@@ -181,15 +197,13 @@ struct loop_info
wider iterator, this number will be zero if the number of loop
iterations is too large for an unsigned integer to hold. */
unsigned HOST_WIDE_INT n_iterations;
/* The loop unrolling factor.
Potential values:
0: unrolled
1: not unrolled.
-1: completely unrolled
>0: holds the unroll exact factor. */
/* The number of times the loop body was unrolled. */
unsigned int unroll_number;
/* 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;
};
/* Definitions used by the basic induction variable discovery code. */
......@@ -240,10 +254,10 @@ rtx final_giv_value PROTO((struct induction *, rtx, rtx,
unsigned HOST_WIDE_INT));
void emit_unrolled_add PROTO((rtx, rtx, rtx));
int back_branch_in_range_p PROTO((rtx, rtx, rtx));
int loop_insn_first_p PROTO((rtx, rtx));
extern int *loop_unroll_number;
int loop_insn_first_p PROTO((rtx, rtx));
/* Forward declarations for non-static functions declared in stmt.c. */
void find_loop_tree_blocks PROTO((void));
void unroll_block_trees PROTO((void));
......@@ -1117,11 +1117,7 @@ unroll_loop (loop_end, insn_count, loop_start, end_insert_before,
/* At this point, we are guaranteed to unroll the loop. */
/* Keep track of the unroll factor for the loop. */
if (unroll_type == UNROLL_COMPLETELY)
loop_info->unroll_number = -1;
else
loop_info->unroll_number = unroll_number;
loop_info->unroll_number = unroll_number;
/* For each biv and giv, determine whether it can be safely split into
a different variable for each unrolled copy of the loop body.
......@@ -3500,7 +3496,6 @@ loop_find_equiv_value (loop_start, reg)
return ret;
}
/* Return a simplified rtx for the expression OP - REG.
REG must appear in OP, and OP must be a register or the sum of a register
......@@ -3566,7 +3561,6 @@ find_common_reg_term (op0, op1)
return NULL_RTX;
}
/* Calculate the number of loop iterations. Returns the exact number of loop
iterations if it can be calculated, otherwise returns zero. */
......@@ -3584,7 +3578,6 @@ loop_iterations (loop_start, loop_end, loop_info)
int increment_dir;
int unsigned_p, compare_dir, final_larger;
rtx last_loop_insn;
rtx vtop;
rtx reg_term;
loop_info->n_iterations = 0;
......@@ -3596,7 +3589,6 @@ loop_iterations (loop_start, loop_end, loop_info)
loop_info->increment = 0;
loop_info->iteration_var = 0;
loop_info->unroll_number = 1;
loop_info->vtop = 0;
/* We used to use prev_nonnote_insn here, but that fails because it might
accidentally get the branch for a contained loop if the branch for this
......@@ -3645,25 +3637,6 @@ loop_iterations (loop_start, loop_end, loop_info)
iteration_var = XEXP (comparison, 0);
comparison_value = XEXP (comparison, 1);
/* Check if there is a NOTE_INSN_LOOP_VTOP note. If there is,
that means that this is a for or while style loop, with
a loop exit test at the start. Thus, we can assume that
the loop condition was true when the loop was entered.
We start at the end and search backwards for the previous
NOTE. If there is no NOTE_INSN_LOOP_VTOP for this loop,
the search will stop at the NOTE_INSN_LOOP_CONT. */
vtop = loop_end;
do
vtop = PREV_INSN (vtop);
while (GET_CODE (vtop) != NOTE
|| NOTE_LINE_NUMBER (vtop) > 0
|| NOTE_LINE_NUMBER (vtop) == NOTE_REPEATED_LINE_NUMBER
|| NOTE_LINE_NUMBER (vtop) == NOTE_INSN_DELETED);
if (NOTE_LINE_NUMBER (vtop) != NOTE_INSN_LOOP_VTOP)
vtop = NULL_RTX;
loop_info->vtop = vtop;
if (GET_CODE (iteration_var) != REG)
{
if (loop_dump_stream)
......
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