[AMDGPU][AsmParser][NFC] Translate parsed MIMG instructions to MCInsts automatically.
[llvm-project.git] / llvm / lib / DWARFLinkerParallel / DWARFLinkerImpl.cpp
blobdfd77af92f272761ab324f5d6445126c6ed10c67
1 //=== DWARFLinkerImpl.cpp -------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #include "DWARFLinkerImpl.h"
11 namespace llvm {
12 namespace dwarflinker_parallel {
14 /// Similar to DWARFUnitSection::getUnitForOffset(), but returning our
15 /// CompileUnit object instead.
16 CompileUnit *
17 DWARFLinkerImpl::LinkContext::getUnitForOffset(CompileUnit &CurrentCU,
18 uint64_t Offset) const {
19 if (CurrentCU.isClangModule())
20 return &CurrentCU;
22 auto CU = llvm::upper_bound(
23 CompileUnits, Offset,
24 [](uint64_t LHS, const std::unique_ptr<CompileUnit> &RHS) {
25 return LHS < RHS->getOrigUnit().getNextUnitOffset();
26 });
28 return CU != CompileUnits.end() ? CU->get() : nullptr;
31 Error DWARFLinkerImpl::createEmitter(const Triple &TheTriple,
32 OutputFileType FileType,
33 raw_pwrite_stream &OutFile) {
35 TheDwarfEmitter = std::make_unique<DwarfEmitterImpl>(
36 FileType, OutFile, OutputStrings.getTranslator(), WarningHandler);
38 return TheDwarfEmitter->init(TheTriple, "__DWARF");
41 ExtraDwarfEmitter *DWARFLinkerImpl::getEmitter() {
42 return TheDwarfEmitter.get();
45 } // end of namespace dwarflinker_parallel
46 } // namespace llvm