[llvm-commits] [PATCH] Don't -join-cross-class-copies of physical and virtual registers

Evan Cheng evan.cheng at apple.com
Thu Apr 23 13:40:57 PDT 2009


Unfortunately your patch will disable some of the functionalities for  
X86. See the comments:

       // This is not an insert_subreg but it looks like one.
       // e.g. %reg1024:4 = MOV32rr %EAX

That means reg1024 is a 64-bit register. EAX is not in the register  
class but we want to coalesce this by assigning RAX to reg1024.

Can you find another solution?

Evan
On Apr 22, 2009, at 10:40 PM, Jakob Stoklund Olesen wrote:

> When SimpleRegisterCoalescing::JoinCopy is trying to coalesce a  
> physical register with a virtual register, differingRegisterClasses  
> returns true exactly when the physical register does not belong to  
> the register class of the virtual register.
>
> In this case it would be illegal to coalesce. The virtual register  
> regclass is the set of legal registers for the instructions using  
> it. A physical register outside the regclass could lead to illegal  
> instruction operands.
>
> This happens frequently when using -join-cross-class-copies with my  
> Blackfin backend. It think it might not happen for X86 because the  
> only instruction with particular regclass requirements is  
> EXTRACT_SUBREG, and that is being removed by the coalescer.
>
> Unfortunately I have not been able to produce an X86 test case. I  
> have one for Blackfin.
>
> The attached patch will bail out early when attempting a cross class  
> join between a physical and a virtual register. It also removes a  
> bit of logic that is no longer needed when both registers are known  
> to be virtual.
>
> The removed code includes the obvious typo in "if (!SrcIsPhys && ! 
> SrcIsPhys)"
>
> <coalesce-phys-virt.patch>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list