summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/X86/X86ExpandPseudo.cpp
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2015-09-29 22:33:36 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2015-09-29 22:33:36 +0000
commit91b0ab917280d2adf0293af6852f9824d742908b (patch)
tree41341a7ec5a15c3faa1cc407256ce5576aab9267 /llvm/lib/Target/X86/X86ExpandPseudo.cpp
parent4993d0eb5105ad6849df46489846ac6c6ab69337 (diff)
downloadbcm5719-llvm-91b0ab917280d2adf0293af6852f9824d742908b.tar.gz
bcm5719-llvm-91b0ab917280d2adf0293af6852f9824d742908b.zip
[WinEH] Ensure that funclets obey the x64 ABI
The x64 ABI requires that epilogues do not contain code other than stack adjustments and some limited control flow. However, we'd insert code to initialize the return address after stack adjustments. Instead, insert EAX/RAX with the current value before we create the stack adjustments in the epilogue. llvm-svn: 248839
Diffstat (limited to 'llvm/lib/Target/X86/X86ExpandPseudo.cpp')
-rw-r--r--llvm/lib/Target/X86/X86ExpandPseudo.cpp35
1 files changed, 0 insertions, 35 deletions
diff --git a/llvm/lib/Target/X86/X86ExpandPseudo.cpp b/llvm/lib/Target/X86/X86ExpandPseudo.cpp
index c9441bd0c2f..6a5a28e546f 100644
--- a/llvm/lib/Target/X86/X86ExpandPseudo.cpp
+++ b/llvm/lib/Target/X86/X86ExpandPseudo.cpp
@@ -141,41 +141,6 @@ bool X86ExpandPseudo::ExpandMI(MachineBasicBlock &MBB,
// The EH_RETURN pseudo is really removed during the MC Lowering.
return true;
}
-
- case X86::CLEANUPRET: {
- // Replace CATCHRET with the appropriate RET.
- unsigned RetOp = STI->is64Bit() ? X86::RETQ : X86::RETL;
- BuildMI(MBB, MBBI, DL, TII->get(RetOp));
- MBBI->eraseFromParent();
- return true;
- }
-
- case X86::CATCHRET: {
- MachineBasicBlock *TargetMBB = MBBI->getOperand(0).getMBB();
-
- // Fill EAX/RAX with the address of the target block.
- unsigned ReturnReg = STI->is64Bit() ? X86::RAX : X86::EAX;
- unsigned RetOp = STI->is64Bit() ? X86::RETQ : X86::RETL;
- if (STI->is64Bit()) {
- // LEA64r TargetMBB(%rip), %rax
- BuildMI(MBB, MBBI, DL, TII->get(X86::LEA64r), ReturnReg)
- .addReg(X86::RIP)
- .addImm(0)
- .addReg(0)
- .addMBB(TargetMBB)
- .addReg(0);
- } else {
- // MOV32ri $TargetMBB, %eax
- BuildMI(MBB, MBBI, DL, TII->get(X86::MOV32ri))
- .addReg(ReturnReg)
- .addMBB(TargetMBB);
- }
-
- // Replace CATCHRET with the appropriate RET.
- BuildMI(MBB, MBBI, DL, TII->get(RetOp)).addReg(ReturnReg);
- MBBI->eraseFromParent();
- return true;
- }
}
llvm_unreachable("Previous switch has a fallthrough?");
}
OpenPOWER on IntegriCloud