File: | include/llvm/MC/MCAsmInfo.h |
Warning: | line 56, column 7 Excessive padding in 'class llvm::MCAsmInfo' (38 padding bytes, where 6 is optimal). Optimal fields order: SeparatorString, LabelSuffix, InlineAsmStart, InlineAsmEnd, Code16Directive, Code32Directive, Code64Directive, ZeroDirective, AsciiDirective, AscizDirective, Data8bitsDirective, Data16bitsDirective, Data32bitsDirective, Data64bitsDirective, GPRel64Directive, GPRel32Directive, DTPRel32Directive, DTPRel64Directive, TPRel32Directive, TPRel64Directive, GlobalDirective, WeakDirective, WeakRefDirective, CommentString, PrivateGlobalPrefix, PrivateLabelPrefix, LinkerPrivateGlobalPrefix, InitialFrameState, CodePointerSize, CalleeSaveStackSlotSize, MaxInstLength, MinInstAlignment, AssemblerDialect, TextAlignFillValue, LCOMMDirectiveAlignmentType, HiddenVisibilityAttr, HiddenDeclarationVisibilityAttr, ProtectedVisibilityAttr, ExceptionsType, WinEHEncodingType, CompressDebugSections, IsLittleEndian, StackGrowsUp, HasSubsectionsViaSymbols, HasMachoZeroFillDirective, HasMachoTBSSDirective, DollarIsPC, UseAssignmentForEHBegin, NeedsLocalForSize, AllowAtInName, SupportsQuotedNames, UseDataRegionDirectives, SunStyleELFSectionSwitchSyntax, UsesELFSectionDirectiveForBSS, NeedsDwarfSectionOffsetDirective, AlignmentIsInBytes, SetDirectiveSuppressesReloc, HasAggressiveSymbolFolding, COMMDirectiveAlignmentIsInBytes, HasFunctionAlignment, HasDotTypeDotSizeDirective, HasSingleParameterDotFile, HasIdentDirective, HasNoDeadStrip, HasAltEntry, HasWeakDefDirective, HasWeakDefCanBeHiddenDirective, HasLinkOnceDirective, SupportsDebugInformation, DwarfUsesRelocationsAcrossSections, DwarfFDESymbolsUseAbsDiff, DwarfRegNumForCFI, UseParensForSymbolVariant, SupportsExtendedDwarfLocDirective, UseIntegratedAssembler, PreserveAsmComments, UseLogicalShr, RelaxELFRelocations, HasMipsExpressions, consider reordering the fields or adding explicit padding members |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
1 | //===-- llvm/MC/MCAsmInfo.h - Asm info --------------------------*- C++ -*-===// |
2 | // |
3 | // The LLVM Compiler Infrastructure |
4 | // |
5 | // This file is distributed under the University of Illinois Open Source |
6 | // License. See LICENSE.TXT for details. |
7 | // |
8 | //===----------------------------------------------------------------------===// |
9 | // |
10 | // This file contains a class to be used as the basis for target specific |
11 | // asm writers. This class primarily takes care of global printing constants, |
12 | // which are used in very similar ways across all targets. |
13 | // |
14 | //===----------------------------------------------------------------------===// |
15 | |
16 | #ifndef LLVM_MC_MCASMINFO_H |
17 | #define LLVM_MC_MCASMINFO_H |
18 | |
19 | #include "llvm/ADT/StringRef.h" |
20 | #include "llvm/MC/MCDirectives.h" |
21 | #include "llvm/MC/MCDwarf.h" |
22 | #include "llvm/MC/MCTargetOptions.h" |
23 | #include <vector> |
24 | |
25 | namespace llvm { |
26 | |
27 | class MCContext; |
28 | class MCExpr; |
29 | class MCSection; |
30 | class MCStreamer; |
31 | class MCSymbol; |
32 | |
33 | namespace WinEH { |
34 | |
35 | enum class EncodingType { |
36 | Invalid, /// Invalid |
37 | Alpha, /// Windows Alpha |
38 | Alpha64, /// Windows AXP64 |
39 | ARM, /// Windows NT (Windows on ARM) |
40 | CE, /// Windows CE ARM, PowerPC, SH3, SH4 |
41 | Itanium, /// Windows x64, Windows Itanium (IA-64) |
42 | X86, /// Windows x86, uses no CFI, just EH tables |
43 | MIPS = Alpha, |
44 | }; |
45 | |
46 | } // end namespace WinEH |
47 | |
48 | namespace LCOMM { |
49 | |
50 | enum LCOMMType { NoAlignment, ByteAlignment, Log2Alignment }; |
51 | |
52 | } // end namespace LCOMM |
53 | |
54 | /// This class is intended to be used as a base class for asm |
55 | /// properties and features specific to the target. |
56 | class MCAsmInfo { |
Excessive padding in 'class llvm::MCAsmInfo' (38 padding bytes, where 6 is optimal).
Optimal fields order:
SeparatorString,
LabelSuffix,
InlineAsmStart,
InlineAsmEnd,
Code16Directive,
Code32Directive,
Code64Directive,
ZeroDirective,
AsciiDirective,
AscizDirective,
Data8bitsDirective,
Data16bitsDirective,
Data32bitsDirective,
Data64bitsDirective,
GPRel64Directive,
GPRel32Directive,
DTPRel32Directive,
DTPRel64Directive,
TPRel32Directive,
TPRel64Directive,
GlobalDirective,
WeakDirective,
WeakRefDirective,
CommentString,
PrivateGlobalPrefix,
PrivateLabelPrefix,
LinkerPrivateGlobalPrefix,
InitialFrameState,
CodePointerSize,
CalleeSaveStackSlotSize,
MaxInstLength,
MinInstAlignment,
AssemblerDialect,
TextAlignFillValue,
LCOMMDirectiveAlignmentType,
HiddenVisibilityAttr,
HiddenDeclarationVisibilityAttr,
ProtectedVisibilityAttr,
ExceptionsType,
WinEHEncodingType,
CompressDebugSections,
IsLittleEndian,
StackGrowsUp,
HasSubsectionsViaSymbols,
HasMachoZeroFillDirective,
HasMachoTBSSDirective,
DollarIsPC,
UseAssignmentForEHBegin,
NeedsLocalForSize,
AllowAtInName,
SupportsQuotedNames,
UseDataRegionDirectives,
SunStyleELFSectionSwitchSyntax,
UsesELFSectionDirectiveForBSS,
NeedsDwarfSectionOffsetDirective,
AlignmentIsInBytes,
SetDirectiveSuppressesReloc,
HasAggressiveSymbolFolding,
COMMDirectiveAlignmentIsInBytes,
HasFunctionAlignment,
HasDotTypeDotSizeDirective,
HasSingleParameterDotFile,
HasIdentDirective,
HasNoDeadStrip,
HasAltEntry,
HasWeakDefDirective,
HasWeakDefCanBeHiddenDirective,
HasLinkOnceDirective,
SupportsDebugInformation,
DwarfUsesRelocationsAcrossSections,
DwarfFDESymbolsUseAbsDiff,
DwarfRegNumForCFI,
UseParensForSymbolVariant,
SupportsExtendedDwarfLocDirective,
UseIntegratedAssembler,
PreserveAsmComments,
UseLogicalShr,
RelaxELFRelocations,
HasMipsExpressions,
consider reordering the fields or adding explicit padding members | |
57 | protected: |
58 | //===------------------------------------------------------------------===// |
59 | // Properties to be set by the target writer, used to configure asm printer. |
60 | // |
61 | |
62 | /// Code pointer size in bytes. Default is 4. |
63 | unsigned CodePointerSize = 4; |
64 | |
65 | /// Size of the stack slot reserved for callee-saved registers, in bytes. |
66 | /// Default is same as pointer size. |
67 | unsigned CalleeSaveStackSlotSize = 4; |
68 | |
69 | /// True if target is little endian. Default is true. |
70 | bool IsLittleEndian = true; |
71 | |
72 | /// True if target stack grow up. Default is false. |
73 | bool StackGrowsUp = false; |
74 | |
75 | /// True if this target has the MachO .subsections_via_symbols directive. |
76 | /// Default is false. |
77 | bool HasSubsectionsViaSymbols = false; |
78 | |
79 | /// True if this is a MachO target that supports the macho-specific .zerofill |
80 | /// directive for emitting BSS Symbols. Default is false. |
81 | bool HasMachoZeroFillDirective = false; |
82 | |
83 | /// True if this is a MachO target that supports the macho-specific .tbss |
84 | /// directive for emitting thread local BSS Symbols. Default is false. |
85 | bool HasMachoTBSSDirective = false; |
86 | |
87 | /// This is the maximum possible length of an instruction, which is needed to |
88 | /// compute the size of an inline asm. Defaults to 4. |
89 | unsigned MaxInstLength = 4; |
90 | |
91 | /// Every possible instruction length is a multiple of this value. Factored |
92 | /// out in .debug_frame and .debug_line. Defaults to 1. |
93 | unsigned MinInstAlignment = 1; |
94 | |
95 | /// The '$' token, when not referencing an identifier or constant, refers to |
96 | /// the current PC. Defaults to false. |
97 | bool DollarIsPC = false; |
98 | |
99 | /// This string, if specified, is used to separate instructions from each |
100 | /// other when on the same line. Defaults to ';' |
101 | const char *SeparatorString; |
102 | |
103 | /// This indicates the comment character used by the assembler. Defaults to |
104 | /// "#" |
105 | StringRef CommentString; |
106 | |
107 | /// This is appended to emitted labels. Defaults to ":" |
108 | const char *LabelSuffix; |
109 | |
110 | // Print the EH begin symbol with an assignment. Defaults to false. |
111 | bool UseAssignmentForEHBegin = false; |
112 | |
113 | // Do we need to create a local symbol for .size? |
114 | bool NeedsLocalForSize = false; |
115 | |
116 | /// This prefix is used for globals like constant pool entries that are |
117 | /// completely private to the .s file and should not have names in the .o |
118 | /// file. Defaults to "L" |
119 | StringRef PrivateGlobalPrefix; |
120 | |
121 | /// This prefix is used for labels for basic blocks. Defaults to the same as |
122 | /// PrivateGlobalPrefix. |
123 | StringRef PrivateLabelPrefix; |
124 | |
125 | /// This prefix is used for symbols that should be passed through the |
126 | /// assembler but be removed by the linker. This is 'l' on Darwin, currently |
127 | /// used for some ObjC metadata. The default of "" meast that for this system |
128 | /// a plain private symbol should be used. Defaults to "". |
129 | StringRef LinkerPrivateGlobalPrefix; |
130 | |
131 | /// If these are nonempty, they contain a directive to emit before and after |
132 | /// an inline assembly statement. Defaults to "#APP\n", "#NO_APP\n" |
133 | const char *InlineAsmStart; |
134 | const char *InlineAsmEnd; |
135 | |
136 | /// These are assembly directives that tells the assembler to interpret the |
137 | /// following instructions differently. Defaults to ".code16", ".code32", |
138 | /// ".code64". |
139 | const char *Code16Directive; |
140 | const char *Code32Directive; |
141 | const char *Code64Directive; |
142 | |
143 | /// Which dialect of an assembler variant to use. Defaults to 0 |
144 | unsigned AssemblerDialect = 0; |
145 | |
146 | /// This is true if the assembler allows @ characters in symbol names. |
147 | /// Defaults to false. |
148 | bool AllowAtInName = false; |
149 | |
150 | /// If this is true, symbol names with invalid characters will be printed in |
151 | /// quotes. |
152 | bool SupportsQuotedNames = true; |
153 | |
154 | /// This is true if data region markers should be printed as |
155 | /// ".data_region/.end_data_region" directives. If false, use "$d/$a" labels |
156 | /// instead. |
157 | bool UseDataRegionDirectives = false; |
158 | |
159 | //===--- Data Emission Directives -------------------------------------===// |
160 | |
161 | /// This should be set to the directive used to get some number of zero bytes |
162 | /// emitted to the current section. Common cases are "\t.zero\t" and |
163 | /// "\t.space\t". If this is set to null, the Data*bitsDirective's will be |
164 | /// used to emit zero bytes. Defaults to "\t.zero\t" |
165 | const char *ZeroDirective; |
166 | |
167 | /// This directive allows emission of an ascii string with the standard C |
168 | /// escape characters embedded into it. If a target doesn't support this, it |
169 | /// can be set to null. Defaults to "\t.ascii\t" |
170 | const char *AsciiDirective; |
171 | |
172 | /// If not null, this allows for special handling of zero terminated strings |
173 | /// on this target. This is commonly supported as ".asciz". If a target |
174 | /// doesn't support this, it can be set to null. Defaults to "\t.asciz\t" |
175 | const char *AscizDirective; |
176 | |
177 | /// These directives are used to output some unit of integer data to the |
178 | /// current section. If a data directive is set to null, smaller data |
179 | /// directives will be used to emit the large sizes. Defaults to "\t.byte\t", |
180 | /// "\t.short\t", "\t.long\t", "\t.quad\t" |
181 | const char *Data8bitsDirective; |
182 | const char *Data16bitsDirective; |
183 | const char *Data32bitsDirective; |
184 | const char *Data64bitsDirective; |
185 | |
186 | /// If non-null, a directive that is used to emit a word which should be |
187 | /// relocated as a 64-bit GP-relative offset, e.g. .gpdword on Mips. Defaults |
188 | /// to nullptr. |
189 | const char *GPRel64Directive = nullptr; |
190 | |
191 | /// If non-null, a directive that is used to emit a word which should be |
192 | /// relocated as a 32-bit GP-relative offset, e.g. .gpword on Mips or .gprel32 |
193 | /// on Alpha. Defaults to nullptr. |
194 | const char *GPRel32Directive = nullptr; |
195 | |
196 | /// If non-null, directives that are used to emit a word/dword which should |
197 | /// be relocated as a 32/64-bit DTP/TP-relative offset, e.g. .dtprelword/ |
198 | /// .dtpreldword/.tprelword/.tpreldword on Mips. |
199 | const char *DTPRel32Directive = nullptr; |
200 | const char *DTPRel64Directive = nullptr; |
201 | const char *TPRel32Directive = nullptr; |
202 | const char *TPRel64Directive = nullptr; |
203 | |
204 | /// This is true if this target uses "Sun Style" syntax for section switching |
205 | /// ("#alloc,#write" etc) instead of the normal ELF syntax (,"a,w") in |
206 | /// .section directives. Defaults to false. |
207 | bool SunStyleELFSectionSwitchSyntax = false; |
208 | |
209 | /// This is true if this target uses ELF '.section' directive before the |
210 | /// '.bss' one. It's used for PPC/Linux which doesn't support the '.bss' |
211 | /// directive only. Defaults to false. |
212 | bool UsesELFSectionDirectiveForBSS = false; |
213 | |
214 | bool NeedsDwarfSectionOffsetDirective = false; |
215 | |
216 | //===--- Alignment Information ----------------------------------------===// |
217 | |
218 | /// If this is true (the default) then the asmprinter emits ".align N" |
219 | /// directives, where N is the number of bytes to align to. Otherwise, it |
220 | /// emits ".align log2(N)", e.g. 3 to align to an 8 byte boundary. Defaults |
221 | /// to true. |
222 | bool AlignmentIsInBytes = true; |
223 | |
224 | /// If non-zero, this is used to fill the executable space created as the |
225 | /// result of a alignment directive. Defaults to 0 |
226 | unsigned TextAlignFillValue = 0; |
227 | |
228 | //===--- Global Variable Emission Directives --------------------------===// |
229 | |
230 | /// This is the directive used to declare a global entity. Defaults to |
231 | /// ".globl". |
232 | const char *GlobalDirective; |
233 | |
234 | /// True if the expression |
235 | /// .long f - g |
236 | /// uses a relocation but it can be suppressed by writing |
237 | /// a = f - g |
238 | /// .long a |
239 | bool SetDirectiveSuppressesReloc = false; |
240 | |
241 | /// False if the assembler requires that we use |
242 | /// \code |
243 | /// Lc = a - b |
244 | /// .long Lc |
245 | /// \endcode |
246 | // |
247 | /// instead of |
248 | // |
249 | /// \code |
250 | /// .long a - b |
251 | /// \endcode |
252 | /// |
253 | /// Defaults to true. |
254 | bool HasAggressiveSymbolFolding = true; |
255 | |
256 | /// True is .comm's and .lcomms optional alignment is to be specified in bytes |
257 | /// instead of log2(n). Defaults to true. |
258 | bool COMMDirectiveAlignmentIsInBytes = true; |
259 | |
260 | /// Describes if the .lcomm directive for the target supports an alignment |
261 | /// argument and how it is interpreted. Defaults to NoAlignment. |
262 | LCOMM::LCOMMType LCOMMDirectiveAlignmentType = LCOMM::NoAlignment; |
263 | |
264 | // True if the target allows .align directives on functions. This is true for |
265 | // most targets, so defaults to true. |
266 | bool HasFunctionAlignment = true; |
267 | |
268 | /// True if the target has .type and .size directives, this is true for most |
269 | /// ELF targets. Defaults to true. |
270 | bool HasDotTypeDotSizeDirective = true; |
271 | |
272 | /// True if the target has a single parameter .file directive, this is true |
273 | /// for ELF targets. Defaults to true. |
274 | bool HasSingleParameterDotFile = true; |
275 | |
276 | /// True if the target has a .ident directive, this is true for ELF targets. |
277 | /// Defaults to false. |
278 | bool HasIdentDirective = false; |
279 | |
280 | /// True if this target supports the MachO .no_dead_strip directive. Defaults |
281 | /// to false. |
282 | bool HasNoDeadStrip = false; |
283 | |
284 | /// True if this target supports the MachO .alt_entry directive. Defaults to |
285 | /// false. |
286 | bool HasAltEntry = false; |
287 | |
288 | /// Used to declare a global as being a weak symbol. Defaults to ".weak". |
289 | const char *WeakDirective; |
290 | |
291 | /// This directive, if non-null, is used to declare a global as being a weak |
292 | /// undefined symbol. Defaults to nullptr. |
293 | const char *WeakRefDirective = nullptr; |
294 | |
295 | /// True if we have a directive to declare a global as being a weak defined |
296 | /// symbol. Defaults to false. |
297 | bool HasWeakDefDirective = false; |
298 | |
299 | /// True if we have a directive to declare a global as being a weak defined |
300 | /// symbol that can be hidden (unexported). Defaults to false. |
301 | bool HasWeakDefCanBeHiddenDirective = false; |
302 | |
303 | /// True if we have a .linkonce directive. This is used on cygwin/mingw. |
304 | /// Defaults to false. |
305 | bool HasLinkOnceDirective = false; |
306 | |
307 | /// This attribute, if not MCSA_Invalid, is used to declare a symbol as having |
308 | /// hidden visibility. Defaults to MCSA_Hidden. |
309 | MCSymbolAttr HiddenVisibilityAttr = MCSA_Hidden; |
310 | |
311 | /// This attribute, if not MCSA_Invalid, is used to declare an undefined |
312 | /// symbol as having hidden visibility. Defaults to MCSA_Hidden. |
313 | MCSymbolAttr HiddenDeclarationVisibilityAttr = MCSA_Hidden; |
314 | |
315 | /// This attribute, if not MCSA_Invalid, is used to declare a symbol as having |
316 | /// protected visibility. Defaults to MCSA_Protected |
317 | MCSymbolAttr ProtectedVisibilityAttr = MCSA_Protected; |
318 | |
319 | //===--- Dwarf Emission Directives -----------------------------------===// |
320 | |
321 | /// True if target supports emission of debugging information. Defaults to |
322 | /// false. |
323 | bool SupportsDebugInformation = false; |
324 | |
325 | /// Exception handling format for the target. Defaults to None. |
326 | ExceptionHandling ExceptionsType = ExceptionHandling::None; |
327 | |
328 | /// Windows exception handling data (.pdata) encoding. Defaults to Invalid. |
329 | WinEH::EncodingType WinEHEncodingType = WinEH::EncodingType::Invalid; |
330 | |
331 | /// True if Dwarf2 output generally uses relocations for references to other |
332 | /// .debug_* sections. |
333 | bool DwarfUsesRelocationsAcrossSections = true; |
334 | |
335 | /// True if DWARF FDE symbol reference relocations should be replaced by an |
336 | /// absolute difference. |
337 | bool DwarfFDESymbolsUseAbsDiff = false; |
338 | |
339 | /// True if dwarf register numbers are printed instead of symbolic register |
340 | /// names in .cfi_* directives. Defaults to false. |
341 | bool DwarfRegNumForCFI = false; |
342 | |
343 | /// True if target uses parens to indicate the symbol variant instead of @. |
344 | /// For example, foo(plt) instead of foo@plt. Defaults to false. |
345 | bool UseParensForSymbolVariant = false; |
346 | |
347 | /// True if the target supports flags in ".loc" directive, false if only |
348 | /// location is allowed. |
349 | bool SupportsExtendedDwarfLocDirective = true; |
350 | |
351 | //===--- Prologue State ----------------------------------------------===// |
352 | |
353 | std::vector<MCCFIInstruction> InitialFrameState; |
354 | |
355 | //===--- Integrated Assembler Information ----------------------------===// |
356 | |
357 | /// Should we use the integrated assembler? |
358 | /// The integrated assembler should be enabled by default (by the |
359 | /// constructors) when failing to parse a valid piece of assembly (inline |
360 | /// or otherwise) is considered a bug. It may then be overridden after |
361 | /// construction (see LLVMTargetMachine::initAsmInfo()). |
362 | bool UseIntegratedAssembler; |
363 | |
364 | /// Preserve Comments in assembly |
365 | bool PreserveAsmComments; |
366 | |
367 | /// Compress DWARF debug sections. Defaults to no compression. |
368 | DebugCompressionType CompressDebugSections = DebugCompressionType::None; |
369 | |
370 | /// True if the integrated assembler should interpret 'a >> b' constant |
371 | /// expressions as logical rather than arithmetic. |
372 | bool UseLogicalShr = true; |
373 | |
374 | // If true, emit GOTPCRELX/REX_GOTPCRELX instead of GOTPCREL, on |
375 | // X86_64 ELF. |
376 | bool RelaxELFRelocations = true; |
377 | |
378 | // If true, then the lexer and expression parser will support %neg(), |
379 | // %hi(), and similar unary operators. |
380 | bool HasMipsExpressions = false; |
381 | |
382 | public: |
383 | explicit MCAsmInfo(); |
384 | virtual ~MCAsmInfo(); |
385 | |
386 | /// Get the code pointer size in bytes. |
387 | unsigned getCodePointerSize() const { return CodePointerSize; } |
388 | |
389 | /// Get the callee-saved register stack slot |
390 | /// size in bytes. |
391 | unsigned getCalleeSaveStackSlotSize() const { |
392 | return CalleeSaveStackSlotSize; |
393 | } |
394 | |
395 | /// True if the target is little endian. |
396 | bool isLittleEndian() const { return IsLittleEndian; } |
397 | |
398 | /// True if target stack grow up. |
399 | bool isStackGrowthDirectionUp() const { return StackGrowsUp; } |
400 | |
401 | bool hasSubsectionsViaSymbols() const { return HasSubsectionsViaSymbols; } |
402 | |
403 | // Data directive accessors. |
404 | |
405 | const char *getData8bitsDirective() const { return Data8bitsDirective; } |
406 | const char *getData16bitsDirective() const { return Data16bitsDirective; } |
407 | const char *getData32bitsDirective() const { return Data32bitsDirective; } |
408 | const char *getData64bitsDirective() const { return Data64bitsDirective; } |
409 | const char *getGPRel64Directive() const { return GPRel64Directive; } |
410 | const char *getGPRel32Directive() const { return GPRel32Directive; } |
411 | const char *getDTPRel64Directive() const { return DTPRel64Directive; } |
412 | const char *getDTPRel32Directive() const { return DTPRel32Directive; } |
413 | const char *getTPRel64Directive() const { return TPRel64Directive; } |
414 | const char *getTPRel32Directive() const { return TPRel32Directive; } |
415 | |
416 | /// Targets can implement this method to specify a section to switch to if the |
417 | /// translation unit doesn't have any trampolines that require an executable |
418 | /// stack. |
419 | virtual MCSection *getNonexecutableStackSection(MCContext &Ctx) const { |
420 | return nullptr; |
421 | } |
422 | |
423 | /// \brief True if the section is atomized using the symbols in it. |
424 | /// This is false if the section is not atomized at all (most ELF sections) or |
425 | /// if it is atomized based on its contents (MachO' __TEXT,__cstring for |
426 | /// example). |
427 | virtual bool isSectionAtomizableBySymbols(const MCSection &Section) const; |
428 | |
429 | virtual const MCExpr *getExprForPersonalitySymbol(const MCSymbol *Sym, |
430 | unsigned Encoding, |
431 | MCStreamer &Streamer) const; |
432 | |
433 | virtual const MCExpr *getExprForFDESymbol(const MCSymbol *Sym, |
434 | unsigned Encoding, |
435 | MCStreamer &Streamer) const; |
436 | |
437 | /// Return true if the identifier \p Name does not need quotes to be |
438 | /// syntactically correct. |
439 | virtual bool isValidUnquotedName(StringRef Name) const; |
440 | |
441 | /// Return true if the .section directive should be omitted when |
442 | /// emitting \p SectionName. For example: |
443 | /// |
444 | /// shouldOmitSectionDirective(".text") |
445 | /// |
446 | /// returns false => .section .text,#alloc,#execinstr |
447 | /// returns true => .text |
448 | virtual bool shouldOmitSectionDirective(StringRef SectionName) const; |
449 | |
450 | bool usesSunStyleELFSectionSwitchSyntax() const { |
451 | return SunStyleELFSectionSwitchSyntax; |
452 | } |
453 | |
454 | bool usesELFSectionDirectiveForBSS() const { |
455 | return UsesELFSectionDirectiveForBSS; |
456 | } |
457 | |
458 | bool needsDwarfSectionOffsetDirective() const { |
459 | return NeedsDwarfSectionOffsetDirective; |
460 | } |
461 | |
462 | // Accessors. |
463 | |
464 | bool hasMachoZeroFillDirective() const { return HasMachoZeroFillDirective; } |
465 | bool hasMachoTBSSDirective() const { return HasMachoTBSSDirective; } |
466 | unsigned getMaxInstLength() const { return MaxInstLength; } |
467 | unsigned getMinInstAlignment() const { return MinInstAlignment; } |
468 | bool getDollarIsPC() const { return DollarIsPC; } |
469 | const char *getSeparatorString() const { return SeparatorString; } |
470 | |
471 | /// This indicates the column (zero-based) at which asm comments should be |
472 | /// printed. |
473 | unsigned getCommentColumn() const { return 40; } |
474 | |
475 | StringRef getCommentString() const { return CommentString; } |
476 | const char *getLabelSuffix() const { return LabelSuffix; } |
477 | |
478 | bool useAssignmentForEHBegin() const { return UseAssignmentForEHBegin; } |
479 | bool needsLocalForSize() const { return NeedsLocalForSize; } |
480 | StringRef getPrivateGlobalPrefix() const { return PrivateGlobalPrefix; } |
481 | StringRef getPrivateLabelPrefix() const { return PrivateLabelPrefix; } |
482 | |
483 | bool hasLinkerPrivateGlobalPrefix() const { |
484 | return LinkerPrivateGlobalPrefix[0] != '\0'; |
485 | } |
486 | |
487 | StringRef getLinkerPrivateGlobalPrefix() const { |
488 | if (hasLinkerPrivateGlobalPrefix()) |
489 | return LinkerPrivateGlobalPrefix; |
490 | return getPrivateGlobalPrefix(); |
491 | } |
492 | |
493 | const char *getInlineAsmStart() const { return InlineAsmStart; } |
494 | const char *getInlineAsmEnd() const { return InlineAsmEnd; } |
495 | const char *getCode16Directive() const { return Code16Directive; } |
496 | const char *getCode32Directive() const { return Code32Directive; } |
497 | const char *getCode64Directive() const { return Code64Directive; } |
498 | unsigned getAssemblerDialect() const { return AssemblerDialect; } |
499 | bool doesAllowAtInName() const { return AllowAtInName; } |
500 | bool supportsNameQuoting() const { return SupportsQuotedNames; } |
501 | |
502 | bool doesSupportDataRegionDirectives() const { |
503 | return UseDataRegionDirectives; |
504 | } |
505 | |
506 | const char *getZeroDirective() const { return ZeroDirective; } |
507 | const char *getAsciiDirective() const { return AsciiDirective; } |
508 | const char *getAscizDirective() const { return AscizDirective; } |
509 | bool getAlignmentIsInBytes() const { return AlignmentIsInBytes; } |
510 | unsigned getTextAlignFillValue() const { return TextAlignFillValue; } |
511 | const char *getGlobalDirective() const { return GlobalDirective; } |
512 | |
513 | bool doesSetDirectiveSuppressReloc() const { |
514 | return SetDirectiveSuppressesReloc; |
515 | } |
516 | |
517 | bool hasAggressiveSymbolFolding() const { return HasAggressiveSymbolFolding; } |
518 | |
519 | bool getCOMMDirectiveAlignmentIsInBytes() const { |
520 | return COMMDirectiveAlignmentIsInBytes; |
521 | } |
522 | |
523 | LCOMM::LCOMMType getLCOMMDirectiveAlignmentType() const { |
524 | return LCOMMDirectiveAlignmentType; |
525 | } |
526 | |
527 | bool hasFunctionAlignment() const { return HasFunctionAlignment; } |
528 | bool hasDotTypeDotSizeDirective() const { return HasDotTypeDotSizeDirective; } |
529 | bool hasSingleParameterDotFile() const { return HasSingleParameterDotFile; } |
530 | bool hasIdentDirective() const { return HasIdentDirective; } |
531 | bool hasNoDeadStrip() const { return HasNoDeadStrip; } |
532 | bool hasAltEntry() const { return HasAltEntry; } |
533 | const char *getWeakDirective() const { return WeakDirective; } |
534 | const char *getWeakRefDirective() const { return WeakRefDirective; } |
535 | bool hasWeakDefDirective() const { return HasWeakDefDirective; } |
536 | |
537 | bool hasWeakDefCanBeHiddenDirective() const { |
538 | return HasWeakDefCanBeHiddenDirective; |
539 | } |
540 | |
541 | bool hasLinkOnceDirective() const { return HasLinkOnceDirective; } |
542 | |
543 | MCSymbolAttr getHiddenVisibilityAttr() const { return HiddenVisibilityAttr; } |
544 | |
545 | MCSymbolAttr getHiddenDeclarationVisibilityAttr() const { |
546 | return HiddenDeclarationVisibilityAttr; |
547 | } |
548 | |
549 | MCSymbolAttr getProtectedVisibilityAttr() const { |
550 | return ProtectedVisibilityAttr; |
551 | } |
552 | |
553 | bool doesSupportDebugInformation() const { return SupportsDebugInformation; } |
554 | |
555 | bool doesSupportExceptionHandling() const { |
556 | return ExceptionsType != ExceptionHandling::None; |
557 | } |
558 | |
559 | ExceptionHandling getExceptionHandlingType() const { return ExceptionsType; } |
560 | WinEH::EncodingType getWinEHEncodingType() const { return WinEHEncodingType; } |
561 | |
562 | void setExceptionsType(ExceptionHandling EH) { |
563 | ExceptionsType = EH; |
564 | } |
565 | |
566 | /// Returns true if the exception handling method for the platform uses call |
567 | /// frame information to unwind. |
568 | bool usesCFIForEH() const { |
569 | return (ExceptionsType == ExceptionHandling::DwarfCFI || |
570 | ExceptionsType == ExceptionHandling::ARM || usesWindowsCFI()); |
571 | } |
572 | |
573 | bool usesWindowsCFI() const { |
574 | return ExceptionsType == ExceptionHandling::WinEH && |
575 | (WinEHEncodingType != WinEH::EncodingType::Invalid && |
576 | WinEHEncodingType != WinEH::EncodingType::X86); |
577 | } |
578 | |
579 | bool doesDwarfUseRelocationsAcrossSections() const { |
580 | return DwarfUsesRelocationsAcrossSections; |
581 | } |
582 | |
583 | bool doDwarfFDESymbolsUseAbsDiff() const { return DwarfFDESymbolsUseAbsDiff; } |
584 | bool useDwarfRegNumForCFI() const { return DwarfRegNumForCFI; } |
585 | bool useParensForSymbolVariant() const { return UseParensForSymbolVariant; } |
586 | bool supportsExtendedDwarfLocDirective() const { |
587 | return SupportsExtendedDwarfLocDirective; |
588 | } |
589 | |
590 | void addInitialFrameState(const MCCFIInstruction &Inst) { |
591 | InitialFrameState.push_back(Inst); |
592 | } |
593 | |
594 | const std::vector<MCCFIInstruction> &getInitialFrameState() const { |
595 | return InitialFrameState; |
596 | } |
597 | |
598 | /// Return true if assembly (inline or otherwise) should be parsed. |
599 | bool useIntegratedAssembler() const { return UseIntegratedAssembler; } |
600 | |
601 | /// Set whether assembly (inline or otherwise) should be parsed. |
602 | virtual void setUseIntegratedAssembler(bool Value) { |
603 | UseIntegratedAssembler = Value; |
604 | } |
605 | |
606 | /// Return true if assembly (inline or otherwise) should be parsed. |
607 | bool preserveAsmComments() const { return PreserveAsmComments; } |
608 | |
609 | /// Set whether assembly (inline or otherwise) should be parsed. |
610 | virtual void setPreserveAsmComments(bool Value) { |
611 | PreserveAsmComments = Value; |
612 | } |
613 | |
614 | DebugCompressionType compressDebugSections() const { |
615 | return CompressDebugSections; |
616 | } |
617 | |
618 | void setCompressDebugSections(DebugCompressionType CompressDebugSections) { |
619 | this->CompressDebugSections = CompressDebugSections; |
620 | } |
621 | |
622 | bool shouldUseLogicalShr() const { return UseLogicalShr; } |
623 | |
624 | bool canRelaxRelocations() const { return RelaxELFRelocations; } |
625 | void setRelaxELFRelocations(bool V) { RelaxELFRelocations = V; } |
626 | bool hasMipsExpressions() const { return HasMipsExpressions; } |
627 | }; |
628 | |
629 | } // end namespace llvm |
630 | |
631 | #endif // LLVM_MC_MCASMINFO_H |