From e9b78d430b4b93eb0a5b59ffdcf6a32c29aff9b7 Mon Sep 17 00:00:00 2001 From: "m.hayes" Date: Mon, 11 Sep 2000 21:46:35 +0000 Subject: * loop.h (LOOP_REGS): New macro. (struct loop_regs): New. (struct loop_info): Add regs field. * loop.c (set_in_loop): Remove global array and store in loop_regs structure as part of loop_info structure. (n_times_set, may_not_optimize): Likewise. (reg_single_usage, moved_once): Likewise. (count_one_set): Add regs argument. (combine_movables, rtx_equal_for_loop_p, combine_givs): Likewise. (set_pseudo_multiple_uses): Pass regs pointer. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@36335 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/loop.h | 47 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) (limited to 'gcc/loop.h') diff --git a/gcc/loop.h b/gcc/loop.h index addd6747ccf..f73e2257bb8 100644 --- a/gcc/loop.h +++ b/gcc/loop.h @@ -29,6 +29,9 @@ Boston, MA 02111-1307, USA. */ /* Get the loop info pointer of a loop. */ #define LOOP_INFO(LOOP) ((struct loop_info *) (LOOP)->aux) +/* Get a pointer to the loop registers structure. */ +#define LOOP_REGS(LOOP) (&LOOP_INFO (loop)->regs) + /* 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. */ @@ -173,8 +176,46 @@ typedef struct loop_mem_info } loop_mem_info; -/* Information required to calculate the number of loop iterations. - This is set by loop_iterations. */ + +struct loop_regs +{ + int num; + + /* Indexed by register number, contains the number of times the reg + is set during the loop being scanned. + During code motion, a negative value indicates a reg that has been + made a candidate; in particular -2 means that it is an candidate that + we know is equal to a constant and -1 means that it is an candidate + not known equal to a constant. + After code motion, regs moved have 0 (which is accurate now) + while the failed candidates have the original number of times set. + + Therefore, at all times, == 0 indicates an invariant register; + < 0 a conditionally invariant one. */ + varray_type set_in_loop; + + /* Original value of set_in_loop; same except that this value + is not set negative for a reg whose sets have been made candidates + and not set to 0 for a reg that is moved. */ + varray_type n_times_set; + + /* Index by register number, 1 indicates that the register + cannot be moved or strength reduced. */ + varray_type may_not_optimize; + + /* Contains the insn in which a register was used if it was used + exactly once; contains const0_rtx if it was used more than once. */ + varray_type single_usage; + + /* Nonzero means reg N has already been moved out of one loop. + This reduces the desire to move it out of another. */ + char *moved_once; + + int multiple_uses; +}; + + +/* Information pertaining to a loop. */ struct loop_info { @@ -242,6 +283,8 @@ struct loop_info int num_mem_sets; /* The insn where the first of these was found. */ rtx first_loop_store_insn; + /* The registers used the in loop. */ + struct loop_regs regs; }; /* Definitions used by the basic induction variable discovery code. */ -- cgit v1.2.1