mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-15 16:07:49 +00:00
Rewrite chained if's as switches and replace assertions with llvm_unreachable
(as suggested in radar 8104405). llvm-svn: 106318
This commit is contained in:
parent
3f9da2755d
commit
e77d313369
@ -801,23 +801,27 @@ storeRegToStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
|
||||
if (RC == ARM::tGPRRegisterClass || RC == ARM::tcGPRRegisterClass)
|
||||
RC = ARM::GPRRegisterClass;
|
||||
|
||||
if (RC == ARM::GPRRegisterClass) {
|
||||
switch (RC->getID()) {
|
||||
case ARM::GPRRegClassID:
|
||||
AddDefaultPred(BuildMI(MBB, I, DL, get(ARM::STR))
|
||||
.addReg(SrcReg, getKillRegState(isKill))
|
||||
.addFrameIndex(FI).addReg(0).addImm(0).addMemOperand(MMO));
|
||||
} else if (RC == ARM::SPRRegisterClass) {
|
||||
break;
|
||||
case ARM::SPRRegClassID:
|
||||
AddDefaultPred(BuildMI(MBB, I, DL, get(ARM::VSTRS))
|
||||
.addReg(SrcReg, getKillRegState(isKill))
|
||||
.addFrameIndex(FI).addImm(0).addMemOperand(MMO));
|
||||
} else if (RC == ARM::DPRRegisterClass ||
|
||||
RC == ARM::DPR_VFP2RegisterClass ||
|
||||
RC == ARM::DPR_8RegisterClass) {
|
||||
break;
|
||||
case ARM::DPRRegClassID:
|
||||
case ARM::DPR_VFP2RegClassID:
|
||||
case ARM::DPR_8RegClassID:
|
||||
AddDefaultPred(BuildMI(MBB, I, DL, get(ARM::VSTRD))
|
||||
.addReg(SrcReg, getKillRegState(isKill))
|
||||
.addFrameIndex(FI).addImm(0).addMemOperand(MMO));
|
||||
} else if (RC == ARM::QPRRegisterClass ||
|
||||
RC == ARM::QPR_VFP2RegisterClass ||
|
||||
RC == ARM::QPR_8RegisterClass) {
|
||||
break;
|
||||
case ARM::QPRRegClassID:
|
||||
case ARM::QPR_VFP2RegClassID:
|
||||
case ARM::QPR_8RegClassID:
|
||||
// FIXME: Neon instructions should support predicates
|
||||
if (Align >= 16 && getRegisterInfo().canRealignStack(MF)) {
|
||||
AddDefaultPred(BuildMI(MBB, I, DL, get(ARM::VST1q))
|
||||
@ -831,7 +835,9 @@ storeRegToStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
|
||||
.addImm(ARM_AM::getAM5Opc(ARM_AM::ia, 4))
|
||||
.addMemOperand(MMO));
|
||||
}
|
||||
} else if (RC == ARM::QQPRRegisterClass || RC == ARM::QQPR_VFP2RegisterClass){
|
||||
break;
|
||||
case ARM::QQPRRegClassID:
|
||||
case ARM::QQPR_VFP2RegClassID:
|
||||
if (Align >= 16 && getRegisterInfo().canRealignStack(MF)) {
|
||||
// FIXME: It's possible to only store part of the QQ register if the
|
||||
// spilled def has a sub-register index.
|
||||
@ -853,8 +859,8 @@ storeRegToStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
|
||||
MIB = AddDReg(MIB, SrcReg, ARM::dsub_2, 0, TRI);
|
||||
AddDReg(MIB, SrcReg, ARM::dsub_3, 0, TRI);
|
||||
}
|
||||
} else {
|
||||
assert(RC == ARM::QQQQPRRegisterClass && "Unknown regclass!");
|
||||
break;
|
||||
case ARM::QQQQPRRegClassID: {
|
||||
MachineInstrBuilder MIB =
|
||||
AddDefaultPred(BuildMI(MBB, I, DL, get(ARM::VSTMD))
|
||||
.addFrameIndex(FI)
|
||||
@ -868,6 +874,10 @@ storeRegToStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
|
||||
MIB = AddDReg(MIB, SrcReg, ARM::dsub_5, 0, TRI);
|
||||
MIB = AddDReg(MIB, SrcReg, ARM::dsub_6, 0, TRI);
|
||||
AddDReg(MIB, SrcReg, ARM::dsub_7, 0, TRI);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
llvm_unreachable("Unknown regclass!");
|
||||
}
|
||||
}
|
||||
|
||||
@ -892,20 +902,24 @@ loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
|
||||
if (RC == ARM::tGPRRegisterClass || RC == ARM::tcGPRRegisterClass)
|
||||
RC = ARM::GPRRegisterClass;
|
||||
|
||||
if (RC == ARM::GPRRegisterClass) {
|
||||
switch (RC->getID()) {
|
||||
case ARM::GPRRegClassID:
|
||||
AddDefaultPred(BuildMI(MBB, I, DL, get(ARM::LDR), DestReg)
|
||||
.addFrameIndex(FI).addReg(0).addImm(0).addMemOperand(MMO));
|
||||
} else if (RC == ARM::SPRRegisterClass) {
|
||||
break;
|
||||
case ARM::SPRRegClassID:
|
||||
AddDefaultPred(BuildMI(MBB, I, DL, get(ARM::VLDRS), DestReg)
|
||||
.addFrameIndex(FI).addImm(0).addMemOperand(MMO));
|
||||
} else if (RC == ARM::DPRRegisterClass ||
|
||||
RC == ARM::DPR_VFP2RegisterClass ||
|
||||
RC == ARM::DPR_8RegisterClass) {
|
||||
break;
|
||||
case ARM::DPRRegClassID:
|
||||
case ARM::DPR_VFP2RegClassID:
|
||||
case ARM::DPR_8RegClassID:
|
||||
AddDefaultPred(BuildMI(MBB, I, DL, get(ARM::VLDRD), DestReg)
|
||||
.addFrameIndex(FI).addImm(0).addMemOperand(MMO));
|
||||
} else if (RC == ARM::QPRRegisterClass ||
|
||||
RC == ARM::QPR_VFP2RegisterClass ||
|
||||
RC == ARM::QPR_8RegisterClass) {
|
||||
break;
|
||||
case ARM::QPRRegClassID:
|
||||
case ARM::QPR_VFP2RegClassID:
|
||||
case ARM::QPR_8RegClassID:
|
||||
if (Align >= 16 && getRegisterInfo().canRealignStack(MF)) {
|
||||
AddDefaultPred(BuildMI(MBB, I, DL, get(ARM::VLD1q), DestReg)
|
||||
.addFrameIndex(FI).addImm(128)
|
||||
@ -916,7 +930,9 @@ loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
|
||||
.addImm(ARM_AM::getAM5Opc(ARM_AM::ia, 4))
|
||||
.addMemOperand(MMO));
|
||||
}
|
||||
} else if (RC == ARM::QQPRRegisterClass || RC == ARM::QQPR_VFP2RegisterClass){
|
||||
break;
|
||||
case ARM::QQPRRegClassID:
|
||||
case ARM::QQPR_VFP2RegClassID:
|
||||
if (Align >= 16 && getRegisterInfo().canRealignStack(MF)) {
|
||||
MachineInstrBuilder MIB = BuildMI(MBB, I, DL, get(ARM::VLD2q32));
|
||||
MIB = AddDReg(MIB, DestReg, ARM::dsub_0, RegState::Define, TRI);
|
||||
@ -935,21 +951,25 @@ loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
|
||||
MIB = AddDReg(MIB, DestReg, ARM::dsub_2, RegState::Define, TRI);
|
||||
AddDReg(MIB, DestReg, ARM::dsub_3, RegState::Define, TRI);
|
||||
}
|
||||
} else {
|
||||
assert(RC == ARM::QQQQPRRegisterClass && "Unknown regclass!");
|
||||
MachineInstrBuilder MIB =
|
||||
AddDefaultPred(BuildMI(MBB, I, DL, get(ARM::VLDMD))
|
||||
.addFrameIndex(FI)
|
||||
.addImm(ARM_AM::getAM5Opc(ARM_AM::ia, 4)))
|
||||
.addMemOperand(MMO);
|
||||
MIB = AddDReg(MIB, DestReg, ARM::dsub_0, RegState::Define, TRI);
|
||||
MIB = AddDReg(MIB, DestReg, ARM::dsub_1, RegState::Define, TRI);
|
||||
MIB = AddDReg(MIB, DestReg, ARM::dsub_2, RegState::Define, TRI);
|
||||
MIB = AddDReg(MIB, DestReg, ARM::dsub_3, RegState::Define, TRI);
|
||||
MIB = AddDReg(MIB, DestReg, ARM::dsub_4, RegState::Define, TRI);
|
||||
MIB = AddDReg(MIB, DestReg, ARM::dsub_5, RegState::Define, TRI);
|
||||
MIB = AddDReg(MIB, DestReg, ARM::dsub_6, RegState::Define, TRI);
|
||||
AddDReg(MIB, DestReg, ARM::dsub_7, RegState::Define, TRI);
|
||||
break;
|
||||
case ARM::QQQQPRRegClassID: {
|
||||
MachineInstrBuilder MIB =
|
||||
AddDefaultPred(BuildMI(MBB, I, DL, get(ARM::VLDMD))
|
||||
.addFrameIndex(FI)
|
||||
.addImm(ARM_AM::getAM5Opc(ARM_AM::ia, 4)))
|
||||
.addMemOperand(MMO);
|
||||
MIB = AddDReg(MIB, DestReg, ARM::dsub_0, RegState::Define, TRI);
|
||||
MIB = AddDReg(MIB, DestReg, ARM::dsub_1, RegState::Define, TRI);
|
||||
MIB = AddDReg(MIB, DestReg, ARM::dsub_2, RegState::Define, TRI);
|
||||
MIB = AddDReg(MIB, DestReg, ARM::dsub_3, RegState::Define, TRI);
|
||||
MIB = AddDReg(MIB, DestReg, ARM::dsub_4, RegState::Define, TRI);
|
||||
MIB = AddDReg(MIB, DestReg, ARM::dsub_5, RegState::Define, TRI);
|
||||
MIB = AddDReg(MIB, DestReg, ARM::dsub_6, RegState::Define, TRI);
|
||||
AddDReg(MIB, DestReg, ARM::dsub_7, RegState::Define, TRI);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
llvm_unreachable("Unknown regclass!");
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user