LLVM: include/llvm/MC/MCSymbol.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13#ifndef LLVM_MC_MCSYMBOL_H
14#define LLVM_MC_MCSYMBOL_H
15
24#include
25#include
26#include
27
28namespace llvm {
29
34
35
36
37
38
39
40
41
43protected:
44
50
51
53
54
55
56
57
58
59
60
61
62
63
64
66
67
68
70
71
72
74
75
76
77
79
80
82
84
85
86
88
89
91
92
94
95
97
98
100
101
102
103
104
105
106
107
108
109
110
113
114
115
118
119
121
122 union {
123
125
126
128
129
131 };
132
133
136
137
138
139
140
145
153 if (Name)
154 getNameEntryPtr() = Name;
155 }
156
159
160
161
164
165private:
166 void operator delete(void *);
167
168 void operator delete(void*, unsigned) {
170 }
171
172 void operator delete(void*, unsigned, bool) {
174 }
175
176
180 return (*(Name - 1)).NameEntry;
181 }
183 return const_cast<MCSymbol*>(this)->getNameEntryPtr();
184 }
185
186public:
187
191
192 return getNameEntryPtr()->first();
193 }
194
197
200
201
202
203
204
206
207
209
211
222
225
226
227
228
229
230
231
232
234
235
236
241
242
244
245
249
250
255
256
261
262
263
264
265
266
268
269
274
276
277
278
279
283
284
288
291 "Cannot get offset for a common/variable symbol");
293 }
296 "Cannot set offset for a common/variable symbol");
298 }
299
300
305
306
307
308
309
310
315
316 unsigned Log2Align = encode(Alignment);
318 "Out of range alignment");
320 }
321
322
327
328
329
330
331
332
337 return true;
338 } else
340 return false;
341 }
342
343
345
354
355
357
358
360
361
363
364protected:
365
367
368
373
374
379};
380
382 Sym.print(OS, nullptr);
383 return OS;
384}
385
386bool isRangeRelaxable(const MCSymbol *Begin, const MCSymbol *End);
387
388}
389
390#endif
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file defines the StringMapEntry class - it is intended to be a low dependency implementation det...
This class is intended to be used as a base class for asm properties and features specific to the tar...
Context object for machine code objects.
Base class for the full range of assembler expressions which are needed for parsing.
LLVM_ABI MCFragment * findAssociatedFragment() const
Find the "associated section" for this expression, which is currently defined as the absolute section...
MCSection * getParent() const
Instances of this class represent a uniqued identifier for a section in the current translation unit.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition MCSymbol.h:42
bool isAbsolute() const
isAbsolute - Check if this is an absolute symbol.
Definition MCSymbol.h:246
unsigned IsWeakExternal
This symbol is weak external.
Definition MCSymbol.h:93
MCSymbol(const MCSymbolTableEntry *Name, bool isTemporary)
Definition MCSymbol.h:146
void setCommon(uint64_t Size, Align Alignment)
Mark this symbol as being 'common'.
Definition MCSymbol.h:311
LLVM_ABI void print(raw_ostream &OS, const MCAsmInfo *MAI) const
print - Print the value to the stream OS.
bool isDefined() const
isDefined - Check if this symbol is defined (i.e., it has an address).
Definition MCSymbol.h:233
void setIsResolving(bool V)
Definition MCSymbol.h:224
Kind
Definition MCSymbol.h:45
@ Equated
Definition MCSymbol.h:47
@ Regular
Definition MCSymbol.h:46
@ Common
Definition MCSymbol.h:48
bool isInSection() const
isInSection - Check if this symbol is defined in some section (i.e., it is defined but not absolute).
Definition MCSymbol.h:237
bool isUndefined() const
isUndefined - Check if this symbol undefined (i.e., implicitly defined).
Definition MCSymbol.h:243
friend class MCExpr
Definition MCSymbol.h:134
@ NumCommonAlignmentBits
Definition MCSymbol.h:111
bool isResolving() const
Definition MCSymbol.h:223
bool isCommon() const
Is this a 'common' symbol.
Definition MCSymbol.h:344
void modifyFlags(uint32_t Value, uint32_t Mask) const
Modify the flags via a mask.
Definition MCSymbol.h:375
unsigned IsPrivateExtern
Mach-O specific: This symbol is private extern.
Definition MCSymbol.h:90
StringRef getName() const
getName - Get the symbol name.
Definition MCSymbol.h:188
void setFragment(MCFragment *F) const
Mark the symbol as defined in the fragment F.
Definition MCSymbol.h:257
unsigned IsRegistered
Definition MCSymbol.h:83
unsigned IsUsedInReloc
True if we have created a relocation that uses this symbol.
Definition MCSymbol.h:96
bool isWeakExternal() const
Definition MCSymbol.h:356
bool isVariable() const
isVariable - Check if this is a variable symbol.
Definition MCSymbol.h:267
uint32_t Flags
Definition MCSymbol.h:117
unsigned IsRedefinable
True if this symbol can be redefined.
Definition MCSymbol.h:81
void setFlags(uint32_t Value) const
Set the (implementation defined) symbol flags.
Definition MCSymbol.h:369
uint32_t getFlags() const
Get the (implementation defined) symbol flags.
Definition MCSymbol.h:366
unsigned IsExternal
True if this symbol is visible outside this translation unit.
Definition MCSymbol.h:87
friend class MCContext
Definition MCSymbol.h:135
bool isRedefinable() const
Check if this symbol is redefinable.
Definition MCSymbol.h:208
LLVM_ABI void setVariableValue(const MCExpr *Value)
MaybeAlign getCommonAlignment() const
Return the alignment of a 'common' symbol.
Definition MCSymbol.h:323
unsigned CommonAlignLog2
Definition MCSymbol.h:112
uint32_t Index
Index field, for use by the object file implementation.
Definition MCSymbol.h:120
unsigned HasName
True if this symbol is named.
Definition MCSymbol.h:73
bool isRegistered() const
Definition MCSymbol.h:195
void setIndex(uint32_t Value) const
Set the (implementation defined) index.
Definition MCSymbol.h:285
void setRedefinable(bool Value)
Mark this symbol as redefinable.
Definition MCSymbol.h:210
bool declareCommon(uint64_t Size, Align Alignment)
Declare this symbol as being 'common'.
Definition MCSymbol.h:333
void setUsedInReloc() const
Definition MCSymbol.h:198
uint32_t getIndex() const
Get the (implementation defined) index.
Definition MCSymbol.h:280
MCFragment * Fragment
If a symbol has a Fragment, the section is implied, so we only need one pointer.
Definition MCSymbol.h:65
unsigned IsResolving
Used to detect cyclic dependency like a = a + 1 and a = b; b = a.
Definition MCSymbol.h:99
MCSymbol(const MCSymbol &)=default
unsigned kind
The symbol kind.
Definition MCSymbol.h:69
MCSection & getSection() const
Get the section associated with a defined, non-absolute symbol.
Definition MCSymbol.h:251
static LLVM_ABI MCFragment * AbsolutePseudoFragment
Definition MCSymbol.h:52
void setOffset(uint64_t Value)
Definition MCSymbol.h:294
void redefineIfPossible()
Prepare this symbol to be redefined.
Definition MCSymbol.h:212
uint64_t getCommonSize() const
Return the size of a 'common' symbol.
Definition MCSymbol.h:301
const MCExpr * getVariableValue() const
Get the expression of the variable symbol.
Definition MCSymbol.h:270
unsigned IsTemporary
IsTemporary - True if this is an assembler temporary label, which typically does not survive in the ....
Definition MCSymbol.h:78
LLVM_ABI void dump() const
dump - Print the value to stderr.
bool isTemporary() const
isTemporary - Check if this is an assembler temporary symbol.
Definition MCSymbol.h:205
@ NumFlagsBits
Definition MCSymbol.h:116
union { const MCSymbolTableEntry *NameEntry; uint64_t AlignmentPadding; } NameEntryStorageTy
The name for a symbol.
Definition MCSymbol.h:141
const MCExpr * Value
If non-null, the value for a variable symbol.
Definition MCSymbol.h:130
void setIsRegistered(bool Value) const
Definition MCSymbol.h:196
uint64_t CommonSize
The size of the symbol, if it is 'common'.
Definition MCSymbol.h:127
uint64_t Offset
The offset to apply to the fragment address to form this symbol's value.
Definition MCSymbol.h:124
MCFragment * getFragment() const
Definition MCSymbol.h:346
uint64_t getOffset() const
Definition MCSymbol.h:289
bool isUsedInReloc() const
Definition MCSymbol.h:199
MCSymbol & operator=(const MCSymbol &)=delete
StringRef - Represent a constant reference to a string, i.e.
LLVM Value Representation.
This class implements an extremely fast bulk output stream that can only output to a stream.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
unsigned encode(MaybeAlign A)
Returns a representation of the alignment that encodes undefined as 0.
bool isRangeRelaxable(const MCSymbol *Begin, const MCSymbol *End)
StringMapEntry< MCSymbolTableValue > MCSymbolTableEntry
MCContext stores MCSymbolTableValue in a string map (see MCSymbol::operator new).
MaybeAlign decodeMaybeAlign(unsigned Value)
Dual operation of the encode function above.
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
This struct is a compact representation of a valid (non-zero power of two) alignment.
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.