[LLVMdev] Some questions about live intervals

David Greene
Fri, 01 Feb 2008 21:38:10 -0000

On Friday 01 February 2008 13:54, Evan Cheng wrote:

> There isn't an efficient way right now. I think you can keep some sort
> of interference graph to help with this? Perhaps you can use class
> RegallocQuery in RegisterCoalescer.h for this? David would know since
> he contributed this.

RegallocQuery is just an abstract interface class.  The intent is for it
to be the gateway through which queries to the register allocator are
sent.  One such query is whether two intervals interfere.  The "guts"
of
the computation is up to some other piece of code, however.  A naive
implementation might return intA.overlaps(intB), for the interference
query, for example.

 I hadn't thought about a query to return the set of intervals live at a
particular point, but that's a good idea.  I actually have a number of
changes to this interface queued up waiting for upstream submittal.
Some of the changes could be contraversial, though, so it might
take a bit of iteration to make it happen.  It's also tied in with some
major coalescing refactoring that I did to allow more code shaing.
I also want to get that submitted upstream but it's a huge patch and
will take a while to get processed.

The bottom line is that RegallocQuery doesn't do any computation
on its own.  It's only purpose is to allow the register allocator to be
decoupled from the rest of the compiler internals.

                                        -Dave