diff options
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/WinException.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/WinException.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/WinException.cpp b/llvm/lib/CodeGen/AsmPrinter/WinException.cpp index c870419..155e91c 100644 --- a/llvm/lib/CodeGen/AsmPrinter/WinException.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/WinException.cpp @@ -109,6 +109,12 @@ void WinException::beginFunction(const MachineFunction *MF) { beginFunclet(MF->front(), Asm->CurrentFnSym); } +void WinException::markFunctionEnd() { + if (isAArch64 && CurrentFuncletEntry && + (shouldEmitMoves || shouldEmitPersonality)) + Asm->OutStreamer->EmitWinCFIFuncletOrFuncEnd(); +} + /// endFunction - Gather and emit post-function exception information. /// void WinException::endFunction(const MachineFunction *MF) { @@ -128,7 +134,7 @@ void WinException::endFunction(const MachineFunction *MF) { NonConstMF->tidyLandingPads(); } - endFunclet(); + endFuncletImpl(); // endFunclet will emit the necessary .xdata tables for x64 SEH. if (Per == EHPersonality::MSVC_Win64SEH && MF->hasEHFunclets()) @@ -231,6 +237,15 @@ void WinException::beginFunclet(const MachineBasicBlock &MBB, } void WinException::endFunclet() { + if (isAArch64 && CurrentFuncletEntry && + (shouldEmitMoves || shouldEmitPersonality)) { + Asm->OutStreamer->SwitchSection(CurrentFuncletTextSection); + Asm->OutStreamer->EmitWinCFIFuncletOrFuncEnd(); + } + endFuncletImpl(); +} + +void WinException::endFuncletImpl() { // No funclet to process? Great, we have nothing to do. if (!CurrentFuncletEntry) return; @@ -246,8 +261,6 @@ void WinException::endFunclet() { // to EmitWinEHHandlerData below can calculate the size of the funclet or // function. if (isAArch64) { - Asm->OutStreamer->SwitchSection(CurrentFuncletTextSection); - Asm->OutStreamer->EmitWinCFIFuncletOrFuncEnd(); MCSection *XData = Asm->OutStreamer->getAssociatedXDataSection( Asm->OutStreamer->getCurrentSectionOnly()); Asm->OutStreamer->SwitchSection(XData); |