Use enums instead of literals for X86 subregisters.

The cases in getMatchingSuperRegClass cannot be broken up until the enums have
unique values.

llvm-svn: 104611
This commit is contained in:
Jakob Stoklund Olesen 2010-05-25 17:04:16 +00:00
parent 7e10f3699a
commit 396c8802b2
2 changed files with 10 additions and 11 deletions

View File

@ -744,17 +744,17 @@ X86InstrInfo::isCoalescableExtInstr(const MachineInstr &MI,
case X86::MOVZX32rr8:
case X86::MOVSX64rr8:
case X86::MOVZX64rr8:
SubIdx = 1;
SubIdx = X86::sub_8bit;
break;
case X86::MOVSX32rr16:
case X86::MOVZX32rr16:
case X86::MOVSX64rr16:
case X86::MOVZX64rr16:
SubIdx = 3;
SubIdx = X86::sub_16bit;
break;
case X86::MOVSX64rr32:
case X86::MOVZX64rr32:
SubIdx = 4;
SubIdx = X86::sub_32bit;
break;
}
return true;

View File

@ -157,8 +157,8 @@ X86RegisterInfo::getMatchingSuperRegClass(const TargetRegisterClass *A,
unsigned SubIdx) const {
switch (SubIdx) {
default: return 0;
case 1:
// 8-bit
case X86::sub_8bit:
//case X86::sub_ss:
if (B == &X86::GR8RegClass) {
if (A->getSize() == 2 || A->getSize() == 4 || A->getSize() == 8)
return A;
@ -194,8 +194,8 @@ X86RegisterInfo::getMatchingSuperRegClass(const TargetRegisterClass *A,
return A;
}
break;
case 2:
// 8-bit hi
case X86::sub_8bit_hi:
//case X86::sub_sd:
if (B == &X86::GR8_ABCD_HRegClass) {
if (A == &X86::GR64RegClass || A == &X86::GR64_ABCDRegClass ||
A == &X86::GR64_NOREXRegClass ||
@ -212,8 +212,8 @@ X86RegisterInfo::getMatchingSuperRegClass(const TargetRegisterClass *A,
return A;
}
break;
case 3:
// 16-bit
case X86::sub_16bit:
//case X86::sub_xmm:
if (B == &X86::GR16RegClass) {
if (A->getSize() == 4 || A->getSize() == 8)
return A;
@ -241,8 +241,7 @@ X86RegisterInfo::getMatchingSuperRegClass(const TargetRegisterClass *A,
return A;
}
break;
case 4:
// 32-bit
case X86::sub_32bit:
if (B == &X86::GR32RegClass || B == &X86::GR32_NOSPRegClass) {
if (A->getSize() == 8)
return A;