[llvm] e8e05c3 - [MC] Remove the MCAsmLayout parameter from MCAsmBackend::finishLayout
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 1 17:36:22 PDT 2024
Author: Fangrui Song
Date: 2024-07-01T17:36:16-07:00
New Revision: e8e05c3192af5c4a71cd2af03c1425158fc647cd
URL: https://github.com/llvm/llvm-project/commit/e8e05c3192af5c4a71cd2af03c1425158fc647cd
DIFF: https://github.com/llvm/llvm-project/commit/e8e05c3192af5c4a71cd2af03c1425158fc647cd.diff
LOG: [MC] Remove the MCAsmLayout parameter from MCAsmBackend::finishLayout
And remove unnecessary MCAssembler::finishLayout.
Added:
Modified:
llvm/include/llvm/MC/MCAsmBackend.h
llvm/include/llvm/MC/MCAssembler.h
llvm/lib/MC/MCAssembler.cpp
llvm/lib/Target/Hexagon/MCTargetDesc/HexagonAsmBackend.cpp
llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/MC/MCAsmBackend.h b/llvm/include/llvm/MC/MCAsmBackend.h
index 7841e8aac2542..f91c8e1fc9af3 100644
--- a/llvm/include/llvm/MC/MCAsmBackend.h
+++ b/llvm/include/llvm/MC/MCAsmBackend.h
@@ -24,7 +24,6 @@ class MCFragment;
class MCLEBFragment;
class MCRelaxableFragment;
class MCSymbol;
-class MCAsmLayout;
class MCAssembler;
class MCContext;
struct MCDwarfFrameInfo;
@@ -219,8 +218,7 @@ class MCAsmBackend {
const MCSubtargetInfo *STI) const = 0;
/// Give backend an opportunity to finish layout after relaxation
- virtual void finishLayout(MCAssembler const &Asm,
- MCAsmLayout &Layout) const {}
+ virtual void finishLayout(MCAssembler const &Asm) const {}
/// Handle any target-specific assembler flags. By default, do nothing.
virtual void handleAssemblerFlag(MCAssemblerFlag Flag) {}
diff --git a/llvm/include/llvm/MC/MCAssembler.h b/llvm/include/llvm/MC/MCAssembler.h
index cc0267ea4c220..4eb0a91c71756 100644
--- a/llvm/include/llvm/MC/MCAssembler.h
+++ b/llvm/include/llvm/MC/MCAssembler.h
@@ -210,9 +210,6 @@ class MCAssembler {
bool relaxCVDefRange(MCCVDefRangeFragment &DF);
bool relaxPseudoProbeAddr(MCPseudoProbeAddrFragment &DF);
- /// finishLayout - Finalize a layout, including fragment lowering.
- void finishLayout(MCAsmLayout &Layout);
-
std::tuple<MCValue, uint64_t, bool>
handleFixup(MCFragment &F, const MCFixup &Fixup, const MCSubtargetInfo *STI);
diff --git a/llvm/lib/MC/MCAssembler.cpp b/llvm/lib/MC/MCAssembler.cpp
index f820cc9eef7fe..0a6bb52a3b8f4 100644
--- a/llvm/lib/MC/MCAssembler.cpp
+++ b/llvm/lib/MC/MCAssembler.cpp
@@ -984,7 +984,7 @@ void MCAssembler::layout(MCAsmLayout &Layout) {
dump(); });
// Finalize the layout, including fragment lowering.
- finishLayout(Layout);
+ getBackend().finishLayout(*this);
DEBUG_WITH_TYPE("mc-dump", {
errs() << "assembler backend - final-layout\n--\n";
@@ -1350,11 +1350,6 @@ bool MCAssembler::layoutOnce() {
return Changed;
}
-void MCAssembler::finishLayout(MCAsmLayout &Layout) {
- assert(getBackendPtr() && "Expected assembler backend");
- getBackend().finishLayout(*this, Layout);
-}
-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
LLVM_DUMP_METHOD void MCAssembler::dump() const{
raw_ostream &OS = errs();
diff --git a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonAsmBackend.cpp b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonAsmBackend.cpp
index 2ce91bdf3996c..e9f49f67583d7 100644
--- a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonAsmBackend.cpp
+++ b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonAsmBackend.cpp
@@ -703,8 +703,7 @@ class HexagonAsmBackend : public MCAsmBackend {
return true;
}
- void finishLayout(MCAssembler const &Asm,
- MCAsmLayout &Layout) const override {
+ void finishLayout(MCAssembler const &Asm) const override {
SmallVector<MCFragment *> Frags;
for (MCSection &Sec : Asm) {
Frags.clear();
diff --git a/llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp b/llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
index 670ff35613dbc..2b2cbfb175dbb 100644
--- a/llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
+++ b/llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
@@ -202,7 +202,7 @@ class X86AsmBackend : public MCAsmBackend {
bool padInstructionEncoding(MCRelaxableFragment &RF, MCCodeEmitter &Emitter,
unsigned &RemainingSize) const;
- void finishLayout(MCAssembler const &Asm, MCAsmLayout &Layout) const override;
+ void finishLayout(const MCAssembler &Asm) const override;
unsigned getMaximumNopSize(const MCSubtargetInfo &STI) const override;
@@ -857,8 +857,7 @@ bool X86AsmBackend::padInstructionEncoding(MCRelaxableFragment &RF,
return Changed;
}
-void X86AsmBackend::finishLayout(MCAssembler const &Asm,
- MCAsmLayout &Layout) const {
+void X86AsmBackend::finishLayout(MCAssembler const &Asm) const {
// See if we can further relax some instructions to cut down on the number of
// nop bytes required for code alignment. The actual win is in reducing
// instruction count, not number of bytes. Modern X86-64 can easily end up
More information about the llvm-commits
mailing list