Jan Hubicka <hubi...@ucw.cz> writes:
> Concerning x86 specifics, there is cost for allocating stack frame.  So
> if the function has nothing on stack frame push/pop becomes bit better
> candidate then a spill.  The hook you added does not seem to be able to
> test this, since it does not have frame size as an parameter.  I wonder
> if there is easy way to get it in?

The main frame size is available globally as get_frame_size ().
There's also the question of whether a frame needs to be created
for other reasons, such as an alloca call, but I suppose setting
up a frame for just alloca would also use push on x86?

> Also for old CPUs with no stack prediction engine we split either one or
> two push instructions into adjustemnet+move pair.  I do not see how to
> put that into game, since the cost of 1 or 2 reigsters then differs from
> 3 or more, but also I think we do not need to care about this, since all
> reaosnably current CPUs have stack prediction.

Yeah.  The hook does allow you test how many registers have been pushed,
and how many will be pushed after the change that is being costed.
But giving a higher cost for the first two registers would probably
tend to penalise using callee-saved registers for the first few allocnos
that we colour, which are also likely to be the most important allocnos.
Trying to cost the difference might therefore be counter-productive.

> I am benchmarking updated patch and will send once it is done.

Thanks!

Richard

Reply via email to