LLVM: lib/CodeGen/NonRelocatableStringpool.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
11
12using namespace llvm;
13
15 auto I = Strings.try_emplace(S);
16 auto &Entry = I.first->second;
17 if (I.second || !Entry.isIndexed()) {
18 Entry.Index = NumEntries++;
19 Entry.Offset = CurrentEndOffset;
20 Entry.Symbol = nullptr;
21 CurrentEndOffset += S.size() + 1;
22 }
24}
25
28
29 auto InsertResult = Strings.insert({S, Entry});
30 return InsertResult.first->getKey();
31}
32
33std::vector
35 std::vector Result;
36 Result.reserve(Strings.size());
37 for (const auto &E : Strings)
38 if (E.getValue().isIndexed())
39 Result.emplace_back(E);
42 return A.getIndex() < B.getIndex();
43 });
44 return Result;
45}
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
DwarfStringPoolEntryRef: Dwarf string pool entry reference.
LLVM_ABI StringRef internString(StringRef S)
Get permanent storage for S (but do not necessarily emit S in the output section).
Definition NonRelocatableStringpool.cpp:26
LLVM_ABI DwarfStringPoolEntryRef getEntry(StringRef S)
Definition NonRelocatableStringpool.cpp:14
LLVM_ABI std::vector< DwarfStringPoolEntryRef > getEntriesForEmission() const
Return the list of strings to be emitted.
Definition NonRelocatableStringpool.cpp:34
StringRef - Represent a constant reference to a string, i.e.
constexpr size_t size() const
size - Get the string size.
This is an optimization pass for GlobalISel generic memory operations.
void sort(IteratorTy Start, IteratorTy End)
Data for a string pool entry.
static constexpr unsigned NotIndexed