R600/SI: Simplify verification of AMDGPU::OPERAND_REG_INLINE_C

llvm-svn: 229751
This commit is contained in:
Marek Olsak 2015-02-18 22:12:41 +00:00
parent b8c818337d
commit 8eeebcccb5
1 changed files with 6 additions and 8 deletions

View File

@ -1151,6 +1151,8 @@ bool SIInstrInfo::verifyInstruction(const MachineInstr *MI,
return false; return false;
} }
int RegClass = Desc.OpInfo[i].RegClass;
switch (Desc.OpInfo[i].OperandType) { switch (Desc.OpInfo[i].OperandType) {
case MCOI::OPERAND_REGISTER: case MCOI::OPERAND_REGISTER:
if (MI->getOperand(i).isImm()) { if (MI->getOperand(i).isImm()) {
@ -1161,13 +1163,10 @@ bool SIInstrInfo::verifyInstruction(const MachineInstr *MI,
case AMDGPU::OPERAND_REG_IMM32: case AMDGPU::OPERAND_REG_IMM32:
break; break;
case AMDGPU::OPERAND_REG_INLINE_C: case AMDGPU::OPERAND_REG_INLINE_C:
if (MI->getOperand(i).isImm()) { if (isLiteralConstant(MI->getOperand(i),
int RegClass = Desc.OpInfo[i].RegClass; RI.getRegClass(RegClass)->getSize())) {
const TargetRegisterClass *RC = RI.getRegClass(RegClass); ErrInfo = "Illegal immediate value for operand.";
if (!isInlineConstant(MI->getOperand(i), RC->getSize())) { return false;
ErrInfo = "Illegal immediate value for operand.";
return false;
}
} }
break; break;
case MCOI::OPERAND_IMMEDIATE: case MCOI::OPERAND_IMMEDIATE:
@ -1186,7 +1185,6 @@ bool SIInstrInfo::verifyInstruction(const MachineInstr *MI,
if (!MI->getOperand(i).isReg()) if (!MI->getOperand(i).isReg())
continue; continue;
int RegClass = Desc.OpInfo[i].RegClass;
if (RegClass != -1) { if (RegClass != -1) {
unsigned Reg = MI->getOperand(i).getReg(); unsigned Reg = MI->getOperand(i).getReg();
if (TargetRegisterInfo::isVirtualRegister(Reg)) if (TargetRegisterInfo::isVirtualRegister(Reg))