diff options
author | Lang Hames <lhames@gmail.com> | 2013-11-11 23:00:41 +0000 |
---|---|---|
committer | Lang Hames <lhames@gmail.com> | 2013-11-11 23:00:41 +0000 |
commit | e7e66cfe9afba62be02ea284d81c4c803f3a13e9 (patch) | |
tree | 017129ed40c501a5e9fe66bfd2a7f275b0a42956 /lib/Target/X86/X86MCInstLower.cpp | |
parent | 01846af6ed371ebe2dba80cc8cd286b2631d4051 (diff) | |
download | external_llvm-e7e66cfe9afba62be02ea284d81c4c803f3a13e9.zip external_llvm-e7e66cfe9afba62be02ea284d81c4c803f3a13e9.tar.gz external_llvm-e7e66cfe9afba62be02ea284d81c4c803f3a13e9.tar.bz2 |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194431 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/X86MCInstLower.cpp')
-rw-r--r-- | lib/Target/X86/X86MCInstLower.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/Target/X86/X86MCInstLower.cpp b/lib/Target/X86/X86MCInstLower.cpp index 2cc038c..c718b1c 100644 --- a/lib/Target/X86/X86MCInstLower.cpp +++ b/lib/Target/X86/X86MCInstLower.cpp @@ -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(const MachineInstr *MI) { 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; |