Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:44:12

0001 //===-- llvm/MC/MCAsmInfo.h - Asm info --------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 // This file contains a class to be used as the basis for target specific
0010 // asm writers.  This class primarily takes care of global printing constants,
0011 // which are used in very similar ways across all targets.
0012 //
0013 //===----------------------------------------------------------------------===//
0014 
0015 #ifndef LLVM_MC_MCASMINFO_H
0016 #define LLVM_MC_MCASMINFO_H
0017 
0018 #include "llvm/ADT/StringRef.h"
0019 #include "llvm/MC/MCDirectives.h"
0020 #include "llvm/MC/MCTargetOptions.h"
0021 #include <vector>
0022 
0023 namespace llvm {
0024 
0025 class MCContext;
0026 class MCCFIInstruction;
0027 class MCExpr;
0028 class MCSection;
0029 class MCStreamer;
0030 class MCSubtargetInfo;
0031 class MCSymbol;
0032 
0033 namespace WinEH {
0034 
0035 enum class EncodingType {
0036   Invalid, /// Invalid
0037   Alpha,   /// Windows Alpha
0038   Alpha64, /// Windows AXP64
0039   ARM,     /// Windows NT (Windows on ARM)
0040   CE,      /// Windows CE ARM, PowerPC, SH3, SH4
0041   Itanium, /// Windows x64, Windows Itanium (IA-64)
0042   X86,     /// Windows x86, uses no CFI, just EH tables
0043   MIPS = Alpha,
0044 };
0045 
0046 } // end namespace WinEH
0047 
0048 namespace LCOMM {
0049 
0050 enum LCOMMType { NoAlignment, ByteAlignment, Log2Alignment };
0051 
0052 } // end namespace LCOMM
0053 
0054 /// This class is intended to be used as a base class for asm
0055 /// properties and features specific to the target.
0056 class MCAsmInfo {
0057 public:
0058   /// Assembly character literal syntax types.
0059   enum AsmCharLiteralSyntax {
0060     ACLS_Unknown, /// Unknown; character literals not used by LLVM for this
0061                   /// target.
0062     ACLS_SingleQuotePrefix, /// The desired character is prefixed by a single
0063                             /// quote, e.g., `'A`.
0064   };
0065 
0066 protected:
0067   //===------------------------------------------------------------------===//
0068   // Properties to be set by the target writer, used to configure asm printer.
0069   //
0070 
0071   /// Code pointer size in bytes.  Default is 4.
0072   unsigned CodePointerSize = 4;
0073 
0074   /// Size of the stack slot reserved for callee-saved registers, in bytes.
0075   /// Default is same as pointer size.
0076   unsigned CalleeSaveStackSlotSize = 4;
0077 
0078   /// True if target is little endian.  Default is true.
0079   bool IsLittleEndian = true;
0080 
0081   /// True if target stack grow up.  Default is false.
0082   bool StackGrowsUp = false;
0083 
0084   /// True if this target has the MachO .subsections_via_symbols directive.
0085   /// Default is false.
0086   bool HasSubsectionsViaSymbols = false;
0087 
0088   /// True if this is a non-GNU COFF target. The COFF port of the GNU linker
0089   /// doesn't handle associative comdats in the way that we would like to use
0090   /// them.
0091   bool HasCOFFAssociativeComdats = false;
0092 
0093   /// True if this is a non-GNU COFF target. For GNU targets, we don't generate
0094   /// constants into comdat sections.
0095   bool HasCOFFComdatConstants = false;
0096 
0097   bool IsAIX = false;
0098 
0099   // True if using the HLASM dialect on z/OS.
0100   bool IsHLASM = false;
0101 
0102   /// This is the maximum possible length of an instruction, which is needed to
0103   /// compute the size of an inline asm.  Defaults to 4.
0104   unsigned MaxInstLength = 4;
0105 
0106   /// Every possible instruction length is a multiple of this value.  Factored
0107   /// out in .debug_frame and .debug_line.  Defaults to 1.
0108   unsigned MinInstAlignment = 1;
0109 
0110   /// The '$' token, when not referencing an identifier or constant, refers to
0111   /// the current PC.  Defaults to false.
0112   bool DollarIsPC = false;
0113 
0114   /// This string, if specified, is used to separate instructions from each
0115   /// other when on the same line.  Defaults to ';'
0116   const char *SeparatorString;
0117 
0118   /// This indicates the comment string used by the assembler.  Defaults to
0119   /// "#"
0120   StringRef CommentString;
0121 
0122   /// This indicates whether to allow additional "comment strings" to be lexed
0123   /// as a comment. Setting this attribute to true, will ensure that C-style
0124   /// line comments (// ..), C-style block comments (/* .. */), and "#" are
0125   /// all treated as comments in addition to the string specified by the
0126   /// CommentString attribute.
0127   /// Default is true.
0128   bool AllowAdditionalComments = true;
0129 
0130   /// This is appended to emitted labels.  Defaults to ":"
0131   const char *LabelSuffix;
0132 
0133   // Print the EH begin symbol with an assignment. Defaults to false.
0134   bool UseAssignmentForEHBegin = false;
0135 
0136   // Do we need to create a local symbol for .size?
0137   bool NeedsLocalForSize = false;
0138 
0139   /// This prefix is used for globals like constant pool entries that are
0140   /// completely private to the .s file and should not have names in the .o
0141   /// file.  Defaults to "L"
0142   StringRef PrivateGlobalPrefix;
0143 
0144   /// This prefix is used for labels for basic blocks. Defaults to the same as
0145   /// PrivateGlobalPrefix.
0146   StringRef PrivateLabelPrefix;
0147 
0148   /// This prefix is used for symbols that should be passed through the
0149   /// assembler but be removed by the linker.  This is 'l' on Darwin, currently
0150   /// used for some ObjC metadata.  The default of "" meast that for this system
0151   /// a plain private symbol should be used.  Defaults to "".
0152   StringRef LinkerPrivateGlobalPrefix;
0153 
0154   /// If these are nonempty, they contain a directive to emit before and after
0155   /// an inline assembly statement.  Defaults to "#APP\n", "#NO_APP\n"
0156   const char *InlineAsmStart;
0157   const char *InlineAsmEnd;
0158 
0159   /// These are assembly directives that tells the assembler to interpret the
0160   /// following instructions differently.  Defaults to ".code16", ".code32",
0161   /// ".code64".
0162   const char *Code16Directive;
0163   const char *Code32Directive;
0164   const char *Code64Directive;
0165 
0166   /// Which dialect of an assembler variant to use.  Defaults to 0
0167   unsigned AssemblerDialect = 0;
0168 
0169   /// This is true if the assembler allows @ characters in symbol names.
0170   /// Defaults to false.
0171   bool AllowAtInName = false;
0172 
0173   /// This is true if the assembler allows the "?" character at the start of
0174   /// of a string to be lexed as an AsmToken::Identifier.
0175   /// If the AsmLexer determines that the string can be lexed as a possible
0176   /// comment, setting this option will have no effect, and the string will
0177   /// still be lexed as a comment.
0178   bool AllowQuestionAtStartOfIdentifier = false;
0179 
0180   /// This is true if the assembler allows the "$" character at the start of
0181   /// of a string to be lexed as an AsmToken::Identifier.
0182   /// If the AsmLexer determines that the string can be lexed as a possible
0183   /// comment, setting this option will have no effect, and the string will
0184   /// still be lexed as a comment.
0185   bool AllowDollarAtStartOfIdentifier = false;
0186 
0187   /// This is true if the assembler allows the "@" character at the start of
0188   /// a string to be lexed as an AsmToken::Identifier.
0189   /// If the AsmLexer determines that the string can be lexed as a possible
0190   /// comment, setting this option will have no effect, and the string will
0191   /// still be lexed as a comment.
0192   bool AllowAtAtStartOfIdentifier = false;
0193 
0194   /// If this is true, symbol names with invalid characters will be printed in
0195   /// quotes.
0196   bool SupportsQuotedNames = true;
0197 
0198   /// This is true if data region markers should be printed as
0199   /// ".data_region/.end_data_region" directives. If false, use "$d/$a" labels
0200   /// instead.
0201   bool UseDataRegionDirectives = false;
0202 
0203   /// True if the target supports LEB128 directives.
0204   bool HasLEB128Directives = true;
0205 
0206   /// True if full register names are printed.
0207   bool PPCUseFullRegisterNames = false;
0208 
0209   //===--- Data Emission Directives -------------------------------------===//
0210 
0211   /// This should be set to the directive used to get some number of zero (and
0212   /// non-zero if supported by the directive) bytes emitted to the current
0213   /// section. Common cases are "\t.zero\t" and "\t.space\t". Defaults to
0214   /// "\t.zero\t"
0215   const char *ZeroDirective;
0216 
0217   /// This directive allows emission of an ascii string with the standard C
0218   /// escape characters embedded into it.  If a target doesn't support this, it
0219   /// can be set to null. Defaults to "\t.ascii\t"
0220   const char *AsciiDirective;
0221 
0222   /// If not null, this allows for special handling of zero terminated strings
0223   /// on this target.  This is commonly supported as ".asciz".  If a target
0224   /// doesn't support this, it can be set to null.  Defaults to "\t.asciz\t"
0225   const char *AscizDirective;
0226 
0227   /// Form used for character literals in the assembly syntax.  Useful for
0228   /// producing strings as byte lists.  If a target does not use or support
0229   /// this, it shall be set to ACLS_Unknown.  Defaults to ACLS_Unknown.
0230   AsmCharLiteralSyntax CharacterLiteralSyntax = ACLS_Unknown;
0231 
0232   /// These directives are used to output some unit of integer data to the
0233   /// current section.  If a data directive is set to null, smaller data
0234   /// directives will be used to emit the large sizes.  Defaults to "\t.byte\t",
0235   /// "\t.short\t", "\t.long\t", "\t.quad\t"
0236   const char *Data8bitsDirective;
0237   const char *Data16bitsDirective;
0238   const char *Data32bitsDirective;
0239   const char *Data64bitsDirective;
0240 
0241   /// True if data directives support signed values
0242   bool SupportsSignedData = true;
0243 
0244   /// If non-null, a directive that is used to emit a word which should be
0245   /// relocated as a 64-bit GP-relative offset, e.g. .gpdword on Mips.  Defaults
0246   /// to nullptr.
0247   const char *GPRel64Directive = nullptr;
0248 
0249   /// If non-null, a directive that is used to emit a word which should be
0250   /// relocated as a 32-bit GP-relative offset, e.g. .gpword on Mips or .gprel32
0251   /// on Alpha.  Defaults to nullptr.
0252   const char *GPRel32Directive = nullptr;
0253 
0254   /// If non-null, directives that are used to emit a word/dword which should
0255   /// be relocated as a 32/64-bit DTP/TP-relative offset, e.g. .dtprelword/
0256   /// .dtpreldword/.tprelword/.tpreldword on Mips.
0257   const char *DTPRel32Directive = nullptr;
0258   const char *DTPRel64Directive = nullptr;
0259   const char *TPRel32Directive = nullptr;
0260   const char *TPRel64Directive = nullptr;
0261 
0262   /// This is true if this target uses "Sun Style" syntax for section switching
0263   /// ("#alloc,#write" etc) instead of the normal ELF syntax (,"a,w") in
0264   /// .section directives.  Defaults to false.
0265   bool SunStyleELFSectionSwitchSyntax = false;
0266 
0267   /// This is true if this target uses ELF '.section' directive before the
0268   /// '.bss' one. It's used for PPC/Linux which doesn't support the '.bss'
0269   /// directive only.  Defaults to false.
0270   bool UsesELFSectionDirectiveForBSS = false;
0271 
0272   bool NeedsDwarfSectionOffsetDirective = false;
0273 
0274   //===--- Alignment Information ----------------------------------------===//
0275 
0276   /// If this is true (the default) then the asmprinter emits ".align N"
0277   /// directives, where N is the number of bytes to align to.  Otherwise, it
0278   /// emits ".align log2(N)", e.g. 3 to align to an 8 byte boundary.  Defaults
0279   /// to true.
0280   bool AlignmentIsInBytes = true;
0281 
0282   /// If non-zero, this is used to fill the executable space created as the
0283   /// result of a alignment directive.  Defaults to 0
0284   unsigned TextAlignFillValue = 0;
0285 
0286   //===--- Global Variable Emission Directives --------------------------===//
0287 
0288   /// This is the directive used to declare a global entity. Defaults to
0289   /// ".globl".
0290   const char *GlobalDirective;
0291 
0292   /// True if the expression
0293   ///   .long f - g
0294   /// uses a relocation but it can be suppressed by writing
0295   ///   a = f - g
0296   ///   .long a
0297   bool SetDirectiveSuppressesReloc = false;
0298 
0299   /// True is .comm's and .lcomms optional alignment is to be specified in bytes
0300   /// instead of log2(n).  Defaults to true.
0301   bool COMMDirectiveAlignmentIsInBytes = true;
0302 
0303   /// Describes if the .lcomm directive for the target supports an alignment
0304   /// argument and how it is interpreted.  Defaults to NoAlignment.
0305   LCOMM::LCOMMType LCOMMDirectiveAlignmentType = LCOMM::NoAlignment;
0306 
0307   // True if the target allows .align directives on functions. This is true for
0308   // most targets, so defaults to true.
0309   bool HasFunctionAlignment = true;
0310 
0311   /// True if the target has .type and .size directives, this is true for most
0312   /// ELF targets.  Defaults to true.
0313   bool HasDotTypeDotSizeDirective = true;
0314 
0315   /// True if the target has a single parameter .file directive, this is true
0316   /// for ELF targets.  Defaults to true.
0317   bool HasSingleParameterDotFile = true;
0318 
0319   /// True if the target has a .ident directive, this is true for ELF targets.
0320   /// Defaults to false.
0321   bool HasIdentDirective = false;
0322 
0323   /// True if this target supports the MachO .no_dead_strip directive.  Defaults
0324   /// to false.
0325   bool HasNoDeadStrip = false;
0326 
0327   /// Used to declare a global as being a weak symbol. Defaults to ".weak".
0328   const char *WeakDirective;
0329 
0330   /// This directive, if non-null, is used to declare a global as being a weak
0331   /// undefined symbol.  Defaults to nullptr.
0332   const char *WeakRefDirective = nullptr;
0333 
0334   /// True if we have a directive to declare a global as being a weak defined
0335   /// symbol that can be hidden (unexported).  Defaults to false.
0336   bool HasWeakDefCanBeHiddenDirective = false;
0337 
0338   /// True if we should mark symbols as global instead of weak, for
0339   /// weak*/linkonce*, if the symbol has a comdat.
0340   /// Defaults to false.
0341   bool AvoidWeakIfComdat = false;
0342 
0343   /// This attribute, if not MCSA_Invalid, is used to declare a symbol as having
0344   /// hidden visibility.  Defaults to MCSA_Hidden.
0345   MCSymbolAttr HiddenVisibilityAttr = MCSA_Hidden;
0346 
0347   /// This attribute, if not MCSA_Invalid, is used to declare a symbol as having
0348   /// exported visibility.  Defaults to MCSA_Exported.
0349   MCSymbolAttr ExportedVisibilityAttr = MCSA_Exported;
0350 
0351   /// This attribute, if not MCSA_Invalid, is used to declare an undefined
0352   /// symbol as having hidden visibility. Defaults to MCSA_Hidden.
0353   MCSymbolAttr HiddenDeclarationVisibilityAttr = MCSA_Hidden;
0354 
0355   /// This attribute, if not MCSA_Invalid, is used to declare a symbol as having
0356   /// protected visibility.  Defaults to MCSA_Protected
0357   MCSymbolAttr ProtectedVisibilityAttr = MCSA_Protected;
0358 
0359   MCSymbolAttr MemtagAttr = MCSA_Memtag;
0360 
0361   //===--- Dwarf Emission Directives -----------------------------------===//
0362 
0363   /// True if target supports emission of debugging information.  Defaults to
0364   /// false.
0365   bool SupportsDebugInformation = false;
0366 
0367   /// Exception handling format for the target.  Defaults to None.
0368   ExceptionHandling ExceptionsType = ExceptionHandling::None;
0369 
0370   /// True if target uses CFI unwind information for other purposes than EH
0371   /// (debugging / sanitizers) when `ExceptionsType == ExceptionHandling::None`.
0372   bool UsesCFIWithoutEH = false;
0373 
0374   /// Windows exception handling data (.pdata) encoding.  Defaults to Invalid.
0375   WinEH::EncodingType WinEHEncodingType = WinEH::EncodingType::Invalid;
0376 
0377   /// True if Dwarf2 output generally uses relocations for references to other
0378   /// .debug_* sections.
0379   bool DwarfUsesRelocationsAcrossSections = true;
0380 
0381   /// True if DWARF FDE symbol reference relocations should be replaced by an
0382   /// absolute difference.
0383   bool DwarfFDESymbolsUseAbsDiff = false;
0384 
0385   /// True if DWARF `.file directory' directive syntax is used by
0386   /// default.
0387   bool EnableDwarfFileDirectoryDefault = true;
0388 
0389   /// True if dwarf register numbers are printed instead of symbolic register
0390   /// names in .cfi_* directives.  Defaults to false.
0391   bool DwarfRegNumForCFI = false;
0392 
0393   /// True if target uses parens to indicate the symbol variant instead of @.
0394   /// For example, foo(plt) instead of foo@plt.  Defaults to false.
0395   bool UseParensForSymbolVariant = false;
0396 
0397   /// True if the target uses parens for symbol names starting with
0398   /// '$' character to distinguish them from absolute names.
0399   bool UseParensForDollarSignNames = true;
0400 
0401   /// True if the target supports flags in ".loc" directive, false if only
0402   /// location is allowed.
0403   bool SupportsExtendedDwarfLocDirective = true;
0404 
0405   //===--- Prologue State ----------------------------------------------===//
0406 
0407   std::vector<MCCFIInstruction> InitialFrameState;
0408 
0409   //===--- Integrated Assembler Information ----------------------------===//
0410 
0411   // Generated object files can use all ELF features supported by GNU ld of
0412   // this binutils version and later. INT_MAX means all features can be used,
0413   // regardless of GNU ld support. The default value is referenced by
0414   // clang/Driver/Options.td.
0415   std::pair<int, int> BinutilsVersion = {2, 26};
0416 
0417   /// Should we use the integrated assembler?
0418   /// The integrated assembler should be enabled by default (by the
0419   /// constructors) when failing to parse a valid piece of assembly (inline
0420   /// or otherwise) is considered a bug. It may then be overridden after
0421   /// construction (see CodeGenTargetMachineImpl::initAsmInfo()).
0422   bool UseIntegratedAssembler;
0423 
0424   /// Use AsmParser to parse inlineAsm when UseIntegratedAssembler is not set.
0425   bool ParseInlineAsmUsingAsmParser;
0426 
0427   /// Preserve Comments in assembly
0428   bool PreserveAsmComments;
0429 
0430   /// The column (zero-based) at which asm comments should be printed.
0431   unsigned CommentColumn = 40;
0432 
0433   /// True if the integrated assembler should interpret 'a >> b' constant
0434   /// expressions as logical rather than arithmetic.
0435   bool UseLogicalShr = true;
0436 
0437   // If true, then the lexer and expression parser will support %neg(),
0438   // %hi(), and similar unary operators.
0439   bool HasMipsExpressions = false;
0440 
0441   // If true, use Motorola-style integers in Assembly (ex. $0ac).
0442   bool UseMotorolaIntegers = false;
0443 
0444 public:
0445   explicit MCAsmInfo();
0446   virtual ~MCAsmInfo();
0447 
0448   /// Get the code pointer size in bytes.
0449   unsigned getCodePointerSize() const { return CodePointerSize; }
0450 
0451   /// Get the callee-saved register stack slot
0452   /// size in bytes.
0453   unsigned getCalleeSaveStackSlotSize() const {
0454     return CalleeSaveStackSlotSize;
0455   }
0456 
0457   /// True if the target is little endian.
0458   bool isLittleEndian() const { return IsLittleEndian; }
0459 
0460   /// True if target stack grow up.
0461   bool isStackGrowthDirectionUp() const { return StackGrowsUp; }
0462 
0463   bool hasSubsectionsViaSymbols() const { return HasSubsectionsViaSymbols; }
0464 
0465   // Data directive accessors.
0466 
0467   const char *getData8bitsDirective() const { return Data8bitsDirective; }
0468   const char *getData16bitsDirective() const { return Data16bitsDirective; }
0469   const char *getData32bitsDirective() const { return Data32bitsDirective; }
0470   const char *getData64bitsDirective() const { return Data64bitsDirective; }
0471   bool supportsSignedData() const { return SupportsSignedData; }
0472   const char *getGPRel64Directive() const { return GPRel64Directive; }
0473   const char *getGPRel32Directive() const { return GPRel32Directive; }
0474   const char *getDTPRel64Directive() const { return DTPRel64Directive; }
0475   const char *getDTPRel32Directive() const { return DTPRel32Directive; }
0476   const char *getTPRel64Directive() const { return TPRel64Directive; }
0477   const char *getTPRel32Directive() const { return TPRel32Directive; }
0478 
0479   /// Targets can implement this method to specify a section to switch to if the
0480   /// translation unit doesn't have any trampolines that require an executable
0481   /// stack.
0482   virtual MCSection *getNonexecutableStackSection(MCContext &Ctx) const {
0483     return nullptr;
0484   }
0485 
0486   virtual const MCExpr *getExprForPersonalitySymbol(const MCSymbol *Sym,
0487                                                     unsigned Encoding,
0488                                                     MCStreamer &Streamer) const;
0489 
0490   virtual const MCExpr *getExprForFDESymbol(const MCSymbol *Sym,
0491                                             unsigned Encoding,
0492                                             MCStreamer &Streamer) const;
0493 
0494   /// Return true if C is an acceptable character inside a symbol name.
0495   virtual bool isAcceptableChar(char C) const;
0496 
0497   /// Return true if the identifier \p Name does not need quotes to be
0498   /// syntactically correct.
0499   virtual bool isValidUnquotedName(StringRef Name) const;
0500 
0501   /// Return true if the .section directive should be omitted when
0502   /// emitting \p SectionName.  For example:
0503   ///
0504   /// shouldOmitSectionDirective(".text")
0505   ///
0506   /// returns false => .section .text,#alloc,#execinstr
0507   /// returns true  => .text
0508   virtual bool shouldOmitSectionDirective(StringRef SectionName) const;
0509 
0510   bool usesSunStyleELFSectionSwitchSyntax() const {
0511     return SunStyleELFSectionSwitchSyntax;
0512   }
0513 
0514   bool usesELFSectionDirectiveForBSS() const {
0515     return UsesELFSectionDirectiveForBSS;
0516   }
0517 
0518   bool needsDwarfSectionOffsetDirective() const {
0519     return NeedsDwarfSectionOffsetDirective;
0520   }
0521 
0522   // Accessors.
0523 
0524   bool isAIX() const { return IsAIX; }
0525   bool isHLASM() const { return IsHLASM; }
0526   bool isMachO() const { return HasSubsectionsViaSymbols; }
0527   bool hasCOFFAssociativeComdats() const { return HasCOFFAssociativeComdats; }
0528   bool hasCOFFComdatConstants() const { return HasCOFFComdatConstants; }
0529 
0530   /// Returns the maximum possible encoded instruction size in bytes. If \p STI
0531   /// is null, this should be the maximum size for any subtarget.
0532   virtual unsigned getMaxInstLength(const MCSubtargetInfo *STI = nullptr) const {
0533     return MaxInstLength;
0534   }
0535 
0536   unsigned getMinInstAlignment() const { return MinInstAlignment; }
0537   bool getDollarIsPC() const { return DollarIsPC; }
0538   const char *getSeparatorString() const { return SeparatorString; }
0539 
0540   unsigned getCommentColumn() const { return CommentColumn; }
0541   void setCommentColumn(unsigned Col) { CommentColumn = Col; }
0542 
0543   StringRef getCommentString() const { return CommentString; }
0544   bool shouldAllowAdditionalComments() const { return AllowAdditionalComments; }
0545   const char *getLabelSuffix() const { return LabelSuffix; }
0546 
0547   bool useAssignmentForEHBegin() const { return UseAssignmentForEHBegin; }
0548   bool needsLocalForSize() const { return NeedsLocalForSize; }
0549   StringRef getPrivateGlobalPrefix() const { return PrivateGlobalPrefix; }
0550   StringRef getPrivateLabelPrefix() const { return PrivateLabelPrefix; }
0551 
0552   bool hasLinkerPrivateGlobalPrefix() const {
0553     return !LinkerPrivateGlobalPrefix.empty();
0554   }
0555 
0556   StringRef getLinkerPrivateGlobalPrefix() const {
0557     if (hasLinkerPrivateGlobalPrefix())
0558       return LinkerPrivateGlobalPrefix;
0559     return getPrivateGlobalPrefix();
0560   }
0561 
0562   const char *getInlineAsmStart() const { return InlineAsmStart; }
0563   const char *getInlineAsmEnd() const { return InlineAsmEnd; }
0564   const char *getCode16Directive() const { return Code16Directive; }
0565   const char *getCode32Directive() const { return Code32Directive; }
0566   const char *getCode64Directive() const { return Code64Directive; }
0567   unsigned getAssemblerDialect() const { return AssemblerDialect; }
0568   bool doesAllowAtInName() const { return AllowAtInName; }
0569   void setAllowAtInName(bool V) { AllowAtInName = V; }
0570   bool doesAllowQuestionAtStartOfIdentifier() const {
0571     return AllowQuestionAtStartOfIdentifier;
0572   }
0573   bool doesAllowAtAtStartOfIdentifier() const {
0574     return AllowAtAtStartOfIdentifier;
0575   }
0576   bool doesAllowDollarAtStartOfIdentifier() const {
0577     return AllowDollarAtStartOfIdentifier;
0578   }
0579   bool supportsNameQuoting() const { return SupportsQuotedNames; }
0580 
0581   bool doesSupportDataRegionDirectives() const {
0582     return UseDataRegionDirectives;
0583   }
0584 
0585   bool hasLEB128Directives() const { return HasLEB128Directives; }
0586 
0587   bool useFullRegisterNames() const { return PPCUseFullRegisterNames; }
0588   void setFullRegisterNames(bool V) { PPCUseFullRegisterNames = V; }
0589 
0590   const char *getZeroDirective() const { return ZeroDirective; }
0591   const char *getAsciiDirective() const { return AsciiDirective; }
0592   const char *getAscizDirective() const { return AscizDirective; }
0593   AsmCharLiteralSyntax characterLiteralSyntax() const {
0594     return CharacterLiteralSyntax;
0595   }
0596   bool getAlignmentIsInBytes() const { return AlignmentIsInBytes; }
0597   unsigned getTextAlignFillValue() const { return TextAlignFillValue; }
0598   const char *getGlobalDirective() const { return GlobalDirective; }
0599 
0600   bool doesSetDirectiveSuppressReloc() const {
0601     return SetDirectiveSuppressesReloc;
0602   }
0603 
0604   bool getCOMMDirectiveAlignmentIsInBytes() const {
0605     return COMMDirectiveAlignmentIsInBytes;
0606   }
0607 
0608   LCOMM::LCOMMType getLCOMMDirectiveAlignmentType() const {
0609     return LCOMMDirectiveAlignmentType;
0610   }
0611 
0612   bool hasFunctionAlignment() const { return HasFunctionAlignment; }
0613   bool hasDotTypeDotSizeDirective() const { return HasDotTypeDotSizeDirective; }
0614   bool hasSingleParameterDotFile() const { return HasSingleParameterDotFile; }
0615   bool hasIdentDirective() const { return HasIdentDirective; }
0616   bool hasNoDeadStrip() const { return HasNoDeadStrip; }
0617   const char *getWeakDirective() const { return WeakDirective; }
0618   const char *getWeakRefDirective() const { return WeakRefDirective; }
0619 
0620   bool hasWeakDefCanBeHiddenDirective() const {
0621     return HasWeakDefCanBeHiddenDirective;
0622   }
0623 
0624   bool avoidWeakIfComdat() const { return AvoidWeakIfComdat; }
0625 
0626   MCSymbolAttr getHiddenVisibilityAttr() const { return HiddenVisibilityAttr; }
0627 
0628   MCSymbolAttr getExportedVisibilityAttr() const { return ExportedVisibilityAttr; }
0629 
0630   MCSymbolAttr getHiddenDeclarationVisibilityAttr() const {
0631     return HiddenDeclarationVisibilityAttr;
0632   }
0633 
0634   MCSymbolAttr getProtectedVisibilityAttr() const {
0635     return ProtectedVisibilityAttr;
0636   }
0637 
0638   MCSymbolAttr getMemtagAttr() const { return MemtagAttr; }
0639 
0640   bool doesSupportDebugInformation() const { return SupportsDebugInformation; }
0641 
0642   ExceptionHandling getExceptionHandlingType() const { return ExceptionsType; }
0643   WinEH::EncodingType getWinEHEncodingType() const { return WinEHEncodingType; }
0644 
0645   void setExceptionsType(ExceptionHandling EH) {
0646     ExceptionsType = EH;
0647   }
0648 
0649   bool usesCFIWithoutEH() const {
0650     return ExceptionsType == ExceptionHandling::None && UsesCFIWithoutEH;
0651   }
0652 
0653   /// Returns true if the exception handling method for the platform uses call
0654   /// frame information to unwind.
0655   bool usesCFIForEH() const {
0656     return (ExceptionsType == ExceptionHandling::DwarfCFI ||
0657             ExceptionsType == ExceptionHandling::ARM ||
0658             ExceptionsType == ExceptionHandling::ZOS || usesWindowsCFI());
0659   }
0660 
0661   bool usesWindowsCFI() const {
0662     return ExceptionsType == ExceptionHandling::WinEH &&
0663            (WinEHEncodingType != WinEH::EncodingType::Invalid &&
0664             WinEHEncodingType != WinEH::EncodingType::X86);
0665   }
0666 
0667   bool doesDwarfUseRelocationsAcrossSections() const {
0668     return DwarfUsesRelocationsAcrossSections;
0669   }
0670 
0671   bool doDwarfFDESymbolsUseAbsDiff() const { return DwarfFDESymbolsUseAbsDiff; }
0672   bool useDwarfRegNumForCFI() const { return DwarfRegNumForCFI; }
0673   bool useParensForSymbolVariant() const { return UseParensForSymbolVariant; }
0674   bool useParensForDollarSignNames() const {
0675     return UseParensForDollarSignNames;
0676   }
0677   bool supportsExtendedDwarfLocDirective() const {
0678     return SupportsExtendedDwarfLocDirective;
0679   }
0680 
0681   bool usesDwarfFileAndLocDirectives() const { return !IsAIX; }
0682 
0683   bool enableDwarfFileDirectoryDefault() const {
0684     return EnableDwarfFileDirectoryDefault;
0685   }
0686 
0687   void addInitialFrameState(const MCCFIInstruction &Inst);
0688 
0689   const std::vector<MCCFIInstruction> &getInitialFrameState() const {
0690     return InitialFrameState;
0691   }
0692 
0693   void setBinutilsVersion(std::pair<int, int> Value) {
0694     BinutilsVersion = Value;
0695   }
0696 
0697   /// Return true if assembly (inline or otherwise) should be parsed.
0698   bool useIntegratedAssembler() const { return UseIntegratedAssembler; }
0699 
0700   /// Return true if target want to use AsmParser to parse inlineasm.
0701   bool parseInlineAsmUsingAsmParser() const {
0702     return ParseInlineAsmUsingAsmParser;
0703   }
0704 
0705   bool binutilsIsAtLeast(int Major, int Minor) const {
0706     return BinutilsVersion >= std::make_pair(Major, Minor);
0707   }
0708 
0709   /// Set whether assembly (inline or otherwise) should be parsed.
0710   virtual void setUseIntegratedAssembler(bool Value) {
0711     UseIntegratedAssembler = Value;
0712   }
0713 
0714   /// Set whether target want to use AsmParser to parse inlineasm.
0715   virtual void setParseInlineAsmUsingAsmParser(bool Value) {
0716     ParseInlineAsmUsingAsmParser = Value;
0717   }
0718 
0719   /// Return true if assembly (inline or otherwise) should be parsed.
0720   bool preserveAsmComments() const { return PreserveAsmComments; }
0721 
0722   /// Set whether assembly (inline or otherwise) should be parsed.
0723   virtual void setPreserveAsmComments(bool Value) {
0724     PreserveAsmComments = Value;
0725   }
0726 
0727 
0728   bool shouldUseLogicalShr() const { return UseLogicalShr; }
0729 
0730   bool hasMipsExpressions() const { return HasMipsExpressions; }
0731   bool shouldUseMotorolaIntegers() const { return UseMotorolaIntegers; }
0732 };
0733 
0734 } // end namespace llvm
0735 
0736 #endif // LLVM_MC_MCASMINFO_H