[llvm] r202544 - R600: Verify all instructions in the AsmPrinter on debug builds

Tom Stellard thomas.stellard at amd.com
Fri Feb 28 13:36:41 PST 2014


Author: tstellar
Date: Fri Feb 28 15:36:41 2014
New Revision: 202544

URL: http://llvm.org/viewvc/llvm-project?rev=202544&view=rev
Log:
R600: Verify all instructions in the AsmPrinter on debug builds

Make a call to R600's implementation of verifyInstruction() to
check that instructions are only using legal operands.

Modified:
    llvm/trunk/lib/Target/R600/AMDGPUMCInstLower.cpp

Modified: llvm/trunk/lib/Target/R600/AMDGPUMCInstLower.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/R600/AMDGPUMCInstLower.cpp?rev=202544&r1=202543&r2=202544&view=diff
==============================================================================
--- llvm/trunk/lib/Target/R600/AMDGPUMCInstLower.cpp (original)
+++ llvm/trunk/lib/Target/R600/AMDGPUMCInstLower.cpp Fri Feb 28 15:36:41 2014
@@ -69,6 +69,13 @@ void AMDGPUMCInstLower::lower(const Mach
 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;





More information about the llvm-commits mailing list