On 05/28/2012 03:09 PM, Richard Sandiford wrote:
Klaus Pedersen<proje...@gmail.com>  writes:
The summery goes something like this:

It is possible for the second pass of ira to get confused and decide that
NO_REGS or a hard float register are better choices for the result of the
2 operand mult. First pass already optimally allocated in GR_AND_MD1_REGS.
Yeah.  I'm afraid this is something I've been sitting on for a while now.
Sorry, I missed this emal -- I had a vacation about the 1st message time .
...

I think the only practical way of calculating accurate costs for things
like GR_AND_MD_REGS really is to count the cost of the constituent classes
and then take their MAX.

Vlad, what do you think?  Is the above exclude_p code "just" a compile-time
speed-up?
Yes, I think so. Every cost pass is very expensive and practically proportional to number of classes in consideration.

Probably, exluding some classes was a bad solution to speed IRA up. Or may be we need the pressure classes calculation improvements. As I remember I tried long ago to calculate IRA cover classes automatically and it did not work. Pressure classes calculation is analgous to the cover classes calculation but it is less critical for register pressure sensitive insn scheduling.

   Or is it a conceptual part of the algorithm?
No.
   More generally,
what kind of situations does the second pass help with?
I can not show such situations right now but I did some benchmarking long ago on the old RA and the second pass is really important for better code generation. That time I even thought about 3rd pass for -O3. I don't think the situation is now different.

Cost pass is a complicated part. It is impossible to find some good literature which could help. The problem is in GCC compiler specifics when code selection is not done (at least fully) before RA and we don't know until reload end what alternative will be used. So some code selection is done in combiner, some in IRA (including cost pass by defining allocation classes for pseudos) and final code selection is done in reload.

I thought about different approaches to cost pass but failed to find a better heuristic approach. There is an optimal solution to problem being solved by cost pass but it requires ILP and that is not practical because of its slowness.
   I.e. how does
it improve on the first pass?


Richard thanks for detail analysis. I'll try to do some benchmarks to measure compilation time. If the slowdown is tolerable, I exclude the code you mentioned (excluding subsets of pressure classes) and submit the patch.

Reply via email to