diff options
author | Martin Storsjö <martin@martin.st> | 2020-11-13 22:35:22 +0200 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2020-11-23 23:17:03 +0200 |
commit | 6f792041a5cb964b4099614952a54c4961bfb872 (patch) | |
tree | f1492819c578622d6e98164408fcad1f2e85e9c8 /llvm/lib/MC/MCStreamer.cpp | |
parent | 3c811ce4f390c8570690b042f4e6199f20255e26 (diff) | |
download | llvm-6f792041a5cb964b4099614952a54c4961bfb872.zip llvm-6f792041a5cb964b4099614952a54c4961bfb872.tar.gz llvm-6f792041a5cb964b4099614952a54c4961bfb872.tar.bz2 |
Reapply "[CodeGen] [WinException] Only produce handler data at the end of the function if needed"
This reapplies 36c64af9d7f97414d48681b74352c9684077259b in updated
form.
Emit the xdata for each function at .seh_endproc. This keeps the
exact same output header order for most code generated by the LLVM
CodeGen layer. (Sections still change order for code built from
assembly where functions lack an explicit .seh_handlerdata
directive, and functions with chained unwind info.)
The practical effect should be that assembly output lacks
superfluous ".seh_handlerdata; .text" pairs at the end of functions
that don't handle exceptions, which allows such functions to use
the AArch64 packed unwind format again.
Differential Revision: https://reviews.llvm.org/D87448
Diffstat (limited to 'llvm/lib/MC/MCStreamer.cpp')
-rw-r--r-- | llvm/lib/MC/MCStreamer.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/llvm/lib/MC/MCStreamer.cpp b/llvm/lib/MC/MCStreamer.cpp index e4216c4..0f11338 100644 --- a/llvm/lib/MC/MCStreamer.cpp +++ b/llvm/lib/MC/MCStreamer.cpp @@ -90,7 +90,7 @@ void MCTargetStreamer::emitAssignment(MCSymbol *Symbol, const MCExpr *Value) {} MCStreamer::MCStreamer(MCContext &Ctx) : Context(Ctx), CurrentWinFrameInfo(nullptr), - UseAssemblerInfoForParsing(false) { + CurrentProcWinFrameInfoStartIndex(0), UseAssemblerInfoForParsing(false) { SectionStack.push_back(std::pair<MCSectionSubPair, MCSectionSubPair>()); } @@ -692,6 +692,7 @@ void MCStreamer::EmitWinCFIStartProc(const MCSymbol *Symbol, SMLoc Loc) { MCSymbol *StartProc = emitCFILabel(); + CurrentProcWinFrameInfoStartIndex = WinFrameInfos.size(); WinFrameInfos.emplace_back( std::make_unique<WinEH::FrameInfo>(Symbol, StartProc)); CurrentWinFrameInfo = WinFrameInfos.back().get(); @@ -709,6 +710,11 @@ void MCStreamer::EmitWinCFIEndProc(SMLoc Loc) { CurFrame->End = Label; if (!CurFrame->FuncletOrFuncEnd) CurFrame->FuncletOrFuncEnd = CurFrame->End; + + for (size_t I = CurrentProcWinFrameInfoStartIndex, E = WinFrameInfos.size(); + I != E; ++I) + EmitWindowsUnwindTables(WinFrameInfos[I].get()); + SwitchSection(CurFrame->TextSection); } void MCStreamer::EmitWinCFIFuncletOrFuncEnd(SMLoc Loc) { @@ -967,6 +973,9 @@ void MCStreamer::emitRawText(const Twine &T) { void MCStreamer::EmitWindowsUnwindTables() { } +void MCStreamer::EmitWindowsUnwindTables(WinEH::FrameInfo *Frame) { +} + void MCStreamer::Finish(SMLoc EndLoc) { if ((!DwarfFrameInfos.empty() && !DwarfFrameInfos.back().End) || (!WinFrameInfos.empty() && !WinFrameInfos.back()->End)) { |