[llvm-commits] [PATCH]: dont crash when printing PPC::MFCRpseudo comment

Roman Divacky rdivacky at freebsd.org
Mon Aug 22 09:57:23 PDT 2011


Hi,

on PPC the MFCRpseudo instruction has 1 operand but the printer incorrectly
tries to print the second operand as a comment, this patch fixes it:

Index: PPCAsmPrinter.cpp
===================================================================
--- PPCAsmPrinter.cpp   (revision 138231)
+++ PPCAsmPrinter.cpp   (working copy)
@@ -369,7 +369,7 @@
     // Transform: %R3 = MFCRpseud %CR7
     // Into:      %R3 = MFCR      ;; cr7
     OutStreamer.AddComment(PPCInstPrinter::
-                           getRegisterName(MI->getOperand(1).getReg()));
+                           getRegisterName(MI->getOperand(0).getReg()));
     TmpInst.setOpcode(PPC::MFCR);
     TmpInst.addOperand(MCOperand::CreateReg(MI->getOperand(0).getReg()));
     OutStreamer.EmitInstruction(TmpInst);


OK to commit?

roman






More information about the llvm-commits mailing list