summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/WinException.cpp
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2015-12-15 23:40:58 +0000
committerReid Kleckner <rnk@google.com>2015-12-15 23:40:58 +0000
commit7850c9f5ca1f8eb8cda1c805dbbbb89d1dc5e2b8 (patch)
tree5abe1840ec82c5c7601adcc1d572f6b490a13865 /llvm/lib/CodeGen/AsmPrinter/WinException.cpp
parent4059eeca821013393a812f6ccd89bc46331580ea (diff)
downloadbcm5719-llvm-7850c9f5ca1f8eb8cda1c805dbbbb89d1dc5e2b8.tar.gz
bcm5719-llvm-7850c9f5ca1f8eb8cda1c805dbbbb89d1dc5e2b8.zip
[WinEH] Make llvm.x86.seh.recoverfp work on x64
It adjusts from RSP-after-prologue to RBP, which is what SEH filters need to do before they can use llvm.localrecover. Fixes SEH filter captures, which were broken in r250088. Issue reported by Alex Crichton. llvm-svn: 255707
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/WinException.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/WinException.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/WinException.cpp b/llvm/lib/CodeGen/AsmPrinter/WinException.cpp
index e2994172415..c4f650e89e0 100644
--- a/llvm/lib/CodeGen/AsmPrinter/WinException.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/WinException.cpp
@@ -506,8 +506,18 @@ InvokeStateChangeIterator &InvokeStateChangeIterator::scan() {
void WinException::emitCSpecificHandlerTable(const MachineFunction *MF) {
auto &OS = *Asm->OutStreamer;
MCContext &Ctx = Asm->OutContext;
-
const WinEHFuncInfo &FuncInfo = *MF->getWinEHFuncInfo();
+
+ // Emit a label assignment with the SEH frame offset so we can use it for
+ // llvm.x86.seh.recoverfp.
+ StringRef FLinkageName =
+ GlobalValue::getRealLinkageName(MF->getFunction()->getName());
+ MCSymbol *ParentFrameOffset =
+ Ctx.getOrCreateParentFrameOffsetSymbol(FLinkageName);
+ const MCExpr *MCOffset =
+ MCConstantExpr::create(FuncInfo.SEHSetFrameOffset, Ctx);
+ Asm->OutStreamer->EmitAssignment(ParentFrameOffset, MCOffset);
+
// Use the assembler to compute the number of table entries through label
// difference and division.
MCSymbol *TableBegin =
OpenPOWER on IntegriCloud