cse/const calls improvement
Jan Hubicka
hubicka@atrey.karlin.mff.cuni.cz
Fri Apr 14 05:55:00 GMT 2000
> On Sun, Apr 09, 2000 at 02:00:12PM +0200, Jan Hubicka wrote:
> > * cse.c (true_dependence_in_rtx): New function.
> > (invalidate): Use it.
>
> The idea is sound, but I'd prefer you use for_each_rtx,
Like this one?
Fri Apr 14 14:51:31 MET DST 2000 Jan Hubicka <jh@suse.cz>A
* cse.c (struct check_depdendence_data): New.
(check_dependence): New function.
(invalidate): Use check_depdenence.
Index: egcs/gcc/cse.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cse.c,v
retrieving revision 1.137
diff -c -3 -p -r1.137 cse.c
*** cse.c 2000/04/12 05:03:32 1.137
--- cse.c 2000/04/14 12:51:06
*************** static rtx cse_basic_block PARAMS ((rtx,
*** 705,710 ****
--- 705,711 ----
static void count_reg_usage PARAMS ((rtx, int *, rtx, int));
extern void dump_class PARAMS ((struct table_elt*));
static struct cse_reg_info * get_cse_reg_info PARAMS ((unsigned int));
+ static int check_dependence PARAMS ((rtx *, void *));
static void flush_hash_table PARAMS ((void));
*************** flush_hash_table ()
*** 1721,1726 ****
--- 1722,1745 ----
}
}
+ /* Function called for each rtx to check whether true dependence exist. */
+ struct check_dependence_data
+ {
+ enum machine_mode mode;
+ rtx exp;
+ };
+ static int
+ check_dependence (x, data)
+ rtx *x;
+ void *data;
+ {
+ struct check_dependence_data *d = (struct check_dependence_data *) data;
+ if (*x && GET_CODE (*x) == MEM)
+ return true_dependence (d->exp, d->mode, *x, cse_rtx_varies_p);
+ else
+ return 0;
+ }
+
/* Remove from the hash table, or mark as invalid, all expressions whose
values could be altered by storing in X. X is a register, a subreg, or
a memory reference with nonvarying address (because, when a memory
*************** invalidate (x, full_mode)
*** 1846,1865 ****
next = p->next_same_hash;
if (p->in_memory)
{
! if (GET_CODE (p->exp) != MEM)
remove_from_table (p, i);
- else
- {
- /* Just canonicalize the expression once;
- otherwise each time we call invalidate
- true_dependence will canonicalize the
- expression again. */
- if (!p->canon_exp)
- p->canon_exp = canon_rtx (p->exp);
- if (true_dependence (x, full_mode, p->canon_exp,
- cse_rtx_varies_p))
- remove_from_table (p, i);
- }
}
}
}
--- 1865,1882 ----
next = p->next_same_hash;
if (p->in_memory)
{
! struct check_dependence_data d;
!
! /* Just canonicalize the expression once;
! otherwise each time we call invalidate
! true_dependence will canonicalize the
! expression again. */
! if (!p->canon_exp)
! p->canon_exp = canon_rtx (p->exp);
! d.exp = x;
! d.mode = full_mode;
! if (for_each_rtx (&p->canon_exp, check_dependence, &d))
remove_from_table (p, i);
}
}
}
More information about the Gcc-patches
mailing list