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,
134 enum { kCurrentVersion = 1 };
190 bool isUndefined()
const {
return (Flags >> S::FB_undefined) & 1; }
191 bool isWeak()
const {
return (Flags >> S::FB_weak) & 1; }
192 bool isCommon()
const {
return (Flags >> S::FB_common) & 1; }
193 bool isIndirect()
const {
return (Flags >> S::FB_indirect) & 1; }
194 bool isUsed()
const {
return (Flags >> S::FB_used) & 1; }
195 bool isTLS()
const {
return (Flags >> S::FB_tls) & 1; }
198 return (Flags >> S::FB_may_omit) & 1;
201 bool isGlobal()
const {
return (Flags >> S::FB_global) & 1; }
220 return COFFWeakExternFallbackName;
239 return R.
get(Symtab);
251 Modules = range(header().Modules);
252 Comdats = range(header().Comdats);
253 Symbols = range(header().Symbols);
254 Uncommons = range(header().Uncommons);
278 std::vector<StringRef> ComdatTable;
279 ComdatTable.reserve(Comdats.
size());
280 for (
auto C : Comdats)
281 ComdatTable.push_back(str(
C.Name));
301 IRName = R->str(SymI->
IRName);
318 : SymI(SymI), SymE(SymE), UncI(UncI), R(R) {
333 return {
SymbolRef(Symbols.begin(), Symbols.end(), Uncommons.begin(),
this),
334 SymbolRef(Symbols.end(), Symbols.end(),
nullptr,
this)};
340 *MEnd = Symbols.begin() + M.
End;
358 #endif // LLVM_OBJECT_IRSYMTAB_H
StringRef getIRName() const
Returns the unmangled symbol name, or the empty string if this is not an IR symbol.
GlobalValue::VisibilityTypes getVisibility() 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 class represents lattice values for constants.
Contains the information needed by linkers for symbol resolution, as well as by the LTO implementatio...
This provides a very simple, boring adaptor for a begin and end iterator into a range type...
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.
Word ComdatIndex
The index into Header::Comdats, or -1 if not a comdat member.
bool isExecutable() const
Str SectionName
Specified section name, if any.
bool canBeOmittedFromSymbolTable() const
Str IRName
The unmangled symbol name, or the empty string if this is not an IR symbol.
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).
A reference to a range of objects in the symbol table.
bool isFormatSpecific() const
amdgpu Simplify well known AMD library false Value Value const Twine & Name
size_t getNumModules() const
The contents of the irsymtab in a bitcode file.
Tagged union holding either a T or a Error.
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)...
StringRef getName() const
Returns the mangled symbol name.
A reference to a string in the string table.
Ephemeral symbols produced by Reader::symbols() and Reader::module_symbols().
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.
Describes the range of a particular module's symbols within the symbol table.
uint32_t getCommonAlignment() const
detail::packed_endian_specific_integral< uint32_t, little, unaligned > ulittle32_t
Allocate memory in an ever growing pool, as if by bump-pointer.
size_t size() const
size - Get the array size.
Str Name
The mangled symbol name.
symbol_range symbols() const
Returns the symbol table for the entire bitcode file.
This data structure contains rarely used symbol fields and is optionally referenced by a Symbol...
ArrayRef< T > get(StringRef Symtab) const
This represents a symbol that has been read from a storage::Symbol and possibly a storage::Uncommon...
StringRef getSectionName() const
int getComdatIndex() const
Returns the index into the comdat table (see Reader::getComdatTable()), or -1 if not a comdat member...
bool operator==(const SymbolRef &Other) const
StringRef getSourceFileName() const
Returns the source file path specified at compile time.
StringRef getCOFFLinkerOpts() const
COFF-specific: returns linker options specified in the input file.
std::vector< StringRef > getComdatTable() const
Returns a table with all the comdats used by this file.
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.
static bool isWeak(const MCSymbolELF &Sym)
StringRef getTargetTriple() 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)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool isUnnamedAddr() const
This is equivalent to an IR comdat.
Lightweight error class with error context and mandatory checking.
uint64_t getCommonSize() const
StringRef - Represent a constant reference to a string, i.e.
StringRef COFFWeakExternFallbackName
StringRef get(StringRef Strtab) const
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.
Str COFFWeakExternFallbackName
COFF-specific: the name of the symbol that a weak external resolves to if not defined.