------- Comment #6 from amylaar at gcc dot gnu dot org 2006-08-06 07:22 ------- (In reply to comment #1) > The scheduler should not know anything about if a register is likely to spill > or not, that is the job of the RA.
CLASS_LIKELY_SPIULLED is special because there is simply no way for reload to fix this up when a single-register class is overcommitted, unless you want to add code to reload to be able to undo any code transformation that the optimizers are capable of, which would also include the analysis to see what is possible - that would be more expensive then running all the optimizers. Therefore, there is a convention that the lifetime of CLASS_LIKELY_SPILLED registers must not be extended - just like you may not move a cc0_setter from a cc0_user, or a function call from the return value copy. Note that there is some half-hearted code in sched-rgn.c whcih preserves cc0_setter / cc0_user pairs, call/return value copies, and CLASS_LIKELY_SPILLED registers, but only if they appear at the end of the basic block. For cc0 there is already the more thorough code in sched-deps.c, but it was missing for CLASS_LIKELY_SPILLED. A historical note: the code to preserve CLASS_LIKELY_SPILLED registers originally applied to all hard registers, but only on targets that defined the SMALL_REGISTER_CLASSES target macro. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28618