[llvm] b201ab8 - [MC] Move setIncrementalLinkerCompatible() calls to MCWinCOFFStreamer
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 19 23:36:37 PDT 2024
Author: Fangrui Song
Date: 2024-07-19T23:36:31-07:00
New Revision: b201ab8adc812f025490388ef89d5547e63b9d1e
URL: https://github.com/llvm/llvm-project/commit/b201ab8adc812f025490388ef89d5547e63b9d1e
DIFF: https://github.com/llvm/llvm-project/commit/b201ab8adc812f025490388ef89d5547e63b9d1e.diff
LOG: [MC] Move setIncrementalLinkerCompatible() calls to MCWinCOFFStreamer
Similar to setRelaxAll (45b59cb1d42b57a40c79a61afc8d1b8892826480).
Added:
Modified:
llvm/lib/MC/MCWinCOFFStreamer.cpp
llvm/lib/Target/AArch64/MCTargetDesc/AArch64WinCOFFStreamer.cpp
llvm/lib/Target/ARM/MCTargetDesc/ARMWinCOFFStreamer.cpp
llvm/lib/Target/X86/MCTargetDesc/X86WinCOFFStreamer.cpp
Removed:
################################################################################
diff --git a/llvm/lib/MC/MCWinCOFFStreamer.cpp b/llvm/lib/MC/MCWinCOFFStreamer.cpp
index 538244cb8ba6a..a14d3bcf37f3f 100644
--- a/llvm/lib/MC/MCWinCOFFStreamer.cpp
+++ b/llvm/lib/MC/MCWinCOFFStreamer.cpp
@@ -27,6 +27,7 @@
#include "llvm/MC/MCObjectWriter.h"
#include "llvm/MC/MCSectionCOFF.h"
#include "llvm/MC/MCSymbolCOFF.h"
+#include "llvm/MC/MCTargetOptions.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
@@ -45,7 +46,11 @@ MCWinCOFFStreamer::MCWinCOFFStreamer(MCContext &Context,
std::unique_ptr<MCCodeEmitter> CE,
std::unique_ptr<MCObjectWriter> OW)
: MCObjectStreamer(Context, std::move(MAB), std::move(OW), std::move(CE)),
- CurSymbol(nullptr) {}
+ CurSymbol(nullptr) {
+ auto *TO = Context.getTargetOptions();
+ if (TO && TO->MCIncrementalLinkerCompatible)
+ getAssembler().setIncrementalLinkerCompatible(true);
+}
void MCWinCOFFStreamer::emitInstToData(const MCInst &Inst,
const MCSubtargetInfo &STI) {
diff --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64WinCOFFStreamer.cpp b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64WinCOFFStreamer.cpp
index c25cc2e99adca..6f2826348d0bc 100644
--- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64WinCOFFStreamer.cpp
+++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64WinCOFFStreamer.cpp
@@ -295,8 +295,6 @@ MCWinCOFFStreamer *llvm::createAArch64WinCOFFStreamer(
MCContext &Context, std::unique_ptr<MCAsmBackend> MAB,
std::unique_ptr<MCObjectWriter> OW, std::unique_ptr<MCCodeEmitter> Emitter,
bool IncrementalLinkerCompatible) {
- auto *S = new AArch64WinCOFFStreamer(Context, std::move(MAB),
- std::move(Emitter), std::move(OW));
- S->getAssembler().setIncrementalLinkerCompatible(IncrementalLinkerCompatible);
- return S;
+ return new AArch64WinCOFFStreamer(Context, std::move(MAB), std::move(Emitter),
+ std::move(OW));
}
diff --git a/llvm/lib/Target/ARM/MCTargetDesc/ARMWinCOFFStreamer.cpp b/llvm/lib/Target/ARM/MCTargetDesc/ARMWinCOFFStreamer.cpp
index 0fcf6eb1a5abb..c7c297ab09799 100644
--- a/llvm/lib/Target/ARM/MCTargetDesc/ARMWinCOFFStreamer.cpp
+++ b/llvm/lib/Target/ARM/MCTargetDesc/ARMWinCOFFStreamer.cpp
@@ -72,10 +72,8 @@ llvm::createARMWinCOFFStreamer(MCContext &Context,
std::unique_ptr<MCObjectWriter> &&OW,
std::unique_ptr<MCCodeEmitter> &&Emitter,
bool IncrementalLinkerCompatible) {
- auto *S = new ARMWinCOFFStreamer(Context, std::move(MAB), std::move(Emitter),
- std::move(OW));
- S->getAssembler().setIncrementalLinkerCompatible(IncrementalLinkerCompatible);
- return S;
+ return new ARMWinCOFFStreamer(Context, std::move(MAB), std::move(Emitter),
+ std::move(OW));
}
namespace {
diff --git a/llvm/lib/Target/X86/MCTargetDesc/X86WinCOFFStreamer.cpp b/llvm/lib/Target/X86/MCTargetDesc/X86WinCOFFStreamer.cpp
index b1e5362c5d24b..481866431364d 100644
--- a/llvm/lib/Target/X86/MCTargetDesc/X86WinCOFFStreamer.cpp
+++ b/llvm/lib/Target/X86/MCTargetDesc/X86WinCOFFStreamer.cpp
@@ -77,9 +77,5 @@ MCStreamer *llvm::createX86WinCOFFStreamer(MCContext &C,
std::unique_ptr<MCObjectWriter> &&OW,
std::unique_ptr<MCCodeEmitter> &&CE,
bool IncrementalLinkerCompatible) {
- X86WinCOFFStreamer *S =
- new X86WinCOFFStreamer(C, std::move(AB), std::move(CE), std::move(OW));
- S->getAssembler().setIncrementalLinkerCompatible(IncrementalLinkerCompatible);
- return S;
+ return new X86WinCOFFStreamer(C, std::move(AB), std::move(CE), std::move(OW));
}
-
More information about the llvm-commits
mailing list