aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/MC/MCWin64EH.cpp
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2025-07-20 21:57:57 -0700
committerFangrui Song <i@maskray.me>2025-07-20 21:57:57 -0700
commit63b9cbd6e4a581b49cb40e4603c7130699bf55a1 (patch)
tree239659b186c039ccf7e0f217eaa5e3846075e614 /llvm/lib/MC/MCWin64EH.cpp
parent6ebc42322ca7bd0261c1faa6e2d785057ab95c5f (diff)
downloadllvm-63b9cbd6e4a581b49cb40e4603c7130699bf55a1.zip
llvm-63b9cbd6e4a581b49cb40e4603c7130699bf55a1.tar.gz
llvm-63b9cbd6e4a581b49cb40e4603c7130699bf55a1.tar.bz2
MCStreamer: Add helpers and eliminate direct MCFragment operations
To facilitate optimizing the MCFragment internals, we don't want users to access MCFragment directly.
Diffstat (limited to 'llvm/lib/MC/MCWin64EH.cpp')
-rw-r--r--llvm/lib/MC/MCWin64EH.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/llvm/lib/MC/MCWin64EH.cpp b/llvm/lib/MC/MCWin64EH.cpp
index a1c049a..72a8dd7 100644
--- a/llvm/lib/MC/MCWin64EH.cpp
+++ b/llvm/lib/MC/MCWin64EH.cpp
@@ -318,15 +318,13 @@ static void EmitUnwindInfo(MCStreamer &streamer, WinEH::FrameInfo *info) {
// Emit the epilog instructions.
if (EnableUnwindV2) {
- MCFragment *DF = OS->getCurrentFragment();
-
bool IsLast = true;
for (const auto &Epilog : llvm::reverse(info->EpilogMap)) {
if (IsLast) {
IsLast = false;
uint8_t Flags = LastEpilogIsAtEnd ? 0x01 : 0;
- streamer.emitInt8(EpilogSize);
- streamer.emitInt8((Flags << 4) | Win64EH::UOP_Epilog);
+ OS->emitInt8(EpilogSize);
+ OS->emitInt8((Flags << 4) | Win64EH::UOP_Epilog);
if (LastEpilogIsAtEnd)
continue;
@@ -337,9 +335,8 @@ static void EmitUnwindInfo(MCStreamer &streamer, WinEH::FrameInfo *info) {
// layout has been completed.
auto *MCE = MCUnwindV2EpilogTargetExpr::create(*info, Epilog.second,
EpilogSize, context);
- MCFixup Fixup = MCFixup::create(DF->getContents().size(), MCE, FK_Data_2);
- DF->addFixup(Fixup);
- DF->appendContents(2, 0);
+ OS->addFixup(MCE, FK_Data_2);
+ OS->appendContents(2, 0);
}
}
if (AddPaddingEpilogCode)