summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/WinException.cpp
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2015-09-08 22:44:41 +0000
committerReid Kleckner <rnk@google.com>2015-09-08 22:44:41 +0000
commitdf1295173f244ce9d1c67ced33e05ba00042308d (patch)
treeb124401bb445e92c27bf597157be919fc293bfc1 /llvm/lib/CodeGen/AsmPrinter/WinException.cpp
parent18203f763ccf8863f49cfc40f08253a7764ef657 (diff)
downloadbcm5719-llvm-df1295173f244ce9d1c67ced33e05ba00042308d.tar.gz
bcm5719-llvm-df1295173f244ce9d1c67ced33e05ba00042308d.zip
[WinEH] Emit prologues and epilogues for funclets
Summary: 32-bit funclets have short prologues that allocate enough stack for the largest call in the whole function. The runtime saves CSRs for the funclet. It doesn't restore CSRs after we finally transfer control back to the parent funciton via a CATCHRET, but that's a separate issue. 32-bit funclets also have to adjust the incoming EBP value, which is what llvm.x86.seh.recoverframe does in the old model. 64-bit funclets need to spill CSRs as normal. For simplicity, this just spills the same set of CSRs as the parent function, rather than trying to compute different CSR sets for the parent function and each funclet. 64-bit funclets also allocate enough stack space for the largest outgoing call frame, like 32-bit. Reviewers: majnemer Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D12546 llvm-svn: 247092
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/WinException.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/WinException.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/WinException.cpp b/llvm/lib/CodeGen/AsmPrinter/WinException.cpp
index 547dc4cbdc3..aedac5467c6 100644
--- a/llvm/lib/CodeGen/AsmPrinter/WinException.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/WinException.cpp
@@ -473,12 +473,20 @@ void WinException::emitCXXFrameHandler3Table(const MachineFunction *MF) {
OS.EmitValue(create32bitRef(HT.Handler), 4);
if (shouldEmitPersonality) {
- MCSymbol *ParentFrameOffset =
- Asm->OutContext.getOrCreateParentFrameOffsetSymbol(
- GlobalValue::getRealLinkageName(HT.Handler->getName()));
- const MCSymbolRefExpr *ParentFrameOffsetRef = MCSymbolRefExpr::create(
- ParentFrameOffset, Asm->OutContext);
- OS.EmitValue(ParentFrameOffsetRef, 4); // ParentFrameOffset
+ if (FuncInfo.CatchHandlerParentFrameObjOffset.empty()) {
+ // With the new IR, this is always 16 + 8 + getMaxCallFrameSize().
+ // Keep this in sync with X86FrameLowering::emitPrologue.
+ int ParentFrameOffset =
+ 16 + 8 + MF->getFrameInfo()->getMaxCallFrameSize();
+ OS.EmitIntValue(ParentFrameOffset, 4); // ParentFrameOffset
+ } else {
+ MCSymbol *ParentFrameOffset =
+ Asm->OutContext.getOrCreateParentFrameOffsetSymbol(
+ GlobalValue::getRealLinkageName(HT.Handler->getName()));
+ const MCSymbolRefExpr *ParentFrameOffsetRef =
+ MCSymbolRefExpr::create(ParentFrameOffset, Asm->OutContext);
+ OS.EmitValue(ParentFrameOffsetRef, 4); // ParentFrameOffset
+ }
}
}
}
OpenPOWER on IntegriCloud