24 #ifndef LLVM_OBJECT_IRSYMTAB_H
25 #define LLVM_OBJECT_IRSYMTAB_H
40 struct BitcodeFileContents;
41 class StringTableBuilder;
63 template <
typename T>
struct Range {
67 return {
reinterpret_cast<const T *
>(Symtab.data() +
Offset),
Size};
101 FB_has_uncommon = FB_visibility + 2,
131 enum { kCurrentVersion = 0 };
194 return (
Flags >> S::FB_may_omit) & 1;
216 return COFFWeakExternFallbackName;
233 return R.
get(Symtab);
245 Modules = range(header().Modules);
246 Comdats = range(header().Comdats);
247 Symbols = range(header().Symbols);
248 Uncommons = range(header().Uncommons);
263 symbol_range module_symbols(
unsigned I)
const;
272 std::vector<StringRef> ComdatTable;
273 ComdatTable.reserve(Comdats.size());
274 for (
auto C : Comdats)
275 ComdatTable.push_back(str(
C.Name));
294 Name = R->str(SymI->Name);
295 IRName = R->str(SymI->IRName);
296 ComdatIndex = SymI->ComdatIndex;
300 CommonSize = UncI->CommonSize;
301 CommonAlign = UncI->CommonAlign;
302 COFFWeakExternFallbackName = R->str(UncI->COFFWeakExternFallbackName);
309 : SymI(SymI), SymE(SymE), UncI(UncI), R(R) {
324 return {
SymbolRef(Symbols.begin(), Symbols.end(), Uncommons.begin(),
this),
325 SymbolRef(Symbols.end(), Symbols.end(),
nullptr,
this)};
331 *MEnd = Symbols.begin() + M.
End;
349 #endif // LLVM_OBJECT_IRSYMTAB_H
uint32_t getCommonAlignment() const
StringRef getCOFFLinkerOpts() const
COFF-specific: returns linker options specified in the input file.
Contains the information needed by linkers for symbol resolution, as well as by the LTO implementatio...
bool operator==(const SymbolRef &Other) const
StringRef getCOFFWeakExternalFallback() const
COFF-specific: for weak externals, returns the name of the symbol that is used as a fallback if the w...
This provides a very simple, boring adaptor for a begin and end iterator into a range type...
Reader(StringRef Symtab, StringRef Strtab)
Word ComdatIndex
The index into Header::Comdats, or -1 if not a comdat member.
StringRef getSourceFileName() const
Returns the source file path specified at compile time.
Str IRName
The unmangled symbol name, or the empty string if this is not an IR symbol.
A reference to a range of objects in the symbol table.
The contents of the irsymtab in a bitcode file.
Tagged union holding either a T or a Error.
bool isExecutable() const
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.
Utility for building string tables with deduplicated suffixes.
SmallVector< char, 0 > Symtab
VisibilityTypes
An enumeration for the kinds of visibility of global values.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
bool isUnnamedAddr() const
A reference to a string in the string table.
Ephemeral symbols produced by Reader::symbols() and Reader::module_symbols().
Describes the range of a particular module's symbols within the symbol table.
bool canBeOmittedFromSymbolTable() const
GlobalValue::VisibilityTypes getVisibility() const
detail::packed_endian_specific_integral< uint32_t, little, unaligned > ulittle32_t
Allocate memory in an ever growing pool, as if by bump-pointer.
Str Name
The mangled symbol name.
This data structure contains rarely used symbol fields and is optionally referenced by a Symbol...
This represents a symbol that has been read from a storage::Symbol and possibly a storage::Uncommon...
StringRef getTargetTriple() const
uint64_t getCommonSize() const
StringRef getIRName() const
Returns the unmangled symbol name, or the empty string if this is not an IR symbol.
Expected< FileContents > readBitcode(const BitcodeFileContents &BFC)
Reads the contents of a bitcode file, creating its irsymtab if necessary.
A range adaptor for a pair of iterators.
size_t getNumModules() const
static bool isWeak(const MCSymbolELF &Sym)
symbol_range symbols() const
Returns the symbol table for the entire bitcode file.
int getComdatIndex() const
Returns the index into the comdat table (see Reader::getComdatTable()), or -1 if not a comdat member...
ArrayRef< T > get(StringRef Symtab) const
static std::vector< std::string > Flags
bool isFormatSpecific() const
value_type read(const void *memory, endianness endian)
Read a value of a particular endianness from memory.
SymbolRef(const storage::Symbol *SymI, const storage::Symbol *SymE, const storage::Uncommon *UncI, const Reader *R)
std::vector< StringRef > getComdatTable() const
Returns a table with all the comdats used by this file.
StringRef get(StringRef Strtab) const
symbol_range module_symbols(unsigned I) const
Returns a slice of the symbol table for the I'th module in the file.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This is equivalent to an IR comdat.
Lightweight error class with error context and mandatory checking.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
StringRef - Represent a constant reference to a string, i.e.
StringRef COFFWeakExternFallbackName
Word UncBegin
The index of the first Uncommon for this Module.
This class can be used to read a Symtab and Strtab produced by irsymtab::build.
StringRef getName() const
Returns the mangled symbol name.
Str COFFWeakExternFallbackName
COFF-specific: the name of the symbol that a weak external resolves to if not defined.