On Wed, 2012-06-20 at 11:52 -0700, Richard Henderson wrote: > On 06/20/2012 04:11 AM, Richard Guenther wrote: > > I notice (with all of these functions) > > > > +unsigned > > +negate_cost (enum machine_mode mode, bool speed) > > +{ > > + static unsigned costs[NUM_MACHINE_MODES]; > > + rtx seq; > > + unsigned cost; > > + > > + if (costs[mode]) > > + return costs[mode]; > > + > > + start_sequence (); > > + force_operand (gen_rtx_fmt_e (NEG, mode, > > + gen_raw_REG (mode, LAST_VIRTUAL_REGISTER + 1)), > > + NULL_RTX); > > I don't suppose there's any way to share data with what init_expmed computes? > > Not, strictly speaking, the cleanest thing to include expmed.h here, but > surely > a tad better than re-computing identical data (and without the clever rtl > garbage avoidance tricks).
Interesting. I was building on what ivopts already has; not sure of the history there. It looks like there is some overlap in function, but expmed doesn't have everything ivopts uses today (particularly the hash table of costs for multiplies by various constants). The stuff I need for type promotion/demotion is also not present (which I'm computing on demand for whatever mode pairs are encountered). Not sure how great it would be to precompute that for all pairs, and obviously precomputing costs of multiplying by all constants isn't going to work. So if the two functionalities were to be combined, it would seem to require some modification to how expmed works. Thanks, Bill > > > r~ >