23#ifndef LLVM_OBJECT_IRSYMTAB_H
24#define LLVM_OBJECT_IRSYMTAB_H
41struct BitcodeFileContents;
42class StringTableBuilder;
64template <
typename T>
struct Range {
248 return R.get(Symtab);
260 Modules = range(header().Modules);
261 Comdats = range(header().Comdats);
262 Symbols = range(header().Symbols);
263 Uncommons = range(header().Uncommons);
264 DependentLibraries = range(header().DependentLibraries);
287 std::vector<std::pair<StringRef, llvm::Comdat::SelectionKind>>
289 std::vector<std::pair<StringRef, llvm::Comdat::SelectionKind>> ComdatTable;
290 ComdatTable.reserve(Comdats.
size());
291 for (
auto C : Comdats)
302 std::vector<StringRef> Specifiers;
303 Specifiers.reserve(DependentLibraries.
size());
304 for (
auto S : DependentLibraries) {
305 Specifiers.push_back(str(S));
340 : SymI(SymI), SymE(SymE), UncI(UncI), R(R) {
355 return {
SymbolRef(Symbols.begin(), Symbols.end(), Uncommons.begin(),
this),
356 SymbolRef(Symbols.end(), Symbols.end(),
nullptr,
this)};
362 *MEnd = Symbols.begin() + M.End;
363 return {
SymbolRef(MBegin, MEnd, Uncommons.begin() + M.UncBegin,
this),
This file defines the BumpPtrAllocator interface.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
size - Get the array size.
Allocate memory in an ever growing pool, as if by bump-pointer.
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.
StringRef - Represent a constant reference to a string, i.e.
constexpr const char * data() const
data - 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.
iterator_range< object::content_iterator< SymbolRef > > symbol_range
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
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.
Expected< FileContents > readBitcode(const BitcodeFileContents &BFC)
Reads the contents of a bitcode file, creating its irsymtab if necessary.
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< uint32_t, llvm::endianness::little, unaligned > ulittle32_t
This is an optimization pass for GlobalISel generic memory operations.
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.