Coverage Report

Created: 2019-02-23 12:57

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