This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] Fix address shape in cse.c:find_best_addr
Hi Roger,
> > * cse.c (validize_addr): New function.
> > (find_best_addr): Use it.
Speaking of conversions between ASHIFT and MULT, do we have a
canonical way to represent ASHIFT/MULT in an address expression in
RTL? We seem to have a quite bit of "back and forth" between ASHIFT
and MULT. Unless we have a good reason, we should stick with one of
them.
Here are some places that do conversions.
1) validize_addr changes ASHIFT to MULT.
2) canon_for_address also changes ASHIFT to MULT.
3) According to Steven Bosscher, given this insn
(insn 215 214 216 15 (parallel [
(set (reg:DI 176)
(ashift:DI (reg:DI 175)
(const_int 3 [0x3])))
(clobber (reg:CC 17 flags))
]) -1 (nil)
(expr_list:REG_EQUAL (mult:DI (reg:DI 174)
(const_int 8 [0x8]))
(nil)))
and this rtx
(mult:DI (reg:DI 174)
(const_int 8 [0x8]))
fold_rtx returns
(ashift:DI (reg:DI 174)
(const_int 3 [0x3]))
Note that this particular REG_EQUAL doesn't tell us anything
interesting. OK, this 3) isn't strictly a conversion, but still we
are playing with ASHIFT and MULT.
By the way, now that I am looking at canon_for_address, I wonder
whether validize_addr can be merged into canon_for_address (or vice
versa). Zdenek, have you looked at canon_for_address before you wrote
validize_addr?
Kazu Hirata