mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-03 01:12:53 +00:00
[MachineVerifier] Teach how to check some of the properties of generic
virtual registers. Generic virtual registers: - May not have a register class - May not have a register bank - If they do not have a register class they must have a size - If they have a register bank, the size of the register bank must be greater or equal to the size of the virtual register (basically check that the virtual register will fit into that register class) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265798 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b246969303
commit
7500ba0386
@ -984,7 +984,30 @@ MachineVerifier::visitMachineOperand(const MachineOperand *MO, unsigned MONum) {
|
||||
}
|
||||
} else {
|
||||
// Virtual register.
|
||||
const TargetRegisterClass *RC = MRI->getRegClass(Reg);
|
||||
const TargetRegisterClass *RC = MRI->getRegClassOrNull(Reg);
|
||||
if (!RC) {
|
||||
// This is a generic virtual register.
|
||||
// It must have a size and it must not have a SubIdx.
|
||||
unsigned Size = MRI->getSize(Reg);
|
||||
if (!Size) {
|
||||
report("Generic virtual register must have a size", MO, MONum);
|
||||
return;
|
||||
}
|
||||
// Make sure the register fits into its register bank if any.
|
||||
const RegisterBank *RegBank = MRI->getRegBankOrNull(Reg);
|
||||
if (RegBank && RegBank->getSize() < Size) {
|
||||
report("Register bank is too small for virtual register", MO,
|
||||
MONum);
|
||||
errs() << "Register bank " << RegBank->getName() << " too small("
|
||||
<< RegBank->getSize() << ") to fit " << Size << "-bits\n";
|
||||
return;
|
||||
}
|
||||
if (SubIdx) {
|
||||
report("Generic virtual register does not subregister index", MO, MONum);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (SubIdx) {
|
||||
const TargetRegisterClass *SRC =
|
||||
TRI->getSubClassWithSubReg(RC, SubIdx);
|
||||
|
Loading…
Reference in New Issue
Block a user