14 #ifndef LLVM_MC_MCSYMBOL_H
15 #define LLVM_MC_MCSYMBOL_H
160 getNameEntryPtr() =
Name;
170 void operator delete(
void *);
172 void operator delete(
void*,
unsigned) {
181 void operator=(
const MCSymbol &) =
delete;
182 MCSection *getSectionPtr()
const {
184 return F->getParent();
186 assert(!SectionOrFragment.is<MCFragment *>() &&
"Section or null expected");
187 MCSection *
Section = SectionOrFragment.dyn_cast<MCSection *>();
194 const StringMapEntry<bool> *&getNameEntryPtr() {
196 NameEntryStorageTy *
Name =
reinterpret_cast<NameEntryStorageTy *
>(
this);
197 return (*(Name - 1)).NameEntry;
199 const StringMapEntry<bool> *&getNameEntryPtr()
const {
200 return const_cast<MCSymbol*
>(
this)->getNameEntryPtr();
209 return getNameEntryPtr()->
first();
251 bool isDefined()
const {
return getSectionPtr() !=
nullptr; }
266 return *getSectionPtr();
271 assert(!
isVariable() &&
"Cannot set section of variable");
273 "Section or null expected");
322 "Cannot get offset for a common/variable symbol");
328 "Cannot set offset for a common/variable symbol");
335 assert(
isCommon() &&
"Not a 'common' symbol!");
349 "Alignment must be a power of 2");
350 unsigned Log2Align =
Log2_32(Align) + 1;
352 "Out of range alignment");
358 assert(
isCommon() &&
"Not a 'common' symbol!");
407 assert(Value < (1U <<
NumFlagsBits) &&
"Out of range flags");
413 assert(Value < (1U <<
NumFlagsBits) &&
"Out of range flags");
419 Sym.
print(OS,
nullptr);
Instances of this class represent a uniqued identifier for a section in the current translation unit...
void setPrivateExtern(bool Value)
void print(raw_ostream &OS, const MCAsmInfo *MAI) const
print - Print the value to the stream OS.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
void redefineIfPossible()
Prepare this symbol to be redefined.
bool isRegistered() const
uint64_t AlignmentPadding
SymbolKind
The kind of the symbol.
uint64_t CommonSize
The size of the symbol, if it is 'common'.
unsigned IsPrivateExtern
This symbol is private extern.
void setFlags(uint32_t Value) const
Set the (implementation defined) symbol flags.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
const MCExpr * getVariableValue() const
getVariableValue() - Get the value for variable symbols.
Base class for the full range of assembler expressions which are needed for parsing.
void setIndex(uint32_t Value) const
Set the (implementation defined) index.
void setCommon(uint64_t Size, unsigned Align)
Mark this symbol as being 'common'.
PointerIntPair< PointerUnion< MCSection *, MCFragment * >, 1 > SectionOrFragmentAndHasName
If a symbol has a Fragment, the section is implied, so we only need one pointer.
void setSection(MCSection &S)
Mark the symbol as defined in the section S.
Context object for machine code objects.
bool isInSection() const
isInSection - Check if this symbol is defined in some section (i.e., it is defined but not absolute)...
unsigned IsUsedInReloc
True if we have created a relocation that uses this symbol.
uint64_t Offset
The offset to apply to the fragment address to form this symbol's value.
void setExternal(bool Value) const
uint32_t getFlags() const
Get the (implementation defined) symbol flags.
This class is intended to be used as a base class for asm properties and features specific to the tar...
bool isUsed() const
isUsed - Check if this is used.
void modifyFlags(uint32_t Value, uint32_t Mask) const
Modify the flags via a mask.
PointerIntPair - This class implements a pair of a pointer and small integer.
void setRedefinable(bool Value)
Mark this symbol as redefinable.
void setUsedInReloc() const
uint32_t getIndex() const
Get the (implementation defined) index.
uint32_t Index
Index field, for use by the object file implementation.
unsigned getCommonAlignment() const
Return the alignment of a 'common' symbol.
unsigned Kind
LLVM RTTI discriminator.
MCSection * findAssociatedSection() const
Find the "associated section" for this expression, which is currently defined as the absolute section...
MCFragment * getFragment() const
void setOffset(uint64_t Value)
bool isAbsolute() const
isAbsolute - Check if this is an absolute symbol.
bool isDefined() const
isDefined - Check if this symbol is defined (i.e., it has an address).
void setFragment(MCFragment *Value) const
bool isUsedInReloc() const
void setUndefined()
Mark the symbol as undefined.
MCSection & getSection() const
Get the section associated with a defined, non-absolute symbol.
unsigned IsUsed
IsUsed - True if this symbol has been used.
unsigned IsExternal
This symbol is visible outside this translation unit.
static MCSection * AbsolutePseudoSection
unsigned SymbolContents
This is actually a Contents enumerator, but is unsigned to avoid sign extension and achieve better bi...
void setUsed(bool Value) const
void setVariableValue(const MCExpr *Value)
static cl::opt< AlignMode > Align(cl::desc("Load/store alignment support"), cl::Hidden, cl::init(NoStrictAlign), cl::values(clEnumValN(StrictAlign,"aarch64-strict-align","Disallow all unaligned memory accesses"), clEnumValN(NoStrictAlign,"aarch64-no-strict-align","Allow unaligned memory accesses"), clEnumValEnd))
unsigned Log2_32(uint32_t Value)
Log2_32 - This function returns the floor log base 2 of the specified value, -1 if the value is zero...
void setIsRegistered(bool Value) const
bool isTemporary() const
isTemporary - Check if this is an assembler temporary symbol.
uint64_t getCommonSize() const
Return the size of a 'common' symbol.
StringRef getName() const
getName - Get the symbol name.
const StringMapEntry< bool > * NameEntry
uint64_t getOffset() const
bool isCommon() const
Is this a 'common' symbol.
unsigned IsRedefinable
True if this symbol can be redefined.
raw_ostream & operator<<(raw_ostream &OS, const APInt &I)
bool isVariable() const
isVariable - Check if this is a variable symbol.
bool isRedefinable() const
Check if this symbol is redefinable.
bool isPrivateExtern() const
LLVM Value Representation.
This class implements an extremely fast bulk output stream that can only output to a stream...
const MCExpr * Value
If non-null, the value for a variable symbol.
bool isPowerOf2_32(uint32_t Value)
isPowerOf2_32 - This function returns true if the argument is a power of two > 0. ...
StringRef - Represent a constant reference to a string, i.e.
bool isUndefined() const
isUndefined - Check if this symbol undefined (i.e., implicitly defined).
MCSymbol(SymbolKind Kind, const StringMapEntry< bool > *Name, bool isTemporary)
Contents
A symbol can contain an Offset, or Value, or be Common, but never more than one of these...
void dump() const
dump - Print the value to stderr.
bool declareCommon(uint64_t Size, unsigned Align)
Declare this symbol as being 'common'.
PointerUnion - This implements a discriminated union of two pointer types, and keeps the discriminato...
unsigned IsTemporary
IsTemporary - True if this is an assembler temporary label, which typically does not survive in the ...