aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/MC/MCStreamer.cpp
diff options
context:
space:
mode:
authorDaniel Paoliello <danpao@microsoft.com>2025-01-30 13:51:30 -0800
committerGitHub <noreply@github.com>2025-01-30 13:51:30 -0800
commitb3458fdec5e183b49c634b72b828630bb6972400 (patch)
tree163e09c2ab19495a8d7cecc9db1ed33c1b874d99 /llvm/lib/MC/MCStreamer.cpp
parentfabe747bf051697cde72a963f1012d6ba9c3f5f5 (diff)
downloadllvm-b3458fdec5e183b49c634b72b828630bb6972400.zip
llvm-b3458fdec5e183b49c634b72b828630bb6972400.tar.gz
llvm-b3458fdec5e183b49c634b72b828630bb6972400.tar.bz2
[llvm] Win x64 Unwind V2 1/n: Mark beginning and end of epilogs (#110024)
Windows x64 Unwind V2 adds epilog information to unwind data: specifically, the length of the epilog and the offset of each epilog. The first step to do this is to add markers to the beginning and end of each epilog when generating Windows x64 code. I've modelled this after how LLVM was marking ARM and AArch64 epilogs in Windows (and unified the code between the three).
Diffstat (limited to 'llvm/lib/MC/MCStreamer.cpp')
-rw-r--r--llvm/lib/MC/MCStreamer.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCStreamer.cpp b/llvm/lib/MC/MCStreamer.cpp
index e690723..462ebfe 100644
--- a/llvm/lib/MC/MCStreamer.cpp
+++ b/llvm/lib/MC/MCStreamer.cpp
@@ -1013,6 +1013,36 @@ void MCStreamer::emitWinCFIEndProlog(SMLoc Loc) {
CurFrame->PrologEnd = Label;
}
+void MCStreamer::emitWinCFIBeginEpilogue(SMLoc Loc) {
+ WinEH::FrameInfo *CurFrame = EnsureValidWinFrameInfo(Loc);
+ if (!CurFrame)
+ return;
+
+ if (!CurFrame->PrologEnd)
+ return getContext().reportError(
+ Loc, "starting epilogue (.seh_startepilogue) before prologue has ended "
+ "(.seh_endprologue) in " +
+ CurFrame->Function->getName());
+
+ InEpilogCFI = true;
+ CurrentEpilog = emitCFILabel();
+}
+
+void MCStreamer::emitWinCFIEndEpilogue(SMLoc Loc) {
+ WinEH::FrameInfo *CurFrame = EnsureValidWinFrameInfo(Loc);
+ if (!CurFrame)
+ return;
+
+ if (!InEpilogCFI)
+ return getContext().reportError(Loc, "Stray .seh_endepilogue in " +
+ CurFrame->Function->getName());
+
+ InEpilogCFI = false;
+ MCSymbol *Label = emitCFILabel();
+ CurFrame->EpilogMap[CurrentEpilog].End = Label;
+ CurrentEpilog = nullptr;
+}
+
void MCStreamer::emitCOFFSafeSEH(MCSymbol const *Symbol) {}
void MCStreamer::emitCOFFSymbolIndex(MCSymbol const *Symbol) {}