aboutsummaryrefslogtreecommitdiff
path: root/gcc/loop.h
diff options
context:
space:
mode:
authorMichael Hayes <mhayes@redhat.com>2001-01-01 00:49:30 +0000
committerMichael Hayes <m.hayes@gcc.gnu.org>2001-01-01 00:49:30 +0000
commit14be28e5f43fa2710e15441ff8b4e54b64295303 (patch)
tree33ca0f377662aa610d440a02bd9c36e0241f73aa /gcc/loop.h
parent1d2215feb99eee4186a842f93484ac3130f2f20a (diff)
downloadgcc-14be28e5f43fa2710e15441ff8b4e54b64295303.zip
gcc-14be28e5f43fa2710e15441ff8b4e54b64295303.tar.gz
gcc-14be28e5f43fa2710e15441ff8b4e54b64295303.tar.bz2
loop.h (struct iv): New.
* loop.h (struct iv): New. (REG_IV_TYPE, REG_IV_CLASS, REG_INFO): Modify to use 'struct iv'. (struct loop_ivs): Replace 'reg_iv_type', 'reg_iv_info', 'reg_biv_class' fields with 'regs' and 'n_regs'. (struct ivs): Rename 'loop_iv_list' field to 'list'. * loop.c (loop_bivs_find, strength_reduce): Use ivs->regs array. * unroll.c (loop_iterations): Check array bounds with ivs->n_regs. From-SVN: r38582
Diffstat (limited to 'gcc/loop.h')
-rw-r--r--gcc/loop.h76
1 files changed, 44 insertions, 32 deletions
diff --git a/gcc/loop.h b/gcc/loop.h
index 7ca9b06..5b57694 100644
--- a/gcc/loop.h
+++ b/gcc/loop.h
@@ -54,7 +54,7 @@ Boston, MA 02111-1307, USA. */
value is a linear function of a biv. */
/* Bivs are recognized by `basic_induction_var';
- Givs by `general_induct_var'. */
+ Givs by `general_induction_var'. */
/* An enum for the two different types of givs, those that are used
as memory addresses and those that are calculated into registers. */
@@ -64,6 +64,7 @@ enum g_types
DEST_REG
};
+
/* A `struct induction' is created for every instruction that sets
an induction variable (either a biv or a giv). */
@@ -152,6 +153,7 @@ struct induction
a substitute for the lifetime information. */
};
+
/* A `struct iv_class' is created for each biv. */
struct iv_class
@@ -182,35 +184,58 @@ struct iv_class
been reduced. */
};
-typedef struct loop_mem_info
+
+/* Definitions used by the basic induction variable discovery code. */
+enum iv_mode
{
- rtx mem; /* The MEM itself. */
- rtx reg; /* Corresponding pseudo, if any. */
- int optimize; /* Nonzero if we can optimize access to this MEM. */
-} loop_mem_info;
+ UNKNOWN_INDUCT,
+ BASIC_INDUCT,
+ NOT_BASIC_INDUCT,
+ GENERAL_INDUCT
+};
-struct loop_ivs
+
+/* A `struct iv' is created for every register. */
+
+struct iv
{
- /* Indexed by register number, indicates whether or not register is
- an induction variable, and if so what type. */
- varray_type reg_iv_type;
+ enum iv_mode type;
+ union
+ {
+ struct iv_class *class;
+ struct induction *info;
+ } iv;
+};
+
+
+#define REG_IV_TYPE(ivs, n) ivs->regs[n].type
+#define REG_IV_INFO(ivs, n) ivs->regs[n].iv.info
+#define REG_IV_CLASS(ivs, n) ivs->regs[n].iv.class
+
+struct loop_ivs
+{
/* Indexed by register number, contains pointer to `struct
- induction' if register is an induction variable. This holds
- general info for all induction variables. */
- varray_type reg_iv_info;
+ iv' if register is an induction variable. */
+ struct iv *regs;
- /* Indexed by register number, contains pointer to `struct iv_class'
- if register is a basic induction variable. This holds info
- describing the class (a related group) of induction variables
- that the biv belongs to. */
- struct iv_class **reg_biv_class;
+ /* Size of regs array. */
+ unsigned int n_regs;
/* The head of a list which links together (via the next field)
every iv class for the current loop. */
- struct iv_class *loop_iv_list;
+ struct iv_class *list;
};
+
+typedef struct loop_mem_info
+{
+ rtx mem; /* The MEM itself. */
+ rtx reg; /* Corresponding pseudo, if any. */
+ int optimize; /* Nonzero if we can optimize access to this MEM. */
+} loop_mem_info;
+
+
struct loop_regs
{
int num;
@@ -342,14 +367,6 @@ struct loop_info
int pre_header_has_call;
};
-/* Definitions used by the basic induction variable discovery code. */
-enum iv_mode
-{
- UNKNOWN_INDUCT,
- BASIC_INDUCT,
- NOT_BASIC_INDUCT,
- GENERAL_INDUCT
-};
/* Variables declared in loop.c, but also needed in unroll.c. */
@@ -359,11 +376,6 @@ extern unsigned int max_reg_before_loop;
extern struct loop **uid_loop;
extern FILE *loop_dump_stream;
-#define REG_IV_TYPE(ivs, n) \
- (*(enum iv_mode *) &VARRAY_INT(ivs->reg_iv_type, (n)))
-#define REG_IV_INFO(ivs, n) \
- (*(struct induction **) &VARRAY_GENERIC_PTR(ivs->reg_iv_info, (n)))
-#define REG_IV_CLASS(ivs, n) ivs->reg_biv_class[n]
/* Forward declarations for non-static functions declared in loop.c and
unroll.c. */