loop.h (total_biv_increment): Constify iv_class pointer.
* loop.h (total_biv_increment): Constify iv_class pointer. (struct induction): Replace `mem_mode' with `mem' rtx. * unroll.c (total_biv_increment): Constify iv_class pointer. * loop.c (loop_giv_reduce_benefit): Derive mem mode from mem rtx. (find_mem_givs, combine_givs_p): Likewise. (debug_ivs, debug_iv_class, loop_ivs_dump, loop_iv_class_dump): New. From-SVN: r38933
This commit is contained in:
parent
69e905c854
commit
099f0f3f6e
|
@ -1,3 +1,12 @@
|
||||||
|
2001-01-12 Michael Hayes <mhayes@redhat.com>
|
||||||
|
|
||||||
|
* loop.h (total_biv_increment): Constify iv_class pointer.
|
||||||
|
(struct induction): Replace `mem_mode' with `mem' rtx.
|
||||||
|
* unroll.c (total_biv_increment): Constify iv_class pointer.
|
||||||
|
* loop.c (loop_giv_reduce_benefit): Derive mem mode from mem rtx.
|
||||||
|
(find_mem_givs, combine_givs_p): Likewise.
|
||||||
|
(debug_ivs, debug_iv_class, loop_ivs_dump, loop_iv_class_dump): New.
|
||||||
|
|
||||||
2001-01-10 Thomas Pfaff <tpfaff@gmx.net>
|
2001-01-10 Thomas Pfaff <tpfaff@gmx.net>
|
||||||
|
|
||||||
* gthr-win32.h (__gthread_objc_thread_get_data): Save and restore Win32
|
* gthr-win32.h (__gthread_objc_thread_get_data): Save and restore Win32
|
||||||
|
|
122
gcc/loop.c
122
gcc/loop.c
|
@ -199,6 +199,8 @@ static void record_biv PARAMS ((struct loop *, struct induction *,
|
||||||
int, int));
|
int, int));
|
||||||
static void check_final_value PARAMS ((const struct loop *,
|
static void check_final_value PARAMS ((const struct loop *,
|
||||||
struct induction *));
|
struct induction *));
|
||||||
|
static void loop_ivs_dump PARAMS((const struct loop *, FILE *, int));
|
||||||
|
static void loop_iv_class_dump PARAMS((const struct iv_class *, FILE *, int));
|
||||||
static void loop_biv_dump PARAMS((const struct induction *, FILE *, int));
|
static void loop_biv_dump PARAMS((const struct induction *, FILE *, int));
|
||||||
static void loop_giv_dump PARAMS((const struct induction *, FILE *, int));
|
static void loop_giv_dump PARAMS((const struct induction *, FILE *, int));
|
||||||
static void record_giv PARAMS ((const struct loop *, struct induction *,
|
static void record_giv PARAMS ((const struct loop *, struct induction *,
|
||||||
|
@ -256,6 +258,8 @@ static rtx loop_insn_emit_before PARAMS((const struct loop *, basic_block,
|
||||||
static rtx loop_insn_sink_or_swim PARAMS((const struct loop *, rtx));
|
static rtx loop_insn_sink_or_swim PARAMS((const struct loop *, rtx));
|
||||||
|
|
||||||
static void loop_dump_aux PARAMS ((const struct loop *, FILE *, int));
|
static void loop_dump_aux PARAMS ((const struct loop *, FILE *, int));
|
||||||
|
void debug_ivs PARAMS ((const struct loop *));
|
||||||
|
void debug_iv_class PARAMS ((const struct iv_class *));
|
||||||
void debug_biv PARAMS ((const struct induction *));
|
void debug_biv PARAMS ((const struct induction *));
|
||||||
void debug_giv PARAMS ((const struct induction *));
|
void debug_giv PARAMS ((const struct induction *));
|
||||||
void debug_loop PARAMS ((const struct loop *));
|
void debug_loop PARAMS ((const struct loop *));
|
||||||
|
@ -4131,16 +4135,16 @@ loop_giv_reduce_benefit (loop, bl, v, test_reg)
|
||||||
&& GET_CODE (v->mult_val) == CONST_INT)
|
&& GET_CODE (v->mult_val) == CONST_INT)
|
||||||
{
|
{
|
||||||
if (HAVE_POST_INCREMENT
|
if (HAVE_POST_INCREMENT
|
||||||
&& INTVAL (v->mult_val) == GET_MODE_SIZE (v->mem_mode))
|
&& INTVAL (v->mult_val) == GET_MODE_SIZE (GET_MODE (v->mem)))
|
||||||
benefit += add_cost * bl->biv_count;
|
benefit += add_cost * bl->biv_count;
|
||||||
else if (HAVE_PRE_INCREMENT
|
else if (HAVE_PRE_INCREMENT
|
||||||
&& INTVAL (v->mult_val) == GET_MODE_SIZE (v->mem_mode))
|
&& INTVAL (v->mult_val) == GET_MODE_SIZE (GET_MODE (v->mem)))
|
||||||
benefit += add_cost * bl->biv_count;
|
benefit += add_cost * bl->biv_count;
|
||||||
else if (HAVE_POST_DECREMENT
|
else if (HAVE_POST_DECREMENT
|
||||||
&& -INTVAL (v->mult_val) == GET_MODE_SIZE (v->mem_mode))
|
&& -INTVAL (v->mult_val) == GET_MODE_SIZE (GET_MODE (v->mem)))
|
||||||
benefit += add_cost * bl->biv_count;
|
benefit += add_cost * bl->biv_count;
|
||||||
else if (HAVE_PRE_DECREMENT
|
else if (HAVE_PRE_DECREMENT
|
||||||
&& -INTVAL (v->mult_val) == GET_MODE_SIZE (v->mem_mode))
|
&& -INTVAL (v->mult_val) == GET_MODE_SIZE (GET_MODE (v->mem)))
|
||||||
benefit += add_cost * bl->biv_count;
|
benefit += add_cost * bl->biv_count;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -4718,7 +4722,7 @@ find_mem_givs (loop, x, insn, not_every_iteration, maybe_multiple)
|
||||||
add_val, ext_val, benefit, DEST_ADDR,
|
add_val, ext_val, benefit, DEST_ADDR,
|
||||||
not_every_iteration, maybe_multiple, &XEXP (x, 0));
|
not_every_iteration, maybe_multiple, &XEXP (x, 0));
|
||||||
|
|
||||||
v->mem_mode = GET_MODE (x);
|
v->mem = x;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -6446,7 +6450,7 @@ combine_givs_p (g1, g2)
|
||||||
the expression of G2 in terms of G1 can be used. */
|
the expression of G2 in terms of G1 can be used. */
|
||||||
if (ret != NULL_RTX
|
if (ret != NULL_RTX
|
||||||
&& g2->giv_type == DEST_ADDR
|
&& g2->giv_type == DEST_ADDR
|
||||||
&& memory_address_p (g2->mem_mode, ret)
|
&& memory_address_p (GET_MODE (g2->mem), ret)
|
||||||
/* ??? Looses, especially with -fforce-addr, where *g2->location
|
/* ??? Looses, especially with -fforce-addr, where *g2->location
|
||||||
will always be a register, and so anything more complicated
|
will always be a register, and so anything more complicated
|
||||||
gets discarded. */
|
gets discarded. */
|
||||||
|
@ -9506,6 +9510,96 @@ loop_insn_sink_or_swim (loop, pattern)
|
||||||
return loop_insn_sink (loop, pattern);
|
return loop_insn_sink (loop, pattern);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
loop_ivs_dump (loop, file, verbose)
|
||||||
|
const struct loop *loop;
|
||||||
|
FILE *file;
|
||||||
|
int verbose;
|
||||||
|
{
|
||||||
|
struct iv_class *bl;
|
||||||
|
int iv_num = 0;
|
||||||
|
|
||||||
|
if (! loop || ! file)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (bl = LOOP_IVS (loop)->list; bl; bl = bl->next)
|
||||||
|
iv_num++;
|
||||||
|
|
||||||
|
fprintf (file, "Loop %d: %d IV classes\n", loop->num, iv_num);
|
||||||
|
|
||||||
|
for (bl = LOOP_IVS (loop)->list; bl; bl = bl->next)
|
||||||
|
{
|
||||||
|
loop_iv_class_dump (bl, file, verbose);
|
||||||
|
fputc ('\n', file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
loop_iv_class_dump (bl, file, verbose)
|
||||||
|
const struct iv_class *bl;
|
||||||
|
FILE *file;
|
||||||
|
int verbose ATTRIBUTE_UNUSED;
|
||||||
|
{
|
||||||
|
struct induction *v;
|
||||||
|
rtx incr;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (! bl || ! file)
|
||||||
|
return;
|
||||||
|
|
||||||
|
fprintf (file, "IV class for reg %d, benefit %d\n",
|
||||||
|
bl->regno, bl->total_benefit);
|
||||||
|
|
||||||
|
fprintf (file, " Init insn %d", INSN_UID (bl->init_insn));
|
||||||
|
if (bl->initial_value)
|
||||||
|
{
|
||||||
|
fprintf (file, ", init val: ");
|
||||||
|
print_simple_rtl (file, bl->initial_value);
|
||||||
|
}
|
||||||
|
if (bl->initial_test)
|
||||||
|
{
|
||||||
|
fprintf (file, ", init test: ");
|
||||||
|
print_simple_rtl (file, bl->initial_test);
|
||||||
|
}
|
||||||
|
fputc ('\n', file);
|
||||||
|
|
||||||
|
if (bl->final_value)
|
||||||
|
{
|
||||||
|
fprintf (file, " Final val: ");
|
||||||
|
print_simple_rtl (file, bl->final_value);
|
||||||
|
fputc ('\n', file);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((incr = biv_total_increment (bl)))
|
||||||
|
{
|
||||||
|
fprintf (file, " Total increment: ");
|
||||||
|
print_simple_rtl (file, incr);
|
||||||
|
fputc ('\n', file);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* List the increments. */
|
||||||
|
for (i = 0, v = bl->biv; v; v = v->next_iv, i++)
|
||||||
|
{
|
||||||
|
fprintf (file, " Inc%d: insn %d, incr: ", i, INSN_UID (v->insn));
|
||||||
|
print_simple_rtl (file, v->add_val);
|
||||||
|
fputc ('\n', file);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* List the givs. */
|
||||||
|
for (i = 0, v = bl->giv; v; v = v->next_iv, i++)
|
||||||
|
{
|
||||||
|
fprintf (file, " Giv%d: insn %d, benefit %d, ",
|
||||||
|
i, INSN_UID (v->insn), v->benefit);
|
||||||
|
if (v->giv_type == DEST_ADDR)
|
||||||
|
print_simple_rtl (file, v->mem);
|
||||||
|
else
|
||||||
|
print_simple_rtl (file, single_set (v->insn));
|
||||||
|
fputc ('\n', file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
loop_biv_dump (v, file, verbose)
|
loop_biv_dump (v, file, verbose)
|
||||||
const struct induction *v;
|
const struct induction *v;
|
||||||
|
@ -9596,6 +9690,22 @@ loop_giv_dump (v, file, verbose)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
debug_ivs (loop)
|
||||||
|
const struct loop *loop;
|
||||||
|
{
|
||||||
|
loop_ivs_dump (loop, stderr, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
debug_iv_class (bl)
|
||||||
|
const struct iv_class *bl;
|
||||||
|
{
|
||||||
|
loop_iv_class_dump (bl, stderr, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
debug_biv (v)
|
debug_biv (v)
|
||||||
const struct induction *v;
|
const struct induction *v;
|
||||||
|
|
|
@ -87,7 +87,7 @@ struct induction
|
||||||
/* For a biv, this is the place where add_val
|
/* For a biv, this is the place where add_val
|
||||||
was found. */
|
was found. */
|
||||||
enum machine_mode mode; /* The mode of this biv or giv */
|
enum machine_mode mode; /* The mode of this biv or giv */
|
||||||
enum machine_mode mem_mode; /* For DEST_ADDR, mode of the memory object. */
|
rtx mem; /* For DEST_ADDR, the memory object. */
|
||||||
rtx mult_val; /* Multiplicative factor for src_reg. */
|
rtx mult_val; /* Multiplicative factor for src_reg. */
|
||||||
rtx add_val; /* Additive constant for that product. */
|
rtx add_val; /* Additive constant for that product. */
|
||||||
int benefit; /* Gain from eliminating this insn. */
|
int benefit; /* Gain from eliminating this insn. */
|
||||||
|
@ -398,7 +398,7 @@ rtx express_from PARAMS ((struct induction *, struct induction *));
|
||||||
rtx extend_value_for_giv PARAMS ((struct induction *, rtx));
|
rtx extend_value_for_giv PARAMS ((struct induction *, rtx));
|
||||||
|
|
||||||
void unroll_loop PARAMS ((struct loop *, int, int));
|
void unroll_loop PARAMS ((struct loop *, int, int));
|
||||||
rtx biv_total_increment PARAMS ((struct iv_class *));
|
rtx biv_total_increment PARAMS ((const struct iv_class *));
|
||||||
unsigned HOST_WIDE_INT loop_iterations PARAMS ((struct loop *));
|
unsigned HOST_WIDE_INT loop_iterations PARAMS ((struct loop *));
|
||||||
int precondition_loop_p PARAMS ((const struct loop *,
|
int precondition_loop_p PARAMS ((const struct loop *,
|
||||||
rtx *, rtx *, rtx *,
|
rtx *, rtx *, rtx *,
|
||||||
|
@ -416,3 +416,4 @@ rtx loop_insn_hoist PARAMS((const struct loop *, rtx));
|
||||||
|
|
||||||
/* Forward declarations for non-static functions declared in doloop.c. */
|
/* Forward declarations for non-static functions declared in doloop.c. */
|
||||||
int doloop_optimize PARAMS ((const struct loop *));
|
int doloop_optimize PARAMS ((const struct loop *));
|
||||||
|
rtx doloop_condition_get PARAMS ((rtx));
|
||||||
|
|
|
@ -2377,7 +2377,7 @@ fold_rtx_mult_add (mult1, mult2, add1, mode)
|
||||||
|
|
||||||
rtx
|
rtx
|
||||||
biv_total_increment (bl)
|
biv_total_increment (bl)
|
||||||
struct iv_class *bl;
|
const struct iv_class *bl;
|
||||||
{
|
{
|
||||||
struct induction *v;
|
struct induction *v;
|
||||||
rtx result;
|
rtx result;
|
||||||
|
|
Loading…
Reference in New Issue