R600: Verify all instructions in the AsmPrinter on debug builds
authorTom Stellard <thomas.stellard@amd.com>
Fri, 28 Feb 2014 21:36:41 +0000 (21:36 +0000)
committerTom Stellard <thomas.stellard@amd.com>
Fri, 28 Feb 2014 21:36:41 +0000 (21:36 +0000)
Make a call to R600's implementation of verifyInstruction() to
check that instructions are only using legal operands.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202544 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/R600/AMDGPUMCInstLower.cpp

index 4af535cdd1e79232babc8afec5f116bc5f561e34..2c9909ff9d94ce096ab0914c9c597c4fdd9fce96 100644 (file)
@@ -69,6 +69,13 @@ void AMDGPUMCInstLower::lower(const MachineInstr *MI, MCInst &OutMI) const {
 void AMDGPUAsmPrinter::EmitInstruction(const MachineInstr *MI) {
   AMDGPUMCInstLower MCInstLowering(OutContext);
 
+#ifdef _DEBUG
+  StringRef Err;
+  if (!TM.getInstrInfo()->verifyInstruction(MI, Err)) {
+    errs() << "Warning: Illegal instruction detected: " << Err << "\n";
+    MI->dump();
+  }
+#endif
   if (MI->isBundle()) {
     const MachineBasicBlock *MBB = MI->getParent();
     MachineBasicBlock::const_instr_iterator I = MI;