summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachineVerifier.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen/MachineVerifier.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineVerifier.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineVerifier.cpp b/llvm/lib/CodeGen/MachineVerifier.cpp
index 34d4c57858a..479c9e7eeae 100644
--- a/llvm/lib/CodeGen/MachineVerifier.cpp
+++ b/llvm/lib/CodeGen/MachineVerifier.cpp
@@ -902,6 +902,14 @@ void MachineVerifier::visitMachineInstrBefore(const MachineInstr *MI) {
report("Non-generic instruction cannot have a type", MI);
}
+ // Generic opcodes must not have physical register operands.
+ if (isPreISelGenericOpcode(MCID.getOpcode())) {
+ for (auto &Op : MI->operands()) {
+ if (Op.isReg() && TargetRegisterInfo::isPhysicalRegister(Op.getReg()))
+ report("Generic instruction cannot have physical register", MI);
+ }
+ }
+
StringRef ErrorInfo;
if (!TII->verifyInstruction(*MI, ErrorInfo))
report(ErrorInfo.data(), MI);
OpenPOWER on IntegriCloud