1//===- AcceleratorRecordsSaver.h --------------------------------*- C++ -*-===//
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//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_LIB_DWARFLINKER_PARALLEL_ACCELERATORRECORDSSAVER_H
10#define LLVM_LIB_DWARFLINKER_PARALLEL_ACCELERATORRECORDSSAVER_H
11
12#include "DIEAttributeCloner.h"
13#include "DWARFLinkerCompileUnit.h"
14#include "DWARFLinkerGlobalData.h"
15#include "DWARFLinkerTypeUnit.h"
16
17namespace llvm {
18namespace dwarf_linker {
19namespace parallel {
20
21/// This class helps to store information for accelerator entries.
22/// It prepares accelerator info for the certain DIE and store it inside
23/// OutUnit.
24class AcceleratorRecordsSaver {
25public:
26 AcceleratorRecordsSaver(LinkingGlobalData &GlobalData, CompileUnit &InUnit,
27 CompileUnit *OutUnit)
28 : AcceleratorRecordsSaver(GlobalData, InUnit,
29 CompileUnit::OutputUnitVariantPtr(OutUnit)) {}
30
31 AcceleratorRecordsSaver(LinkingGlobalData &GlobalData, CompileUnit &InUnit,
32 TypeUnit *OutUnit)
33 : AcceleratorRecordsSaver(GlobalData, InUnit,
34 CompileUnit::OutputUnitVariantPtr(OutUnit)) {}
35
36 /// Save accelerator info for the specified \p OutDIE inside OutUnit.
37 /// Side effects: set attributes in \p AttrInfo.
38 void save(const DWARFDebugInfoEntry *InputDieEntry, DIE *OutDIE,
39 AttributesInfo &AttrInfo, TypeEntry *TypeEntry);
40
41protected:
42 AcceleratorRecordsSaver(LinkingGlobalData &GlobalData, CompileUnit &InUnit,
43 CompileUnit::OutputUnitVariantPtr OutUnit)
44 : GlobalData(GlobalData), InUnit(InUnit), OutUnit(OutUnit) {}
45
46 void saveObjC(const DWARFDebugInfoEntry *InputDieEntry, DIE *OutDIE,
47 AttributesInfo &AttrInfo);
48
49 void saveNameRecord(StringEntry *Name, DIE *OutDIE, dwarf::Tag Tag,
50 bool AvoidForPubSections);
51 void saveNamespaceRecord(StringEntry *Name, DIE *OutDIE, dwarf::Tag Tag,
52 TypeEntry *TypeEntry);
53 void saveObjCNameRecord(StringEntry *Name, DIE *OutDIE, dwarf::Tag Tag);
54 void saveTypeRecord(StringEntry *Name, DIE *OutDIE, dwarf::Tag Tag,
55 uint32_t QualifiedNameHash, bool ObjcClassImplementation,
56 TypeEntry *TypeEntry);
57
58 /// Global linking data.
59 LinkingGlobalData &GlobalData;
60
61 /// Comiple unit corresponding to input DWARF.
62 CompileUnit &InUnit;
63
64 /// Compile unit or Artificial type unit corresponding to the output DWARF.
65 CompileUnit::OutputUnitVariantPtr OutUnit;
66};
67
68} // end of namespace parallel
69} // end of namespace dwarf_linker
70} // end of namespace llvm
71
72#endif // LLVM_LIB_DWARFLINKER_PARALLEL_ACCELERATORRECORDSSAVER_H
73