summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachineVerifier.cpp
diff options
context:
space:
mode:
authorQuentin Colombet <qcolombet@apple.com>2016-12-22 21:56:39 +0000
committerQuentin Colombet <qcolombet@apple.com>2016-12-22 21:56:39 +0000
commitfa5960a28ba2ad10c3f9b0e0b1db6c0557250fc3 (patch)
tree0e0df73b2922976446dfd95aa6b0caeb8f449418 /llvm/lib/CodeGen/MachineVerifier.cpp
parentf372150f733a522db18f05e5a3b9c0ffaf48731b (diff)
downloadbcm5719-llvm-fa5960a28ba2ad10c3f9b0e0b1db6c0557250fc3.tar.gz
bcm5719-llvm-fa5960a28ba2ad10c3f9b0e0b1db6c0557250fc3.zip
[MachineVerifier] Check that even generic vregs comply to regclass constraints.
We used to not check generic vregs, but that is actually a mistake given nothing in the GlobalISel pipeline is going to fix the constraints on target specific instructions. Therefore, the target has to have them right from the start. llvm-svn: 290380
Diffstat (limited to 'llvm/lib/CodeGen/MachineVerifier.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineVerifier.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineVerifier.cpp b/llvm/lib/CodeGen/MachineVerifier.cpp
index c790fc3cbf6..7eb42ecdf0a 100644
--- a/llvm/lib/CodeGen/MachineVerifier.cpp
+++ b/llvm/lib/CodeGen/MachineVerifier.cpp
@@ -1056,6 +1056,21 @@ MachineVerifier::visitMachineOperand(const MachineOperand *MO, unsigned MONum) {
MONum);
return;
}
+
+ // If this is a target specific instruction and this operand
+ // has register class constraint, the virtual register must
+ // comply to it.
+ if (!isPreISelGenericOpcode(MCID.getOpcode()) &&
+ TII->getRegClass(MCID, MONum, TRI, *MF)) {
+ report("Virtual register does not match instruction constraint", MO,
+ MONum);
+ errs() << "Expect register class "
+ << TRI->getRegClassName(
+ TII->getRegClass(MCID, MONum, TRI, *MF))
+ << " but got nothing\n";
+ return;
+ }
+
break;
}
if (SubIdx) {
OpenPOWER on IntegriCloud