Coverage Report

Created: 2019-07-24 05:18

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