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