This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: i386 CONST_COSTS take 2


> 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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]