This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: i386 CONST_COSTS take 2
- To: jh at suse dot cz (Jan Hubicka)
- Subject: Re: i386 CONST_COSTS take 2
- From: Joern Rennecke <amylaar at redhat dot com>
- Date: Thu, 21 Jun 2001 17:46:44 +0100 (BST)
- Cc: amylaar at redhat dot com (Joern Rennecke), jh at suse dot cz (Jan Hubicka),gcc-patches at gcc dot gnu dot org, rth at cygnus dot com, patches at x86-64 dot org
> On the other hand it would be nice to make costs fine grained enought to make
> compiler decide thinks like "load it to register in case it is used more than
> 5 times".
COSTS_N_INSNS already multiplies by four, so a cost of one means just one
quarter of the cost of one insn. So it seems we can already express
'load it to register in case it is used more than 4 times' .
However, cse does make its decisions on too local a basis.
I suppose gcse has more of the necessary data available, as it already
builds a table of expressions; it just refuses to gcse simple constants
(assuming that cse already does that job).
So you could try to
- Set the cost of simple constants for x86 back to one
- Make gcse consider them (look for want_to_gcse_p)
- Add a check to gcse them only if this results in an overall cost saving.
Maybe taking lifetime into account / register pressure.