Fix the use of x86 control and debug registers so that the assertion failure in

getX86RegNum() does not happen.  Patch by Shantonu Sen!

llvm-svn: 104994
This commit is contained in:
Kevin Enderby 2010-05-28 19:01:27 +00:00
parent ce52285c38
commit 76413597a9
2 changed files with 85 additions and 0 deletions

View File

@ -157,6 +157,34 @@ unsigned X86RegisterInfo::getX86RegNum(unsigned RegNo) {
case X86::GS:
return 5;
case X86::CR0:
return 0;
case X86::CR1:
return 1;
case X86::CR2:
return 2;
case X86::CR3:
return 3;
case X86::CR4:
return 4;
case X86::DR0:
return 0;
case X86::DR1:
return 1;
case X86::DR2:
return 2;
case X86::DR3:
return 3;
case X86::DR4:
return 4;
case X86::DR5:
return 5;
case X86::DR6:
return 6;
case X86::DR7:
return 7;
default:
assert(isVirtualRegister(RegNo) && "Unknown physical register!");
llvm_unreachable("Register allocator hasn't allocated reg correctly yet!");

View File

@ -331,3 +331,60 @@ retl
// CHECK: movw (%eax), %cs
// CHECK: encoding: [0x66,0x8e,0x08]
movw (%eax), %cs
// radr://8033374
// CHECK: movl %cr0, %eax
// CHECK: encoding: [0x0f,0x20,0xc0]
movl %cr0,%eax
// CHECK: movl %cr1, %eax
// CHECK: encoding: [0x0f,0x20,0xc8]
movl %cr1,%eax
// CHECK: movl %cr2, %eax
// CHECK: encoding: [0x0f,0x20,0xd0]
movl %cr2,%eax
// CHECK: movl %cr3, %eax
// CHECK: encoding: [0x0f,0x20,0xd8]
movl %cr3,%eax
// CHECK: movl %cr4, %eax
// CHECK: encoding: [0x0f,0x20,0xe0]
movl %cr4,%eax
// CHECK: movl %dr0, %eax
// CHECK: encoding: [0x0f,0x21,0xc0]
movl %dr0,%eax
// CHECK: movl %dr1, %eax
// CHECK: encoding: [0x0f,0x21,0xc8]
movl %dr1,%eax
// CHECK: movl %dr1, %eax
// CHECK: encoding: [0x0f,0x21,0xc8]
movl %dr1,%eax
// CHECK: movl %dr2, %eax
// CHECK: encoding: [0x0f,0x21,0xd0]
movl %dr2,%eax
// CHECK: movl %dr3, %eax
// CHECK: encoding: [0x0f,0x21,0xd8]
movl %dr3,%eax
// CHECK: movl %dr4, %eax
// CHECK: encoding: [0x0f,0x21,0xe0]
movl %dr4,%eax
// CHECK: movl %dr5, %eax
// CHECK: encoding: [0x0f,0x21,0xe8]
movl %dr5,%eax
// CHECK: movl %dr6, %eax
// CHECK: encoding: [0x0f,0x21,0xf0]
movl %dr6,%eax
// CHECK: movl %dr7, %eax
// CHECK: encoding: [0x0f,0x21,0xf8]
movl %dr7,%eax