https://github.com/MaskRay created https://github.com/llvm/llvm-project/pull/97449
This restores 63ec52f867ada8d841dd872acf3d0cb62e2a99e8 and 46f7929879a59ec72dc75679b4201e2d314efba9, NFC changes that were unnecessarily reverted. This completes the work that merges MCAsmLayout into MCAssembler. >From c63b0df55d1c7adefda7b7682a2620af6cb4d0c3 Mon Sep 17 00:00:00 2001 From: Fangrui Song <i...@maskray.me> Date: Tue, 2 Jul 2024 10:40:37 -0700 Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?= =?UTF-8?q?l=20version?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Created using spr 1.3.5-bogner --- bolt/lib/Core/BinaryContext.cpp | 4 +--- clang/docs/tools/clang-formatted-files.txt | 1 - llvm/include/llvm/MC/MCAsmLayout.h | 22 ---------------------- llvm/include/llvm/MC/MCAssembler.h | 3 +-- llvm/lib/MC/MCAssembler.cpp | 7 ++----- llvm/lib/MC/MCExpr.cpp | 1 - llvm/tools/dsymutil/MachOUtils.cpp | 4 +--- 7 files changed, 5 insertions(+), 37 deletions(-) delete mode 100644 llvm/include/llvm/MC/MCAsmLayout.h diff --git a/bolt/lib/Core/BinaryContext.cpp b/bolt/lib/Core/BinaryContext.cpp index 3bd715d487e0f..f28a0cd6eb9c6 100644 --- a/bolt/lib/Core/BinaryContext.cpp +++ b/bolt/lib/Core/BinaryContext.cpp @@ -20,7 +20,6 @@ #include "llvm/DebugInfo/DWARF/DWARFCompileUnit.h" #include "llvm/DebugInfo/DWARF/DWARFFormValue.h" #include "llvm/DebugInfo/DWARF/DWARFUnit.h" -#include "llvm/MC/MCAsmLayout.h" #include "llvm/MC/MCAssembler.h" #include "llvm/MC/MCContext.h" #include "llvm/MC/MCDisassembler/MCDisassembler.h" @@ -2416,8 +2415,7 @@ BinaryContext::calculateEmittedSize(BinaryFunction &BF, bool FixBranches) { MCAssembler &Assembler = static_cast<MCObjectStreamer *>(Streamer.get())->getAssembler(); - MCAsmLayout Layout(Assembler); - Assembler.layout(Layout); + Assembler.layout(); // Obtain fragment sizes. std::vector<uint64_t> FragmentSizes; diff --git a/clang/docs/tools/clang-formatted-files.txt b/clang/docs/tools/clang-formatted-files.txt index 4866bd4aee634..a8ee8f1fcb87c 100644 --- a/clang/docs/tools/clang-formatted-files.txt +++ b/clang/docs/tools/clang-formatted-files.txt @@ -5357,7 +5357,6 @@ llvm/include/llvm/MC/MCAsmInfoELF.h llvm/include/llvm/MC/MCAsmInfoGOFF.h llvm/include/llvm/MC/MCAsmInfoWasm.h llvm/include/llvm/MC/MCAsmInfoXCOFF.h -llvm/include/llvm/MC/MCAsmLayout.h llvm/include/llvm/MC/MCCodeView.h llvm/include/llvm/MC/MCContext.h llvm/include/llvm/MC/MCFixedLenDisassembler.h diff --git a/llvm/include/llvm/MC/MCAsmLayout.h b/llvm/include/llvm/MC/MCAsmLayout.h deleted file mode 100644 index 33fae0a0f9766..0000000000000 --- a/llvm/include/llvm/MC/MCAsmLayout.h +++ /dev/null @@ -1,22 +0,0 @@ -//===- MCAsmLayout.h - Assembly Layout Object -------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_MC_MCASMLAYOUT_H -#define LLVM_MC_MCASMLAYOUT_H - -namespace llvm { -class MCAssembler; - -class MCAsmLayout { -public: - MCAsmLayout(MCAssembler &) {} -}; - -} // end namespace llvm - -#endif diff --git a/llvm/include/llvm/MC/MCAssembler.h b/llvm/include/llvm/MC/MCAssembler.h index df5ad0e7bdf4b..9cd65d388d247 100644 --- a/llvm/include/llvm/MC/MCAssembler.h +++ b/llvm/include/llvm/MC/MCAssembler.h @@ -46,7 +46,6 @@ class MCRelaxableFragment; class MCSymbolRefExpr; class raw_ostream; class MCAsmBackend; -class MCAsmLayout; class MCContext; class MCCodeEmitter; class MCFragment; @@ -341,7 +340,7 @@ class MCAssembler { void Finish(); // Layout all section and prepare them for emission. - void layout(MCAsmLayout &Layout); + void layout(); // FIXME: This does not belong here. bool getSubsectionsViaSymbols() const { return SubsectionsViaSymbols; } diff --git a/llvm/lib/MC/MCAssembler.cpp b/llvm/lib/MC/MCAssembler.cpp index 2fe4a3cbec9a6..14790f508323e 100644 --- a/llvm/lib/MC/MCAssembler.cpp +++ b/llvm/lib/MC/MCAssembler.cpp @@ -15,7 +15,6 @@ #include "llvm/ADT/Twine.h" #include "llvm/MC/MCAsmBackend.h" #include "llvm/MC/MCAsmInfo.h" -#include "llvm/MC/MCAsmLayout.h" #include "llvm/MC/MCCodeEmitter.h" #include "llvm/MC/MCCodeView.h" #include "llvm/MC/MCContext.h" @@ -936,7 +935,7 @@ MCAssembler::handleFixup(MCFragment &F, const MCFixup &Fixup, return std::make_tuple(Target, FixedValue, IsResolved); } -void MCAssembler::layout(MCAsmLayout &Layout) { +void MCAssembler::layout() { assert(getBackendPtr() && "Expected assembler backend"); DEBUG_WITH_TYPE("mc-dump", { errs() << "assembler backend - pre-layout\n--\n"; @@ -1073,9 +1072,7 @@ void MCAssembler::layout(MCAsmLayout &Layout) { } void MCAssembler::Finish() { - // Create the layout object. - MCAsmLayout Layout(*this); - layout(Layout); + layout(); // Write the object file. stats::ObjectBytes += getWriter().writeObject(*this); diff --git a/llvm/lib/MC/MCExpr.cpp b/llvm/lib/MC/MCExpr.cpp index 0a175ade68d78..b42a668bce23c 100644 --- a/llvm/lib/MC/MCExpr.cpp +++ b/llvm/lib/MC/MCExpr.cpp @@ -12,7 +12,6 @@ #include "llvm/Config/llvm-config.h" #include "llvm/MC/MCAsmBackend.h" #include "llvm/MC/MCAsmInfo.h" -#include "llvm/MC/MCAsmLayout.h" #include "llvm/MC/MCAssembler.h" #include "llvm/MC/MCContext.h" #include "llvm/MC/MCObjectWriter.h" diff --git a/llvm/tools/dsymutil/MachOUtils.cpp b/llvm/tools/dsymutil/MachOUtils.cpp index fba66309ca20b..d2bdcf8542b84 100644 --- a/llvm/tools/dsymutil/MachOUtils.cpp +++ b/llvm/tools/dsymutil/MachOUtils.cpp @@ -12,7 +12,6 @@ #include "LinkUtils.h" #include "llvm/ADT/SmallString.h" #include "llvm/CodeGen/NonRelocatableStringpool.h" -#include "llvm/MC/MCAsmLayout.h" #include "llvm/MC/MCAssembler.h" #include "llvm/MC/MCMachObjectWriter.h" #include "llvm/MC/MCObjectStreamer.h" @@ -381,8 +380,7 @@ bool generateDsymCompanion( auto &Writer = static_cast<MachObjectWriter &>(MCAsm.getWriter()); // Layout but don't emit. - MCAsmLayout Layout(MCAsm); - MCAsm.layout(Layout); + MCAsm.layout(); BinaryHolder InputBinaryHolder(VFS, false); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits