On 10/06/09 21:20, Vladimir Makarov wrote:
kito wrote:
Hello everybody:
I want to count the number of spilling.
I have try to compile file with -fdump-rtl-ira
And then use `grep Spilling *.ira | wc -l`
Does it's right way to get the number of spilling?
That is a wrong way to find real spills. Lines with Spilling is
actually reported by reload pass and it means only that reload is
checking constraints for insns (it is not real spills). Reload pass
can do several such iterations. The more hard registers usages, the
more iterations are usually needed. Therefore you are getting that
lines with 'Spilling' have -O1 < -O2 < -O3.
Also note that some spills are significantly more costly than others.
Secondary & tertiary reloads, secondary memory and the like all come to
mind.
If you just want static counts, an easy way to do this would be to scan
the insns after IRA has completed. Mark each uid encountered in a
bitmap. Then rescan the insns after reload (or better, after the
post-reload optimizers) -- clearly any insns not in the bitmap are spill
code.
That's not perfect as it'll miss cases where we reload by replacing a
REG with a MEM and the result is a valid insn, but it'll be a hell of a
lot closer than trying to scan the .ira dumps.
I'm pondering such a scheme, combined with classifying the spill insns
(load, store, arith) and block entry profiling to get a dynamic picture
of the spill code we're executing.
jeff