[LLVMdev] Pluggable Register Coalescers
David Greene
dag at cray.com
Mon Jul 9 14:32:50 PDT 2007
Ok, I'm at a point now where I can implement plyggable register coalescers as
we originally wanted when I started the refactoring work.
I'm in the midst of finishing up an implementation following the model of how
register allocators are selected. Thgere may be some more refactoring/code
sharing work to be done with this, but I want to get it working first.
createRegisterAllocator() is called by addPassesToEmit.* to instantiate the
register allocator.
Coalescing is a bit different. Typically, the register allocator is the
client of the coalescer. My original thought was to have each register
allocator implementation call createRegisterCoalescer directly. I then
thought it might be better to have allocators just declare they want a
coalescer run and let someone else decide how to do it, similarly to
how the alias analysis group works.
But that's not quite right either, because it isn't possible in general to
state that coalescing should run "before" register allocation. Often you
want to run it in the middle of the algorithm, and maybe more than once.
So now I'm back to the original thought of just having the allocators
call createRegisterCoalescer directly. Does this sound like the right
solution? Are there other ideas?
Are there times one might run register coalescing completely outside of
register allocation? Again, in general, not all coalescers will be able to do
that (the classic case being a coalescer that works off an interference
graph).
-Dave
More information about the llvm-dev
mailing list