File tree Expand file tree Collapse file tree 4 files changed +11
-29
lines changed Expand file tree Collapse file tree 4 files changed +11
-29
lines changed Original file line number Diff line number Diff line change 14
14
#include " llvm/CodeGen/AccelTable.h"
15
15
#include " llvm/CodeGen/NonRelocatableStringpool.h"
16
16
#include " llvm/DWARFLinker/Classic/DWARFLinkerCompileUnit.h"
17
+ #include " llvm/DWARFLinker/IndexedValuesMap.h"
17
18
#include " llvm/DWARFLinker/DWARFLinkerBase.h"
18
19
#include " llvm/DebugInfo/DWARF/DWARFContext.h"
19
20
#include " llvm/DebugInfo/DWARF/DWARFDebugLine.h"
@@ -33,25 +34,7 @@ namespace classic {
33
34
class DeclContextTree ;
34
35
35
36
using Offset2UnitMap = DenseMap<uint64_t , CompileUnit *>;
36
-
37
- struct DebugDieValuePool {
38
- DenseMap<uint64_t , uint64_t > DieValueMap;
39
- SmallVector<uint64_t > DieValues;
40
-
41
- uint64_t getValueIndex (uint64_t Value) {
42
- DenseMap<uint64_t , uint64_t >::iterator It = DieValueMap.find (Value);
43
- if (It == DieValueMap.end ()) {
44
- It = DieValueMap.insert (std::make_pair (Value, DieValues.size ())).first ;
45
- DieValues.push_back (Value);
46
- }
47
- return It->second ;
48
- }
49
-
50
- void clear () {
51
- DieValueMap.clear ();
52
- DieValues.clear ();
53
- }
54
- };
37
+ using DebugDieValuePool = IndexedValuesMap<uint64_t >;
55
38
56
39
// / DwarfEmitter presents interface to generate all debug info tables.
57
40
class DwarfEmitter {
Original file line number Diff line number Diff line change 6
6
//
7
7
// ===----------------------------------------------------------------------===//
8
8
9
- #ifndef LLVM_LIB_DWARFLINKER_PARALLEL_INDEXEDVALUESMAP_H
10
- #define LLVM_LIB_DWARFLINKER_PARALLEL_INDEXEDVALUESMAP_H
9
+ #ifndef LLVM_DWARFLINKER_INDEXEDVALUESMAP_H
10
+ #define LLVM_DWARFLINKER_INDEXEDVALUESMAP_H
11
11
12
12
#include " llvm/ADT/DenseMap.h"
13
13
#include " llvm/ADT/SmallVector.h"
16
16
17
17
namespace llvm {
18
18
namespace dwarf_linker {
19
- namespace parallel {
20
19
20
+ // / This class stores values sequentually and assigns index to the each value.
21
21
template <typename T> class IndexedValuesMap {
22
22
public:
23
23
uint64_t getValueIndex (T Value) {
@@ -29,7 +29,7 @@ template <typename T> class IndexedValuesMap {
29
29
return It->second ;
30
30
}
31
31
32
- const SmallVector<T> &getValues () { return Values; }
32
+ const SmallVector<T> &getValues () const { return Values; }
33
33
34
34
void clear () {
35
35
ValueToIndexMap.clear ();
@@ -44,8 +44,7 @@ template <typename T> class IndexedValuesMap {
44
44
SmallVector<T> Values;
45
45
};
46
46
47
- } // end of namespace parallel
48
47
} // end of namespace dwarf_linker
49
48
} // end of namespace llvm
50
49
51
- #endif // LLVM_LIB_DWARFLINKER_PARALLEL_INDEXEDVALUESMAP_H
50
+ #endif // LLVM_DWARFLINKER_INDEXEDVALUESMAP_H
Original file line number Diff line number Diff line change @@ -2048,13 +2048,13 @@ void DWARFLinker::DIECloner::emitDebugAddrSection(
2048
2048
if (DwarfVersion < 5 )
2049
2049
return ;
2050
2050
2051
- if (AddrPool.DieValues .empty ())
2051
+ if (AddrPool.getValues () .empty ())
2052
2052
return ;
2053
2053
2054
2054
MCSymbol *EndLabel = Emitter->emitDwarfDebugAddrsHeader (Unit);
2055
2055
patchAddrBase (*Unit.getOutputUnitDIE (),
2056
2056
DIEInteger (Emitter->getDebugAddrSectionSize ()));
2057
- Emitter->emitDwarfDebugAddrs (AddrPool.DieValues ,
2057
+ Emitter->emitDwarfDebugAddrs (AddrPool.getValues () ,
2058
2058
Unit.getOrigUnit ().getAddressByteSize ());
2059
2059
Emitter->emitDwarfDebugAddrsFooter (Unit, EndLabel);
2060
2060
}
@@ -2880,7 +2880,7 @@ Error DWARFLinker::link() {
2880
2880
if (TheDwarfEmitter != nullptr ) {
2881
2881
TheDwarfEmitter->emitAbbrevs (Abbreviations, Options.TargetDWARFVersion );
2882
2882
TheDwarfEmitter->emitStrings (DebugStrPool);
2883
- TheDwarfEmitter->emitStringOffsets (StringOffsetPool.DieValues ,
2883
+ TheDwarfEmitter->emitStringOffsets (StringOffsetPool.getValues () ,
2884
2884
Options.TargetDWARFVersion );
2885
2885
TheDwarfEmitter->emitLineStrings (DebugLineStrPool);
2886
2886
for (AccelTableKind TableKind : Options.AccelTables ) {
Original file line number Diff line number Diff line change 10
10
#define LLVM_LIB_DWARFLINKER_PARALLEL_DWARFLINKERUNIT_H
11
11
12
12
#include " DWARFLinkerGlobalData.h"
13
- #include " IndexedValuesMap.h"
14
13
#include " OutputSections.h"
15
14
#include " llvm/CodeGen/DIE.h"
16
15
#include " llvm/DWARFLinker/Parallel/DWARFLinker.h"
16
+ #include " llvm/DWARFLinker/IndexedValuesMap.h"
17
17
#include " llvm/DWARFLinker/StringPool.h"
18
18
#include " llvm/DebugInfo/DWARF/DWARFUnit.h"
19
19
#include " llvm/Support/LEB128.h"
You can’t perform that action at this time.
0 commit comments