[llvm] r194431 - Lower X86::MORESTACK_RET and X86::MORESTACK_RET_RESTORE_R10 in
Lang Hames
lhames at gmail.com
Mon Nov 11 15:00:41 PST 2013
Author: lhames
Date: Mon Nov 11 17:00:41 2013
New Revision: 194431
URL: http://llvm.org/viewvc/llvm-project?rev=194431&view=rev
Log:
Lower X86::MORESTACK_RET and X86::MORESTACK_RET_RESTORE_R10 in
X86AsmPrinter::EmitInstruction, rather than X86MCInstLower::Lower.
The aim is to improve the reusability of the X86MCInstLower class by making it
more function-like. The X86::MORESTACK_RET_RESTORE_R10 pseudo broke the
function model by emitting an extra instruction to the MCStreamer attached to
the AsmPrinter.
The patch should have no impact on generated code.
Modified:
llvm/trunk/lib/Target/X86/X86MCInstLower.cpp
Modified: llvm/trunk/lib/Target/X86/X86MCInstLower.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MCInstLower.cpp?rev=194431&r1=194430&r2=194431&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86MCInstLower.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86MCInstLower.cpp Mon Nov 11 17:00:41 2013
@@ -593,18 +593,6 @@ ReSimplify:
case X86::MOVSX64rr32:
SimplifyMOVSX(OutMI);
break;
-
- case X86::MORESTACK_RET:
- OutMI.setOpcode(X86::RET);
- break;
-
- case X86::MORESTACK_RET_RESTORE_R10:
- OutMI.setOpcode(X86::MOV64rr);
- OutMI.addOperand(MCOperand::CreateReg(X86::R10));
- OutMI.addOperand(MCOperand::CreateReg(X86::RAX));
-
- AsmPrinter.OutStreamer.EmitInstruction(MCInstBuilder(X86::RET));
- break;
}
}
@@ -940,6 +928,18 @@ void X86AsmPrinter::EmitInstruction(cons
case TargetOpcode::PATCHPOINT:
return LowerPATCHPOINT(OutStreamer, MCInstLowering, SM, *MI);
+
+ case X86::MORESTACK_RET:
+ OutStreamer.EmitInstruction(MCInstBuilder(X86::RET));
+ return;
+
+ case X86::MORESTACK_RET_RESTORE_R10:
+ // Return, then restore R10.
+ OutStreamer.EmitInstruction(MCInstBuilder(X86::RET));
+ OutStreamer.EmitInstruction(MCInstBuilder(X86::MOV64rr)
+ .addReg(X86::R10)
+ .addReg(X86::RAX));
+ return;
}
MCInst TmpInst;
More information about the llvm-commits
mailing list