[LLVMdev] [LLVMDev] Coalescing Registers
Jakob Stoklund Olesen
stoklund at 2pi.dk
Mon Oct 4 10:00:16 PDT 2010
On Oct 3, 2010, at 11:27 AM, Jeff Kunkel wrote:
> I want to full understand register coalescing and how to coalesce
> copies. From what I have seen from "SimpleRegisterCoalescing,"
> "RegAllocLinearSpan," and "RegAllocPBQP" there are three indicators
> for the copy instruction x = copy y. Assume that the value number of x
> does not equal the value number of y.
>
> For "x = copy y", let the boolean values a,b, and c, equal the following:
> a = x is virtual or physical,
> b = y is virtual or physical, and
> c = class(x) == class(y) or class(x) != class(y).
>
> The resulting coalescing and actions depend on the truth values of
> these boolean values. Thus there are 2^3 cases. I expect enumerating
> and covering the cases provides an exhaustive solution to coalescing.
Make sure your truth table is symmetric when swapping x and y.
Note that physical registers don't really have a register class. A physreg can belong to many classes.
Also, virtual registers of different classes can be coalesced if there is a register class representing the intersection.
Then there is subregister copies...
You should look at the CoalescerPair class. It calculates whether a copy can be coalesced and what the resulting register should look like.
/jakob
More information about the llvm-dev
mailing list