Skip to content

Commit 7ff0cf6

Browse files
committed
MCObjectWriter: Remove the MCAssembler argument from writeObject
1 parent 7d71a35 commit 7ff0cf6

15 files changed

+36
-34
lines changed

llvm/include/llvm/MC/MCDXContainerWriter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class DXContainerObjectWriter final : public MCObjectWriter {
4242
raw_pwrite_stream &OS)
4343
: W(OS, llvm::endianness::little), TargetObjectWriter(std::move(MOTW)) {}
4444

45-
uint64_t writeObject(MCAssembler &Asm) override;
45+
uint64_t writeObject() override;
4646
};
4747
} // end namespace llvm
4848

llvm/include/llvm/MC/MCELFObjectWriter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ class ELFObjectWriter final : public MCObjectWriter {
175175
bool isSymbolRefDifferenceFullyResolvedImpl(const MCSymbol &SymA,
176176
const MCFragment &FB, bool InSet,
177177
bool IsPCRel) const override;
178-
uint64_t writeObject(MCAssembler &Asm) override;
178+
uint64_t writeObject() override;
179179

180180
bool hasRelocationAddend() const;
181181
bool usesRela(const MCTargetOptions *TO, const MCSectionELF &Sec) const;

llvm/include/llvm/MC/MCMachObjectWriter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ class MachObjectWriter final : public MCObjectWriter {
348348

349349
void populateAddrSigSection(MCAssembler &Asm);
350350

351-
uint64_t writeObject(MCAssembler &Asm) override;
351+
uint64_t writeObject() override;
352352
};
353353
} // end namespace llvm
354354

llvm/include/llvm/MC/MCObjectWriter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ class MCObjectWriter {
125125
/// This routine is called by the assembler after layout and relaxation is
126126
/// complete, fixups have been evaluated and applied, and relocations
127127
/// generated.
128-
virtual uint64_t writeObject(MCAssembler &Asm) = 0;
128+
virtual uint64_t writeObject() = 0;
129129

130130
/// @}
131131
};

llvm/include/llvm/MC/MCSPIRVObjectWriter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class SPIRVObjectWriter final : public MCObjectWriter {
4646
void setBuildVersion(unsigned Major, unsigned Minor, unsigned Bound);
4747

4848
private:
49-
uint64_t writeObject(MCAssembler &Asm) override;
49+
uint64_t writeObject() override;
5050
void writeHeader(const MCAssembler &Asm);
5151
};
5252

llvm/include/llvm/MC/MCWinCOFFObjectWriter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class WinCOFFObjectWriter final : public MCObjectWriter {
6969
bool IsPCRel) const override;
7070
void recordRelocation(const MCFragment &F, const MCFixup &Fixup,
7171
MCValue Target, uint64_t &FixedValue) override;
72-
uint64_t writeObject(MCAssembler &Asm) override;
72+
uint64_t writeObject() override;
7373
int getSectionNumber(const MCSection &Section) const;
7474
};
7575

llvm/lib/MC/ELFObjectWriter.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ struct ELFWriter {
211211

212212
void writeRelocations(const MCSectionELF &Sec);
213213

214-
uint64_t writeObject(MCAssembler &Asm);
214+
uint64_t writeObject();
215215
void writeSectionHeader(uint32_t GroupSymbolIndex, uint64_t Offset,
216216
uint64_t Size, const MCSectionELF &Section);
217217
};
@@ -1017,7 +1017,7 @@ void ELFWriter::writeSectionHeaders(const MCAssembler &Asm) {
10171017
stats::SectionHeaderBytes += W.OS.tell() - Start;
10181018
}
10191019

1020-
uint64_t ELFWriter::writeObject(MCAssembler &Asm) {
1020+
uint64_t ELFWriter::writeObject() {
10211021
uint64_t StartOffset = W.OS.tell();
10221022

10231023
MCContext &Ctx = getContext();
@@ -1426,13 +1426,13 @@ bool ELFObjectWriter::isSymbolRefDifferenceFullyResolvedImpl(
14261426
return &SymA.getSection() == FB.getParent();
14271427
}
14281428

1429-
uint64_t ELFObjectWriter::writeObject(MCAssembler &Asm) {
1429+
uint64_t ELFObjectWriter::writeObject() {
14301430
uint64_t Size =
1431-
ELFWriter(Asm, *this, OS, IsLittleEndian,
1431+
ELFWriter(*Asm, *this, OS, IsLittleEndian,
14321432
DwoOS ? ELFWriter::NonDwoOnly : ELFWriter::AllSections)
1433-
.writeObject(Asm);
1433+
.writeObject();
14341434
if (DwoOS)
1435-
Size += ELFWriter(Asm, *this, *DwoOS, IsLittleEndian, ELFWriter::DwoOnly)
1436-
.writeObject(Asm);
1435+
Size += ELFWriter(*Asm, *this, *DwoOS, IsLittleEndian, ELFWriter::DwoOnly)
1436+
.writeObject();
14371437
return Size;
14381438
}

llvm/lib/MC/GOFFObjectWriter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ class GOFFObjectWriter : public MCObjectWriter {
245245
// Implementation of the MCObjectWriter interface.
246246
void recordRelocation(const MCFragment &F, const MCFixup &Fixup,
247247
MCValue Target, uint64_t &FixedValue) override {}
248-
uint64_t writeObject(MCAssembler &Asm) override;
248+
uint64_t writeObject() override;
249249
};
250250
} // end anonymous namespace
251251

@@ -281,7 +281,7 @@ void GOFFObjectWriter::writeEnd() {
281281
OS.writebe<uint32_t>(ESDID); // ESDID (of entry point)
282282
}
283283

284-
uint64_t GOFFObjectWriter::writeObject(MCAssembler &Asm) {
284+
uint64_t GOFFObjectWriter::writeObject() {
285285
writeHeader();
286286
writeEnd();
287287

llvm/lib/MC/MCAssembler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -978,7 +978,7 @@ void MCAssembler::Finish() {
978978
layout();
979979

980980
// Write the object file.
981-
stats::ObjectBytes += getWriter().writeObject(*this);
981+
stats::ObjectBytes += getWriter().writeObject();
982982

983983
HasLayout = false;
984984
}

llvm/lib/MC/MCDXContainerWriter.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ using namespace llvm;
1818

1919
MCDXContainerTargetWriter::~MCDXContainerTargetWriter() {}
2020

21-
uint64_t DXContainerObjectWriter::writeObject(MCAssembler &Asm) {
21+
uint64_t DXContainerObjectWriter::writeObject() {
22+
auto &Asm = *this->Asm;
2223
// Start the file size as the header plus the size of the part offsets.
2324
// Presently DXContainer files usually contain 7-10 parts. Reserving space for
2425
// 16 part offsets gives us a little room for growth.

0 commit comments

Comments
 (0)