Skip to content

Commit e3e0df3

Browse files
committed
[BOLT] Replace the MCAsmLayout parameter with MCAssembler
Continue the MCAsmLayout removal work started by 67957a4.
1 parent 057f28b commit e3e0df3

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

bolt/include/bolt/Rewrite/DWARFRewriter.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include "llvm/ADT/StringRef.h"
1717
#include "llvm/CodeGen/DIE.h"
1818
#include "llvm/DWP/DWP.h"
19-
#include "llvm/MC/MCAsmLayout.h"
2019
#include "llvm/MC/MCContext.h"
2120
#include "llvm/Support/ToolOutputFile.h"
2221
#include <cstdint>
@@ -183,7 +182,7 @@ class DWARFRewriter {
183182
void updateDebugInfo();
184183

185184
/// Update stmt_list for CUs based on the new .debug_line \p Layout.
186-
void updateLineTableOffsets(const MCAsmLayout &Layout);
185+
void updateLineTableOffsets(const MCAssembler &Asm);
187186

188187
uint64_t getDwoRangesBase(uint64_t DWOId) { return DwoRangesBase[DWOId]; }
189188

bolt/lib/Rewrite/DWARFRewriter.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
#include "llvm/DebugInfo/DWARF/DWARFTypeUnit.h"
3030
#include "llvm/DebugInfo/DWARF/DWARFUnit.h"
3131
#include "llvm/MC/MCAsmBackend.h"
32-
#include "llvm/MC/MCAsmLayout.h"
3332
#include "llvm/MC/MCAssembler.h"
3433
#include "llvm/MC/MCObjectWriter.h"
3534
#include "llvm/MC/MCStreamer.h"
@@ -1352,7 +1351,7 @@ void DWARFRewriter::updateDWARFObjectAddressRanges(
13521351
}
13531352
}
13541353

1355-
void DWARFRewriter::updateLineTableOffsets(const MCAsmLayout &Layout) {
1354+
void DWARFRewriter::updateLineTableOffsets(const MCAssembler &Asm) {
13561355
ErrorOr<BinarySection &> DbgInfoSection =
13571356
BC.getUniqueSectionByName(".debug_info");
13581357
ErrorOr<BinarySection &> TypeInfoSection =
@@ -1394,7 +1393,7 @@ void DWARFRewriter::updateLineTableOffsets(const MCAsmLayout &Layout) {
13941393
continue;
13951394

13961395
const uint64_t LineTableOffset =
1397-
Layout.getAssembler().getSymbolOffset(*Label);
1396+
Asm.getSymbolOffset(*Label);
13981397
DebugLineOffsetMap[*StmtOffset] = LineTableOffset;
13991398
assert(DbgInfoSection && ".debug_info section must exist");
14001399
LineTablePatchMap[CU.get()] = LineTableOffset;

bolt/lib/Rewrite/RewriteInstance.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
#include "llvm/DebugInfo/DWARF/DWARFDebugFrame.h"
4141
#include "llvm/MC/MCAsmBackend.h"
4242
#include "llvm/MC/MCAsmInfo.h"
43-
#include "llvm/MC/MCAsmLayout.h"
4443
#include "llvm/MC/MCDisassembler/MCDisassembler.h"
4544
#include "llvm/MC/MCObjectStreamer.h"
4645
#include "llvm/MC/MCStreamer.h"
@@ -3508,9 +3507,8 @@ void RewriteInstance::emitAndLink() {
35083507
updateOutputValues(*Linker);
35093508

35103509
if (opts::UpdateDebugSections) {
3511-
MCAsmLayout FinalLayout(
3512-
static_cast<MCObjectStreamer *>(Streamer.get())->getAssembler());
3513-
DebugInfoRewriter->updateLineTableOffsets(FinalLayout);
3510+
DebugInfoRewriter->updateLineTableOffsets(
3511+
static_cast<MCObjectStreamer &>(*Streamer).getAssembler());
35143512
}
35153513

35163514
if (RuntimeLibrary *RtLibrary = BC->getRuntimeLibrary())

0 commit comments

Comments
 (0)