23#ifndef LLVM_OBJECT_IRSYMTAB_H
24#define LLVM_OBJECT_IRSYMTAB_H
65template <
typename T>
struct Range {
253 return R.get(Symtab);
265 Modules = range(header().Modules);
266 Comdats = range(header().Comdats);
267 Symbols = range(header().Symbols);
268 Uncommons = range(header().Uncommons);
269 DependentLibraries = range(header().DependentLibraries);
292 std::vector<std::pair<StringRef, llvm::Comdat::SelectionKind>>
294 std::vector<std::pair<StringRef, llvm::Comdat::SelectionKind>> ComdatTable;
295 ComdatTable.reserve(Comdats.size());
296 for (
auto C : Comdats)
307 std::vector<StringRef> Specifiers;
308 Specifiers.reserve(DependentLibraries.size());
309 for (
auto S : DependentLibraries) {
310 Specifiers.push_back(str(S));
327 Name = R->str(SymI->Name);
328 IRName = R->str(SymI->IRName);
345 : SymI(SymI), SymE(SymE), UncI(UncI), R(R) {
360 return {
SymbolRef(Symbols.begin(), Symbols.end(), Uncommons.begin(),
this),
361 SymbolRef(Symbols.end(), Symbols.end(),
nullptr,
this)};
367 *MEnd = Symbols.begin() + M.End;
368 return {
SymbolRef(MBegin, MEnd, Uncommons.begin() + M.UncBegin,
this),
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file defines the BumpPtrAllocator interface.
Represent a constant reference to an array (0 or more elements consecutively in memory),...
Lightweight error class with error context and mandatory checking.
Tagged union holding either a T or a Error.
VisibilityTypes
An enumeration for the kinds of visibility of global values.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Represent a constant reference to a string, i.e.
constexpr const char * data() const
Get a pointer to the start of the string (which may not be null terminated).
Utility for building string tables with deduplicated suffixes.
Ephemeral symbols produced by Reader::symbols() and Reader::module_symbols().
SymbolRef(const storage::Symbol *SymI, const storage::Symbol *SymE, const storage::Uncommon *UncI, const Reader *R)
bool operator==(const SymbolRef &Other) const
This class can be used to read a Symtab and Strtab produced by irsymtab::build.
Reader(StringRef Symtab, StringRef Strtab)
symbol_range module_symbols(unsigned I) const
Returns a slice of the symbol table for the I'th module in the file.
symbol_range symbols() const
Returns the symbol table for the entire bitcode file.
StringRef getTargetTriple() const
std::vector< std::pair< StringRef, llvm::Comdat::SelectionKind > > getComdatTable() const
Returns a table with all the comdats used by this file.
StringRef getCOFFLinkerOpts() const
COFF-specific: returns linker options specified in the input file.
StringRef getSourceFileName() const
Returns the source file path specified at compile time.
std::vector< StringRef > getDependentLibraries() const
Returns dependent library specifiers.
size_t getNumModules() const
iterator_range< object::content_iterator< SymbolRef > > symbol_range
A range adaptor for a pair of iterators.
This provides a very simple, boring adaptor for a begin and end iterator into a range type.
This file contains the declaration of the Comdat class, which represents a single COMDAT in LLVM.
@ C
The default llvm calling convention, compatible with C.
support::ulittle32_t Word
LLVM_ABI Expected< FileContents > readBitcode(const BitcodeFileContents &BFC)
Reads the contents of a bitcode file, creating its irsymtab if necessary.
LLVM_ABI Error build(ArrayRef< Module * > Mods, SmallVector< char, 0 > &Symtab, StringTableBuilder &StrtabBuilder, BumpPtrAllocator &Alloc)
Fills in Symtab and StrtabBuilder with a valid symbol and string table for Mods.
detail::packed_endian_specific_integral< uint64_t, llvm::endianness::little, unaligned > ulittle64_t
detail::packed_endian_specific_integral< uint32_t, llvm::endianness::little, unaligned > ulittle32_t
This is an optimization pass for GlobalISel generic memory operations.
BumpPtrAllocatorImpl<> BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template parameters.
The contents of the irsymtab in a bitcode file.
SmallVector< char, 0 > Strtab
SmallVector< char, 0 > Symtab
This represents a symbol that has been read from a storage::Symbol and possibly a storage::Uncommon.
StringRef getName() const
Returns the mangled symbol name.
bool canBeOmittedFromSymbolTable() const
StringRef getSectionName() const
bool isUnnamedAddr() const
StringRef COFFWeakExternFallbackName
uint32_t getCommonAlignment() const
bool isFormatSpecific() const
bool isExecutable() const
uint64_t getCommonSize() const
int getComdatIndex() const
Returns the index into the comdat table (see Reader::getComdatTable()), or -1 if not a comdat member.
GlobalValue::VisibilityTypes getVisibility() const
StringRef getIRName() const
Returns the unmangled symbol name, or the empty string if this is not an IR symbol.
StringRef getCOFFWeakExternalFallback() const
COFF-specific: for weak externals, returns the name of the symbol that is used as a fallback if the w...
This is equivalent to an IR comdat.
Describes the range of a particular module's symbols within the symbol table.
Word UncBegin
The index of the first Uncommon for this Module.
A reference to a range of objects in the symbol table.
ArrayRef< T > get(StringRef Symtab) const
A reference to a string in the string table.
StringRef get(StringRef Strtab) const
Contains the information needed by linkers for symbol resolution, as well as by the LTO implementatio...
Str Name
The mangled symbol name.
Str IRName
The unmangled symbol name, or the empty string if this is not an IR symbol.
Word ComdatIndex
The index into Header::Comdats, or -1 if not a comdat member.
This data structure contains rarely used symbol fields and is optionally referenced by a Symbol.
Str SectionName
Specified section name, if any.
Str COFFWeakExternFallbackName
COFF-specific: the name of the symbol that a weak external resolves to if not defined.
support::ulittle64_t CommonSize