Skip to content

Commit 2357e89

Browse files
authored
[DWARFLinker][DWARFLinkerParallel][NFC] Refactor DWARFLinker&DWARFLinkerParallel to have a common library. Part 1. (#75925)
This patch creates DWARFLinkerBase library, places DWARFLinker code into DWARFLinker\Classic, places DWARFLinkerParallel into DWARFLinker\Parallel. updates BOLT to use new library. This patch is NFC.
1 parent 4cb1d91 commit 2357e89

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+742
-831
lines changed

bolt/lib/Rewrite/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ set(LLVM_LINK_COMPONENTS
55
MC
66
Object
77
Support
8+
DWARFLinkerBase
89
DWARFLinker
910
AsmPrinter
1011
TargetParser

bolt/lib/Rewrite/DWARFRewriter.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include "llvm/BinaryFormat/Dwarf.h"
2222
#include "llvm/CodeGen/AsmPrinter.h"
2323
#include "llvm/CodeGen/DIE.h"
24-
#include "llvm/DWARFLinker/DWARFStreamer.h"
24+
#include "llvm/DWARFLinker/Classic/DWARFStreamer.h"
2525
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
2626
#include "llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h"
2727
#include "llvm/DebugInfo/DWARF/DWARFDebugLoc.h"
@@ -178,6 +178,9 @@ translateInputToOutputLocationList(const BinaryFunction &BF,
178178
return MergedLL;
179179
}
180180

181+
using namespace dwarf_linker;
182+
using namespace dwarf_linker::classic;
183+
181184
namespace llvm {
182185
namespace bolt {
183186
/// Emits debug information into .debug_info or .debug_types section.
@@ -278,10 +281,10 @@ class DIEStreamer : public DwarfStreamer {
278281

279282
public:
280283
DIEStreamer(DIEBuilder *DIEBldr, DWARFRewriter &Rewriter,
281-
DWARFLinker::OutputFileType OutFileType,
284+
DWARFLinkerBase::OutputFileType OutFileType,
282285
raw_pwrite_stream &OutFile,
283286
std::function<StringRef(StringRef Input)> Translator,
284-
DWARFLinker::messageHandler Warning)
287+
DWARFLinkerBase::MessageHandlerTy Warning)
285288
: DwarfStreamer(OutFileType, OutFile, Translator, Warning),
286289
DIEBldr(DIEBldr), Rewriter(Rewriter){};
287290

@@ -457,7 +460,7 @@ createDIEStreamer(const Triple &TheTriple, raw_pwrite_stream &OutFile,
457460
DWARFRewriter &Rewriter) {
458461

459462
std::unique_ptr<DIEStreamer> Streamer = std::make_unique<DIEStreamer>(
460-
&DIEBldr, Rewriter, llvm::DWARFLinker::OutputFileType::Object, OutFile,
463+
&DIEBldr, Rewriter, DWARFLinkerBase::OutputFileType::Object, OutFile,
461464
[](StringRef Input) -> StringRef { return Input; },
462465
[&](const Twine &Warning, StringRef Context, const DWARFDie *) {});
463466
Error Err = Streamer->init(TheTriple, Swift5ReflectionSegmentName);

llvm/include/llvm/DWARFLinkerParallel/AddressesMap.h renamed to llvm/include/llvm/DWARFLinker/AddressesMap.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#ifndef LLVM_DWARFLINKERPARALLEL_ADDRESSESMAP_H
10-
#define LLVM_DWARFLINKERPARALLEL_ADDRESSESMAP_H
9+
#ifndef LLVM_DWARFLINKER_ADDRESSESMAP_H
10+
#define LLVM_DWARFLINKER_ADDRESSESMAP_H
1111

1212
#include "llvm/ADT/AddressRanges.h"
1313
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
@@ -17,7 +17,7 @@
1717
#include <cstdint>
1818

1919
namespace llvm {
20-
namespace dwarflinker_parallel {
20+
namespace dwarf_linker {
2121

2222
/// Mapped value in the address map is the offset to apply to the
2323
/// linked address.
@@ -186,7 +186,7 @@ class AddressesMap {
186186
}
187187
};
188188

189-
} // end of namespace dwarflinker_parallel
189+
} // namespace dwarf_linker
190190
} // end namespace llvm
191191

192-
#endif // LLVM_DWARFLINKERPARALLEL_ADDRESSESMAP_H
192+
#endif // LLVM_DWARFLINKER_ADDRESSESMAP_H

0 commit comments

Comments
 (0)