mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-05 02:07:56 +00:00
Change getX86SubSuperRegister to take an MVT::SimpleValueType rather than an EVT and add llvm_unreachable to the switches. Helps it compile to dramatically better code.
llvm-svn: 164919
This commit is contained in:
parent
46b4cbd0a3
commit
a970c6ab45
@ -243,7 +243,7 @@ void X86AsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
if (AsmVariant == 0) O << '%';
|
||||
unsigned Reg = MO.getReg();
|
||||
if (Modifier && strncmp(Modifier, "subreg", strlen("subreg")) == 0) {
|
||||
EVT VT = (strcmp(Modifier+6,"64") == 0) ?
|
||||
MVT::SimpleValueType VT = (strcmp(Modifier+6,"64") == 0) ?
|
||||
MVT::i64 : ((strcmp(Modifier+6, "32") == 0) ? MVT::i32 :
|
||||
((strcmp(Modifier+6,"16") == 0) ? MVT::i16 : MVT::i8));
|
||||
Reg = getX86SubSuperRegister(Reg, VT);
|
||||
|
@ -12110,7 +12110,7 @@ X86TargetLowering::EmitAtomicLoadArith(MachineInstr *MI,
|
||||
SrcReg = MI->getOperand(CurOp++).getReg();
|
||||
|
||||
const TargetRegisterClass *RC = MRI.getRegClass(DstReg);
|
||||
EVT VT = *RC->vt_begin();
|
||||
MVT::SimpleValueType VT = *RC->vt_begin();
|
||||
unsigned AccPhyReg = getX86SubSuperRegister(X86::EAX, VT);
|
||||
|
||||
unsigned LCMPXCHGOpc = getCmpXChgOpcode(VT);
|
||||
|
@ -590,9 +590,10 @@ unsigned X86RegisterInfo::getEHHandlerRegister() const {
|
||||
}
|
||||
|
||||
namespace llvm {
|
||||
unsigned getX86SubSuperRegister(unsigned Reg, EVT VT, bool High) {
|
||||
switch (VT.getSimpleVT().SimpleTy) {
|
||||
default: return Reg;
|
||||
unsigned getX86SubSuperRegister(unsigned Reg, MVT::SimpleValueType VT,
|
||||
bool High) {
|
||||
switch (VT) {
|
||||
default: llvm_unreachable("Unexpected VT");
|
||||
case MVT::i8:
|
||||
if (High) {
|
||||
switch (Reg) {
|
||||
@ -608,7 +609,7 @@ unsigned getX86SubSuperRegister(unsigned Reg, EVT VT, bool High) {
|
||||
}
|
||||
} else {
|
||||
switch (Reg) {
|
||||
default: return 0;
|
||||
default: llvm_unreachable("Unexpected register");
|
||||
case X86::AH: case X86::AL: case X86::AX: case X86::EAX: case X86::RAX:
|
||||
return X86::AL;
|
||||
case X86::DH: case X86::DL: case X86::DX: case X86::EDX: case X86::RDX:
|
||||
@ -645,7 +646,7 @@ unsigned getX86SubSuperRegister(unsigned Reg, EVT VT, bool High) {
|
||||
}
|
||||
case MVT::i16:
|
||||
switch (Reg) {
|
||||
default: return Reg;
|
||||
default: llvm_unreachable("Unexpected register");
|
||||
case X86::AH: case X86::AL: case X86::AX: case X86::EAX: case X86::RAX:
|
||||
return X86::AX;
|
||||
case X86::DH: case X86::DL: case X86::DX: case X86::EDX: case X86::RDX:
|
||||
@ -681,7 +682,7 @@ unsigned getX86SubSuperRegister(unsigned Reg, EVT VT, bool High) {
|
||||
}
|
||||
case MVT::i32:
|
||||
switch (Reg) {
|
||||
default: return Reg;
|
||||
default: llvm_unreachable("Unexpected register");
|
||||
case X86::AH: case X86::AL: case X86::AX: case X86::EAX: case X86::RAX:
|
||||
return X86::EAX;
|
||||
case X86::DH: case X86::DL: case X86::DX: case X86::EDX: case X86::RDX:
|
||||
@ -733,7 +734,7 @@ unsigned getX86SubSuperRegister(unsigned Reg, EVT VT, bool High) {
|
||||
}
|
||||
}
|
||||
switch (Reg) {
|
||||
default: return Reg;
|
||||
default: llvm_unreachable("Unexpected register");
|
||||
case X86::AH: case X86::AL: case X86::AX: case X86::EAX: case X86::RAX:
|
||||
return X86::RAX;
|
||||
case X86::DH: case X86::DL: case X86::DX: case X86::EDX: case X86::RDX:
|
||||
|
@ -141,8 +141,8 @@ public:
|
||||
|
||||
// getX86SubSuperRegister - X86 utility function. It returns the sub or super
|
||||
// register of a specific X86 register.
|
||||
// e.g. getX86SubSuperRegister(X86::EAX, EVT::i16) return X86:AX
|
||||
unsigned getX86SubSuperRegister(unsigned, EVT, bool High=false);
|
||||
// e.g. getX86SubSuperRegister(X86::EAX, MVT::i16) return X86:AX
|
||||
unsigned getX86SubSuperRegister(unsigned, MVT::SimpleValueType, bool High=false);
|
||||
|
||||
} // End llvm namespace
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user