LLVM: lib/ExecutionEngine/JITLink/DWARFRecordSectionSplitter.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
11
12#define DEBUG_TYPE "jitlink"
13
14namespace llvm {
15namespace jitlink {
16
18 : SectionName(SectionName) {}
19
21 auto *Section = G.findSectionByName(SectionName);
22
25 dbgs() << "DWARFRecordSectionSplitter: No " << SectionName
26 << " section. Nothing to do\n";
27 });
29 }
30
32 dbgs() << "DWARFRecordSectionSplitter: Processing " << SectionName
33 << "...\n";
34 });
35
37
38 {
39
41 Caches[B] = LinkGraph::SplitBlockCache::value_type();
43 Caches[&Sym->getBlock()]->push_back(Sym);
46 return LHS->getOffset() > RHS->getOffset();
47 });
48 }
49
50
51
52
53 for (auto &KV : Caches) {
54 auto &B = *KV.first;
55 auto &BCache = KV.second;
56 if (auto Err = processBlock(G, B, BCache))
57 return Err;
58 }
59
61}
62
63Error DWARFRecordSectionSplitter::processBlock(
65 LLVM_DEBUG(dbgs() << " Processing block at " << B.getAddress() << "\n");
66
67
68 if (B.isZeroFill())
71
72 if (B.getSize() == 0) {
75 }
76
78 StringRef(B.getContent().data(), B.getContent().size()),
79 G.getEndianness());
80
81 std::vectorEdge::OffsetT SplitOffsets;
82 while (true) {
84 dbgs() << " Processing CFI record at "
85 << (B.getAddress() + BlockReader.getOffset()) << "\n";
86 });
87
89 if (auto Err = BlockReader.readInteger(Length))
90 return Err;
91 if (Length != 0xffffffff) {
92 if (auto Err = BlockReader.skip(Length))
93 return Err;
94 } else {
95 uint64_t ExtendedLength;
96 if (auto Err = BlockReader.readInteger(ExtendedLength))
97 return Err;
98 if (auto Err = BlockReader.skip(ExtendedLength))
99 return Err;
100 }
101
102
103 if (BlockReader.empty())
104 break;
105
106 SplitOffsets.push_back(BlockReader.getOffset());
107 }
108
109 G.splitBlock(B, SplitOffsets);
110
112}
113
114}
115}
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
Provides read only access to a subclass of BinaryStream.
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
StringRef - Represent a constant reference to a string, i.e.
An Addressable with content and edges.
DWARFRecordSectionSplitter(StringRef SectionName)
Definition DWARFRecordSectionSplitter.cpp:17
Error operator()(LinkGraph &G)
Definition DWARFRecordSectionSplitter.cpp:20
std::optional< SmallVector< Symbol *, 8 > > SplitBlockCache
Cache type for the splitBlock function.
Represents an object file section.
iterator_range< symbol_iterator > symbols()
Returns an iterator over the symbols defined in this section.
iterator_range< block_iterator > blocks()
Returns an iterator over the blocks defined in this section.
This is an optimization pass for GlobalISel generic memory operations.
void sort(IteratorTy Start, IteratorTy End)
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Error make_error(ArgTs &&... Args)
Make a Error instance representing failure using the given error info type.