diff --git a/include/llvm/CodeGen/AsmPrinter.h b/include/llvm/CodeGen/AsmPrinter.h index a0bd330052b..d051f843f53 100644 --- a/include/llvm/CodeGen/AsmPrinter.h +++ b/include/llvm/CodeGen/AsmPrinter.h @@ -374,8 +374,10 @@ namespace llvm { /// printImplicitDef - This method prints the specified machine instruction /// that is an implicit def. virtual void printImplicitDef(const MachineInstr *MI) const; - - + + /// printKill - This method prints the specified kill machine instruction. + virtual void printKill(const MachineInstr *MI) const; + /// printPICJumpTableSetLabel - This method prints a set label for the /// specified MachineBasicBlock for a jumptable entry. virtual void printPICJumpTableSetLabel(unsigned uid, diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 58f3aa50665..bb6bd957f06 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -1590,6 +1590,17 @@ void AsmPrinter::printImplicitDef(const MachineInstr *MI) const { << TRI->getName(MI->getOperand(0).getReg()); } +void AsmPrinter::printKill(const MachineInstr *MI) const { + if (!VerboseAsm) return; + O.PadToColumn(MAI->getCommentColumn()); + O << MAI->getCommentString() << " kill:"; + for (unsigned n = 0, e = MI->getNumOperands(); n != e; ++n) { + const MachineOperand &op = MI->getOperand(n); + assert(op.isReg() && "KILL instruction must have only register operands"); + O << ' ' << TRI->getName(op.getReg()) << (op.isDef() ? "" : ""); + } +} + /// printLabel - This method prints a local label used by debug and /// exception handling tables. void AsmPrinter::printLabel(const MachineInstr *MI) const { diff --git a/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp b/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp index 19db411408a..6cb3e9e4d15 100644 --- a/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp +++ b/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp @@ -1346,6 +1346,7 @@ void ARMAsmPrinter::printInstructionThroughMCStreamer(const MachineInstr *MI) { printLabel(MI); return; case TargetInstrInfo::KILL: + printKill(MI); return; case TargetInstrInfo::INLINEASM: O << '\t'; diff --git a/lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp b/lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp index 237c313aa10..11ac931b67a 100644 --- a/lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp +++ b/lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp @@ -306,6 +306,7 @@ void MSP430AsmPrinter::printInstructionThroughMCStreamer(const MachineInstr *MI) printLabel(MI); return; case TargetInstrInfo::KILL: + printKill(MI); return; case TargetInstrInfo::INLINEASM: O << '\t'; diff --git a/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp b/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp index 24787a8c840..821cca42ed1 100644 --- a/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp +++ b/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp @@ -412,6 +412,7 @@ void X86AsmPrinter::printInstructionThroughMCStreamer(const MachineInstr *MI) { printImplicitDef(MI); return; case TargetInstrInfo::KILL: + printKill(MI); return; case X86::MOVPC32r: { MCInst TmpInst;