From 34faf78241efb8d60884f185cab4a0c132ee1df3 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Fri, 28 Feb 2014 21:36:41 +0000 Subject: [PATCH] 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202544 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/R600/AMDGPUMCInstLower.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/Target/R600/AMDGPUMCInstLower.cpp b/lib/Target/R600/AMDGPUMCInstLower.cpp index 4af535cdd1e..2c9909ff9d9 100644 --- a/lib/Target/R600/AMDGPUMCInstLower.cpp +++ b/lib/Target/R600/AMDGPUMCInstLower.cpp @@ -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;