[llvm-commits] [PATCH] Add GR8_H register class to X86 backend

Jakob Stoklund Olesen stoklund at 2pi.dk
Sun Apr 26 08:21:09 PDT 2009


X86RegisterInfo.td declares these register classes:

def GR8_ : RegisterClass<"X86", [i8], 8, [AL, CL, DL, BL]> {
}

def GR16_ : RegisterClass<"X86", [i16], 16, [AX, CX, DX, BX]> {
   let SubRegClassList = [GR8_, GR8_];
}

The SubRegClassList asserts that EXTRACT_SUBREG GR16_, 2 yields a GR8_  
register. This is inconsistent with the actual SubRegSet:

def : SubRegSet<2, [AX, CX, DX, BX],
                    [AH, CH, DH, BH]>;

The SubRegClassList is currently only used by  
ScheduleDAGSDNodesEmit.cpp to determine the register class of virtual  
registers defined by EXTRACT_SUBREG. If these badly classed virtual  
registers survive register coalescing, they cause unnecessary copies  
in the LowerSubregs pass.

The attached patch replaces the GR8_ register class with two register  
classes: GR8_L and GR8_H, corresponding to the low and high halves of  
the GR16_ registers.

The patch passes "make check".

-------------- next part --------------
A non-text attachment was scrubbed...
Name: x86-gr8h.patch
Type: application/octet-stream
Size: 3952 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20090426/27cc7af8/attachment.obj>
-------------- next part --------------



More information about the llvm-commits mailing list