[llvm-commits] [llvm] r98007 - /llvm/trunk/lib/CodeGen/MachineCSE.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Mon Mar 8 19:14:31 PST 2010


On Mar 8, 2010, at 6:53 PM, Evan Cheng wrote:

> 
> On Mar 8, 2010, at 5:23 PM, Evan Cheng wrote:
> 
>> 
>> On Mar 8, 2010, at 4:57 PM, Jakob Stoklund Olesen wrote:
>> 
>>> 
>>> You could add "|| MRI->getRegClass(Reg)->hasSubClass(MRI->getRegClass(SrcReg))" without getting too complicated. That could help a bit with the few x86_64 subclasses as well.
>>> 
>> 
>> I don't think it's necessary here. It's doing local coalescing here to avoid missing some obvious cse opportunities. If sub-reg class is involved, then it's already too complicated.
> 
> Actually I do need to make it more complicated. But then BlackFin hates me (I wonder if it's related to its author).

Hehe. Blackfin not hating you is a good sign that you got your register classes right ;-)

Basic register class algebra: If an instruction operand specifies register class X, a virtual register must belong to X or a subclass of X.

If you want to eliminate a copy "%x = mov %y", the resulting register must make the users of %x and %y happy at the same time. That means the new register must belong to the intersection of X and Y, the register classes of %x and %y.

The function getCommonSubClass(X, Y) finds the largest existing register class that is a subclass of both X and Y. If getCommonSubClass returns NULL, the classes are disjoint, and you cannot eliminate the copy - no register would be legal.

I think Blackfin is the only target with disjoint register classes - maybe that is why it hates you.






More information about the llvm-commits mailing list