Remove llvm/MC/MCAsmLayout.h and the unused parameter in MCAssembler::layout

This restores 63ec52f867 and
46f7929879, NFC changes that were
unnecessarily reverted.

This completes the work that merges MCAsmLayout into MCAssembler.

Pull Request: https://github.com/llvm/llvm-project/pull/97449
This commit is contained in:
Fangrui Song
2024-07-02 16:56:35 -07:00
committed by GitHub
parent a1c4926dd0
commit 35668e2c9c
7 changed files with 5 additions and 37 deletions

View File

@@ -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;

View File

@@ -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

View File

@@ -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

View File

@@ -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 @@ public:
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; }

View File

@@ -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);

View File

@@ -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"

View File

@@ -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);