This is an archive of the discontinued LLVM Phabricator instance.

[WinEH] Emit prologues and epilogues for funclets
ClosedPublic

Authored by rnk on Sep 1 2015, 4:57 PM.

Details

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.

Diff Detail

Repository
rL LLVM

Event Timeline

rnk updated this revision to Diff 33758.Sep 1 2015, 4:57 PM
rnk retitled this revision from to [WinEH] Emit prologues and epilogues for funclets.
rnk updated this object.
rnk added a reviewer: majnemer.
rnk added a subscriber: llvm-commits.
majnemer edited edge metadata.Sep 8 2015, 3:06 PM

LGTM with nits addressed.

lib/CodeGen/AsmPrinter/WinException.cpp
477–479 ↗(On Diff #33758)

This math seems off, what happened to 16 + 8?

lib/Target/X86/X86FrameLowering.cpp
1432–1433 ↗(On Diff #33758)

Please make this a separate change to ease bisecting.

rnk added a comment.Sep 8 2015, 3:34 PM

Thanks!

lib/CodeGen/AsmPrinter/WinException.cpp
477–479 ↗(On Diff #33758)

That's a real bug. The test case didn't catch it due to the missing colon. :(

This revision was automatically updated to reflect the committed changes.