[clang] [llvm] Remove llvm/MC/MCAsmLayout.h and the unused parameter in MCAssembler::layout (PR #97449)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 2 10:41:15 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mc
Author: Fangrui Song (MaskRay)
<details>
<summary>Changes</summary>
This restores 63ec52f867ada8d841dd872acf3d0cb62e2a99e8 and
46f7929879a59ec72dc75679b4201e2d314efba9, NFC changes that were
unnecessarily reverted.
This completes the work that merges MCAsmLayout into MCAssembler.
---
Full diff: https://github.com/llvm/llvm-project/pull/97449.diff
7 Files Affected:
- (modified) bolt/lib/Core/BinaryContext.cpp (+1-3)
- (modified) clang/docs/tools/clang-formatted-files.txt (-1)
- (removed) llvm/include/llvm/MC/MCAsmLayout.h (-22)
- (modified) llvm/include/llvm/MC/MCAssembler.h (+1-2)
- (modified) llvm/lib/MC/MCAssembler.cpp (+2-5)
- (modified) llvm/lib/MC/MCExpr.cpp (-1)
- (modified) llvm/tools/dsymutil/MachOUtils.cpp (+1-3)
``````````diff
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);
``````````
</details>
https://github.com/llvm/llvm-project/pull/97449
More information about the cfe-commits
mailing list