MCAsmInfo.h revision 74aae4726a66733c5872588287535a984f9a94c7
182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner//===-- llvm/MC/MCAsmInfo.h - Asm info --------------------------*- C++ -*-===// 282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner// 382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner// The LLVM Compiler Infrastructure 482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner// 582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner// This file is distributed under the University of Illinois Open Source 682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner// License. See LICENSE.TXT for details. 782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner// 882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner//===----------------------------------------------------------------------===// 982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner// 1082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner// This file contains a class to be used as the basis for target specific 1182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner// asm writers. This class primarily takes care of global printing constants, 1282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner// which are used in very similar ways across all targets. 1382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner// 1482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner//===----------------------------------------------------------------------===// 15af76e592c7f9deff0e55c13dbb4a34f07f1c7f64Chris Lattner 1682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner#ifndef LLVM_TARGET_ASM_INFO_H 1782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner#define LLVM_TARGET_ASM_INFO_H 18af76e592c7f9deff0e55c13dbb4a34f07f1c7f64Chris Lattner 19152a29bfa6fa505182658d046bc75626e10d67c3Chris Lattner#include "llvm/MC/MCDirectives.h" 2082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner#include <cassert> 2182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner 2282d748d55c549dd055528ed10dbb534618ca8115Chris Lattnernamespace llvm { 23f9f93e4388962b678fd59b7af5212d4cc0d38be2Chris Lattner class MCSection; 24f9f93e4388962b678fd59b7af5212d4cc0d38be2Chris Lattner class MCContext; 25f9f93e4388962b678fd59b7af5212d4cc0d38be2Chris Lattner 2682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// MCAsmInfo - This class is intended to be used as a base class for asm 2782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// properties and features specific to the target. 2882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner namespace ExceptionHandling { enum ExceptionsType { None, Dwarf, SjLj }; } 2982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner 3082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner class MCAsmInfo { 3182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner protected: 3282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner //===------------------------------------------------------------------===// 3382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner // Properties to be set by the target writer, used to configure asm printer. 3482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner // 3582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner 36f9f93e4388962b678fd59b7af5212d4cc0d38be2Chris Lattner /// HasSubsectionsViaSymbols - True if this target has the MachO 37f9f93e4388962b678fd59b7af5212d4cc0d38be2Chris Lattner /// .subsections_via_symbols directive. 38f9f93e4388962b678fd59b7af5212d4cc0d38be2Chris Lattner bool HasSubsectionsViaSymbols; // Default is false. 39f9f93e4388962b678fd59b7af5212d4cc0d38be2Chris Lattner 40aac138e84dee1cb3ffc1035b2a1e4361fe0b4f80Chris Lattner /// HasMachoZeroFillDirective - True if this is a MachO target that supports 41aac138e84dee1cb3ffc1035b2a1e4361fe0b4f80Chris Lattner /// the macho-specific .zerofill directive for emitting BSS Symbols. 4271eae713153e564ec743c5c4162ff258c255de78Chris Lattner bool HasMachoZeroFillDirective; // Default is false. 4371eae713153e564ec743c5c4162ff258c255de78Chris Lattner 4451f5d6af8c45bf145808ced9e867ac711acc9955Eric Christopher /// HasStaticCtorDtorReferenceInStaticMode - True if the compiler should 4551f5d6af8c45bf145808ced9e867ac711acc9955Eric Christopher /// emit a ".reference .constructors_used" or ".reference .destructors_used" 4651f5d6af8c45bf145808ced9e867ac711acc9955Eric Christopher /// directive after the a static ctor/dtor list. This directive is only 4751f5d6af8c45bf145808ced9e867ac711acc9955Eric Christopher /// emitted in Static relocation model. 4871eae713153e564ec743c5c4162ff258c255de78Chris Lattner bool HasStaticCtorDtorReferenceInStaticMode; // Default is false. 4971eae713153e564ec743c5c4162ff258c255de78Chris Lattner 5071eae713153e564ec743c5c4162ff258c255de78Chris Lattner /// MaxInstLength - This is the maximum possible length of an instruction, 5171eae713153e564ec743c5c4162ff258c255de78Chris Lattner /// which is needed to compute the size of an inline asm. 5271eae713153e564ec743c5c4162ff258c255de78Chris Lattner unsigned MaxInstLength; // Defaults to 4. 53aac138e84dee1cb3ffc1035b2a1e4361fe0b4f80Chris Lattner 5482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// PCSymbol - The symbol used to represent the current PC. Used in PC 5582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// relative expressions. 56eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling const char *PCSymbol; // Defaults to "$". 5782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner 5882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// SeparatorChar - This character, if specified, is used to separate 5982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// instructions from each other when on the same line. This is used to 60eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling /// measure inline asm instructions. 6182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner char SeparatorChar; // Defaults to ';' 6282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner 6382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// CommentColumn - This indicates the comment num (zero-based) at 6482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// which asm comments should be printed. 65eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling unsigned CommentColumn; // Defaults to 40 6682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner 6782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// CommentString - This indicates the comment character used by the 6882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// assembler. 6973163f875ad7e5d56aa7d0d29509eb1e04542742Daniel Dunbar const char *CommentString; // Defaults to "#" 7082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner 7182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// GlobalPrefix - If this is set to a non-empty string, it is prepended 7282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// onto all global symbols. This is often used for "_" or ".". 73eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling const char *GlobalPrefix; // Defaults to "" 7482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner 75e07b75e069969558c3fbb2f5bfb9a652f6ea1d6bChris Lattner /// PrivateGlobalPrefix - This prefix is used for globals like constant 76e07b75e069969558c3fbb2f5bfb9a652f6ea1d6bChris Lattner /// pool entries that are completely private to the .s file and should not 77e07b75e069969558c3fbb2f5bfb9a652f6ea1d6bChris Lattner /// have names in the .o file. This is often "." or "L". 7882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner const char *PrivateGlobalPrefix; // Defaults to "." 7982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner 80eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling /// LinkerPrivateGlobalPrefix - This prefix is used for symbols that should 8182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// be passed through the assembler but be removed by the linker. This 8282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// is "l" on Darwin, currently used for some ObjC metadata. 8382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner const char *LinkerPrivateGlobalPrefix; // Defaults to "" 8482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner 85eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling /// InlineAsmStart/End - If these are nonempty, they contain a directive to 8682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// emit before and after an inline assembly statement. 8782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner const char *InlineAsmStart; // Defaults to "#APP\n" 8882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner const char *InlineAsmEnd; // Defaults to "#NO_APP\n" 8982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner 90eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling /// AssemblerDialect - Which dialect of an assembler variant to use. 9182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner unsigned AssemblerDialect; // Defaults to 0 9282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner 9382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// AllowQuotesInName - This is true if the assembler allows for complex 94eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling /// symbol names to be surrounded in quotes. This defaults to false. 95eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling bool AllowQuotesInName; 9682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner 9782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// AllowNameToStartWithDigit - This is true if the assembler allows symbol 98eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling /// names to start with a digit (e.g., "0x0021"). This defaults to false. 9982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner bool AllowNameToStartWithDigit; 10082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner 10182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner //===--- Data Emission Directives -------------------------------------===// 10282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner 103c6f729ed5519cdf398ca4039dbdbea4f81433ec0Anton Korobeynikov /// ZeroDirective - this should be set to the directive used to get some 104c6f729ed5519cdf398ca4039dbdbea4f81433ec0Anton Korobeynikov /// number of zero bytes emitted to the current section. Common cases are 105c6f729ed5519cdf398ca4039dbdbea4f81433ec0Anton Korobeynikov /// "\t.zero\t" and "\t.space\t". If this is set to null, the 106c6f729ed5519cdf398ca4039dbdbea4f81433ec0Anton Korobeynikov /// Data*bitsDirective's will be used to emit zero bytes. 107b9a01bcf486814a44098745920d43daaf9f7c260Mon P Wang const char *ZeroDirective; // Defaults to "\t.zero\t" 108b9a01bcf486814a44098745920d43daaf9f7c260Mon P Wang 109b9a01bcf486814a44098745920d43daaf9f7c260Mon P Wang /// AsciiDirective - This directive allows emission of an ascii string with 110b9a01bcf486814a44098745920d43daaf9f7c260Mon P Wang /// the standard C escape characters embedded into it. 111b9a01bcf486814a44098745920d43daaf9f7c260Mon P Wang const char *AsciiDirective; // Defaults to "\t.ascii\t" 11282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner 11382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// AscizDirective - If not null, this allows for special handling of 11482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// zero terminated strings on this target. This is commonly supported as 11582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// ".asciz". If a target doesn't support this, it can be set to null. 11682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner const char *AscizDirective; // Defaults to "\t.asciz\t" 11782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner 118eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling /// DataDirectives - These directives are used to output some unit of 11982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// integer data to the current section. If a data directive is set to 12082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// null, smaller data directives will be used to emit the large sizes. 12182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner const char *Data8bitsDirective; // Defaults to "\t.byte\t" 122eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling const char *Data16bitsDirective; // Defaults to "\t.short\t" 12382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner const char *Data32bitsDirective; // Defaults to "\t.long\t" 12482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner const char *Data64bitsDirective; // Defaults to "\t.quad\t" 12582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner 12682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// GPRel32Directive - if non-null, a directive that is used to emit a word 127eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling /// which should be relocated as a 32-bit GP-relative offset, e.g. .gpword 12882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// on Mips or .gprel32 on Alpha. 12982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner const char *GPRel32Directive; // Defaults to NULL. 13082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner 13182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// getDataASDirective - Return the directive that should be used to emit 132eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling /// data of the specified size to the specified numeric address space. 133eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling virtual const char *getDataASDirective(unsigned Size, unsigned AS) const { 134eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling assert(AS != 0 && "Don't know the directives for default addr space"); 135eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling return 0; 13682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner } 13778f485afb723121eedf4b6907ae6eb53da8af03cChris Lattner 13878f485afb723121eedf4b6907ae6eb53da8af03cChris Lattner /// SunStyleELFSectionSwitchSyntax - This is true if this target uses "Sun 13978f485afb723121eedf4b6907ae6eb53da8af03cChris Lattner /// Style" syntax for section switching ("#alloc,#write" etc) instead of the 14078f485afb723121eedf4b6907ae6eb53da8af03cChris Lattner /// normal ELF syntax (,"a,w") in .section directives. 14178f485afb723121eedf4b6907ae6eb53da8af03cChris Lattner bool SunStyleELFSectionSwitchSyntax; // Defaults to false. 14282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner 14382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// UsesELFSectionDirectiveForBSS - This is true if this target uses ELF 14482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// '.section' directive before the '.bss' one. It's used for PPC/Linux 14582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// which doesn't support the '.bss' directive only. 1465ec2e6b586bf4029763711d6860b57d312eb2d2eChris Lattner bool UsesELFSectionDirectiveForBSS; // Defaults to false. 14782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner 14882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// HasMicrosoftFastStdCallMangling - True if this target uses microsoft 14982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// style mangling for functions with X86_StdCall/X86_FastCall calling 15082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// convention. 15182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner bool HasMicrosoftFastStdCallMangling; // Defaults to false. 152eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling 15382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner //===--- Alignment Information ----------------------------------------===// 15482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner 15582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// AlignDirective - The directive used to emit round up to an alignment 15682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// boundary. 157eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling /// 15882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner const char *AlignDirective; // Defaults to "\t.align\t" 1598a29fa6e02c8a76a71f43fc8bf4e51dd12bac4bcChris Lattner 1608a29fa6e02c8a76a71f43fc8bf4e51dd12bac4bcChris Lattner /// AlignmentIsInBytes - If this is true (the default) then the asmprinter 1618a29fa6e02c8a76a71f43fc8bf4e51dd12bac4bcChris Lattner /// emits ".align N" directives, where N is the number of bytes to align to. 1628a29fa6e02c8a76a71f43fc8bf4e51dd12bac4bcChris Lattner /// Otherwise, it emits ".align log2(N)", e.g. 3 to align to an 8 byte 1638a29fa6e02c8a76a71f43fc8bf4e51dd12bac4bcChris Lattner /// boundary. 16482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner bool AlignmentIsInBytes; // Defaults to true 16582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner 16682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// TextAlignFillValue - If non-zero, this is used to fill the executable 16782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// space created as the result of a alignment directive. 16882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner unsigned TextAlignFillValue; // Defaults to 0 169eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling 17082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner //===--- Global Variable Emission Directives --------------------------===// 17182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner 17282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// GlobalDirective - This is the directive used to declare a global entity. 17382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// 17482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner const char *GlobalDirective; // Defaults to NULL. 175eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling 17682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// ExternDirective - This is the directive used to declare external 17782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// globals. 17882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// 179eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling const char *ExternDirective; // Defaults to NULL. 18082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner 18182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// HasSetDirective - True if the assembler supports the .set directive. 18282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner bool HasSetDirective; // Defaults to true. 18382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner 18482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// HasLCOMMDirective - This is true if the target supports the .lcomm 185eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling /// directive. 18682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner bool HasLCOMMDirective; // Defaults to false. 18782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner 18882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// COMMDirectiveAlignmentIsInBytes - True is COMMDirective's optional 18982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// alignment is to be specified in bytes instead of log2(n). 190eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling bool COMMDirectiveAlignmentIsInBytes; // Defaults to true; 19182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner 192cee63322eaccc2f1067bdf5eab506e440f867da1Chris Lattner /// HasDotTypeDotSizeDirective - True if the target has .type and .size 193cee63322eaccc2f1067bdf5eab506e440f867da1Chris Lattner /// directives, this is true for most ELF targets. 19482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner bool HasDotTypeDotSizeDirective; // Defaults to true. 1959eb158d5b4cd4f6fc80912e2dd77bdf13c3ca0e7Chris Lattner 1969eb158d5b4cd4f6fc80912e2dd77bdf13c3ca0e7Chris Lattner /// HasSingleParameterDotFile - True if the target has a single parameter 197cee63322eaccc2f1067bdf5eab506e440f867da1Chris Lattner /// .file directive, this is true for ELF targets. 19882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner bool HasSingleParameterDotFile; // Defaults to true. 1992e2563bf8e0f0a7f8c923000c0206855f16968b2Rafael Espindola 2002e2563bf8e0f0a7f8c923000c0206855f16968b2Rafael Espindola /// HasNoDeadStrip - True if this target supports the MachO .no_dead_strip 2012e2563bf8e0f0a7f8c923000c0206855f16968b2Rafael Espindola /// directive. 2022e2563bf8e0f0a7f8c923000c0206855f16968b2Rafael Espindola bool HasNoDeadStrip; // Defaults to false. 20382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner 20482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// WeakRefDirective - This directive, if non-null, is used to declare a 205eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling /// global as being a weak undefined symbol. 20682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner const char *WeakRefDirective; // Defaults to NULL. 20782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner 20882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// WeakDefDirective - This directive, if non-null, is used to declare a 209eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling /// global as being a weak defined symbol. 21082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner const char *WeakDefDirective; // Defaults to NULL. 2113a9be0ee36fe2143f514d28315f3dc1bda132b2eChris Lattner 2123a9be0ee36fe2143f514d28315f3dc1bda132b2eChris Lattner /// LinkOnceDirective - This directive, if non-null is used to declare a 2133a9be0ee36fe2143f514d28315f3dc1bda132b2eChris Lattner /// global as being a weak defined symbol. This is used on cygwin/mingw. 21482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner const char *LinkOnceDirective; // Defaults to NULL. 21582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner 21682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// HiddenVisibilityAttr - This attribute, if not MCSA_Invalid, is used to 217eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling /// declare a symbol as having hidden visibility. 21882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner MCSymbolAttr HiddenVisibilityAttr; // Defaults to MCSA_Hidden. 21982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner 22082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// ProtectedVisibilityAttr - This attribute, if not MCSA_Invalid, is used 221eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling /// to declare a symbol as having protected visibility. 22241eb8b47717e1fe1a6d0e99ec1b4e890091f77aaChris Lattner MCSymbolAttr ProtectedVisibilityAttr; // Defaults to MCSA_Protected 22341eb8b47717e1fe1a6d0e99ec1b4e890091f77aaChris Lattner 22441eb8b47717e1fe1a6d0e99ec1b4e890091f77aaChris Lattner //===--- Dwarf Emission Directives -----------------------------------===// 22541eb8b47717e1fe1a6d0e99ec1b4e890091f77aaChris Lattner 22682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// HasLEB128 - True if target asm supports leb128 directives. 227152a29bfa6fa505182658d046bc75626e10d67c3Chris Lattner bool HasLEB128; // Defaults to false. 228152a29bfa6fa505182658d046bc75626e10d67c3Chris Lattner 229152a29bfa6fa505182658d046bc75626e10d67c3Chris Lattner /// hasDotLocAndDotFile - True if target asm supports .loc and .file 23082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// directives for emitting debugging information. 231152a29bfa6fa505182658d046bc75626e10d67c3Chris Lattner bool HasDotLocAndDotFile; // Defaults to false. 232152a29bfa6fa505182658d046bc75626e10d67c3Chris Lattner 233152a29bfa6fa505182658d046bc75626e10d67c3Chris Lattner /// SupportsDebugInformation - True if target supports emission of debugging 23482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// information. 23582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner bool SupportsDebugInformation; // Defaults to false. 23682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner 23782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// SupportsExceptionHandling - True if target supports exception handling. 238b9e7689c89acf9324fba9242e00a9a4b8a3a83a6Bill Wendling ExceptionHandling::ExceptionsType ExceptionsType; // Defaults to None 23982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner 24082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// RequiresFrameSection - true if the Dwarf2 output needs a frame section 24182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner bool DwarfRequiresFrameSection; // Defaults to true. 242b9e7689c89acf9324fba9242e00a9a4b8a3a83a6Bill Wendling 24382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// DwarfUsesInlineInfoSection - True if DwarfDebugInlineSection is used to 24482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// encode inline subroutine information. 24582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner bool DwarfUsesInlineInfoSection; // Defaults to false. 246b9e7689c89acf9324fba9242e00a9a4b8a3a83a6Bill Wendling 24782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// DwarfSectionOffsetDirective - Special section offset directive. 248b9e7689c89acf9324fba9242e00a9a4b8a3a83a6Bill Wendling const char* DwarfSectionOffsetDirective; // Defaults to NULL 249b9e7689c89acf9324fba9242e00a9a4b8a3a83a6Bill Wendling 25082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner //===--- CBE Asm Translation Table -----------------------------------===// 25182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner 252b9e7689c89acf9324fba9242e00a9a4b8a3a83a6Bill Wendling const char *const *AsmTransCBE; // Defaults to empty 25382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner 25482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner public: 25582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner explicit MCAsmInfo(); 256b9e7689c89acf9324fba9242e00a9a4b8a3a83a6Bill Wendling virtual ~MCAsmInfo(); 25782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner 25882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner // FIXME: move these methods to DwarfPrinter when the JIT stops using them. 25982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner static unsigned getSLEB128Size(int Value); 26082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner static unsigned getULEB128Size(unsigned Value); 261ae84d5b9bafd1ba88aa12e8398e5385f229fa306Devang Patel 262ae84d5b9bafd1ba88aa12e8398e5385f229fa306Devang Patel bool hasSubsectionsViaSymbols() const { return HasSubsectionsViaSymbols; } 263ae84d5b9bafd1ba88aa12e8398e5385f229fa306Devang Patel 264ae84d5b9bafd1ba88aa12e8398e5385f229fa306Devang Patel // Data directive accessors. 265b1fcfbe89bd155fb88485b2a3a995adba3994003Devang Patel // 266b1fcfbe89bd155fb88485b2a3a995adba3994003Devang Patel const char *getData8bitsDirective(unsigned AS = 0) const { 267b1fcfbe89bd155fb88485b2a3a995adba3994003Devang Patel return AS == 0 ? Data8bitsDirective : getDataASDirective(8, AS); 268b1fcfbe89bd155fb88485b2a3a995adba3994003Devang Patel } 26982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner const char *getData16bitsDirective(unsigned AS = 0) const { 27082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner return AS == 0 ? Data16bitsDirective : getDataASDirective(16, AS); 271eb2fde2c939892f620de93f56dc21ec0c36824efBill Wendling } 27282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner const char *getData32bitsDirective(unsigned AS = 0) const { 27382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner return AS == 0 ? Data32bitsDirective : getDataASDirective(32, AS); 2748eeba35babf3114966fc4e6e8522057e46b610dbChris Lattner } 27582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner const char *getData64bitsDirective(unsigned AS = 0) const { 27682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner return AS == 0 ? Data64bitsDirective : getDataASDirective(64, AS); 277f9f93e4388962b678fd59b7af5212d4cc0d38be2Chris Lattner } 27882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner const char *getGPRel32Directive() const { return GPRel32Directive; } 27982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner 28082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner /// getNonexecutableStackSection - Targets can implement this method to 281f9f93e4388962b678fd59b7af5212d4cc0d38be2Chris Lattner /// specify a section to switch to if the translation unit doesn't have any 282f9f93e4388962b678fd59b7af5212d4cc0d38be2Chris Lattner /// trampolines that require an executable stack. 28382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner virtual const MCSection *getNonexecutableStackSection(MCContext &Ctx) const{ 28482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner return 0; 28582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner } 28682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner 28782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner bool usesSunStyleELFSectionSwitchSyntax() const { 28882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner return SunStyleELFSectionSwitchSyntax; 28982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner } 29082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner 29182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner bool usesELFSectionDirectiveForBSS() const { 29282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner return UsesELFSectionDirectiveForBSS; 29382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner } 29482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner 29582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner bool hasMicrosoftFastStdCallMangling() const { 29682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner return HasMicrosoftFastStdCallMangling; 29778f485afb723121eedf4b6907ae6eb53da8af03cChris Lattner } 29882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner 299f9f93e4388962b678fd59b7af5212d4cc0d38be2Chris Lattner // Accessors. 300f9f93e4388962b678fd59b7af5212d4cc0d38be2Chris Lattner // 301f9f93e4388962b678fd59b7af5212d4cc0d38be2Chris Lattner bool hasMachoZeroFillDirective() const { return HasMachoZeroFillDirective; } 30274aae4726a66733c5872588287535a984f9a94c7Chris Lattner bool hasStaticCtorDtorReferenceInStaticMode() const { 303f9f93e4388962b678fd59b7af5212d4cc0d38be2Chris Lattner return HasStaticCtorDtorReferenceInStaticMode; 304f9f93e4388962b678fd59b7af5212d4cc0d38be2Chris Lattner } 30582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner unsigned getMaxInstLength() const { 30682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner return MaxInstLength; 30782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner } 30882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner const char *getPCSymbol() const { 30982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner return PCSymbol; 31082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner } 31182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner char getSeparatorChar() const { 31282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner return SeparatorChar; 31382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner } 3148a29fa6e02c8a76a71f43fc8bf4e51dd12bac4bcChris Lattner unsigned getCommentColumn() const { 3158a29fa6e02c8a76a71f43fc8bf4e51dd12bac4bcChris Lattner return CommentColumn; 3168a29fa6e02c8a76a71f43fc8bf4e51dd12bac4bcChris Lattner } 3178a29fa6e02c8a76a71f43fc8bf4e51dd12bac4bcChris Lattner const char *getCommentString() const { 31882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner return CommentString; 31982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner } 320aac138e84dee1cb3ffc1035b2a1e4361fe0b4f80Chris Lattner const char *getGlobalPrefix() const { 321c1a887d76d95100e7e05aa76e077710bc4e0b1cfEric Christopher return GlobalPrefix; 32271eae713153e564ec743c5c4162ff258c255de78Chris Lattner } 32371eae713153e564ec743c5c4162ff258c255de78Chris Lattner const char *getPrivateGlobalPrefix() const { 32471eae713153e564ec743c5c4162ff258c255de78Chris Lattner return PrivateGlobalPrefix; 32582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner } 32682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner const char *getLinkerPrivateGlobalPrefix() const { 32782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner return LinkerPrivateGlobalPrefix; 32882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner } 32982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner const char *getInlineAsmStart() const { 33082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner return InlineAsmStart; 33182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner } 33282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner const char *getInlineAsmEnd() const { 33382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner return InlineAsmEnd; 33482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner } 33582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner unsigned getAssemblerDialect() const { 33682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner return AssemblerDialect; 33782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner } 33882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner bool doesAllowQuotesInName() const { 33982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner return AllowQuotesInName; 340e07b75e069969558c3fbb2f5bfb9a652f6ea1d6bChris Lattner } 341e07b75e069969558c3fbb2f5bfb9a652f6ea1d6bChris Lattner bool doesAllowNameToStartWithDigit() const { 342e07b75e069969558c3fbb2f5bfb9a652f6ea1d6bChris Lattner return AllowNameToStartWithDigit; 34382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner } 34482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner const char *getZeroDirective() const { 34582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner return ZeroDirective; 34682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner } 34782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner const char *getAsciiDirective() const { 34882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner return AsciiDirective; 34982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner } 35082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner const char *getAscizDirective() const { 35182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner return AscizDirective; 35282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner } 35382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner const char *getAlignDirective() const { 35482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner return AlignDirective; 35582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner } 35682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner bool getAlignmentIsInBytes() const { 35782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner return AlignmentIsInBytes; 35882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner } 35982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner unsigned getTextAlignFillValue() const { 36082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner return TextAlignFillValue; 36182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner } 36282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner const char *getGlobalDirective() const { 36382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner return GlobalDirective; 364c6f729ed5519cdf398ca4039dbdbea4f81433ec0Anton Korobeynikov } 365c6f729ed5519cdf398ca4039dbdbea4f81433ec0Anton Korobeynikov const char *getExternDirective() const { 366c6f729ed5519cdf398ca4039dbdbea4f81433ec0Anton Korobeynikov return ExternDirective; 367b9a01bcf486814a44098745920d43daaf9f7c260Mon P Wang } 368b9a01bcf486814a44098745920d43daaf9f7c260Mon P Wang bool hasSetDirective() const { return HasSetDirective; } 369b9a01bcf486814a44098745920d43daaf9f7c260Mon P Wang bool hasLCOMMDirective() const { return HasLCOMMDirective; } 37082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner bool hasDotTypeDotSizeDirective() const {return HasDotTypeDotSizeDirective;} 37182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner bool getCOMMDirectiveAlignmentIsInBytes() const { 37282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner return COMMDirectiveAlignmentIsInBytes; 37382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner } 37482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner bool hasSingleParameterDotFile() const { return HasSingleParameterDotFile; } 37582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner bool hasNoDeadStrip() const { return HasNoDeadStrip; } 37682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner const char *getWeakRefDirective() const { return WeakRefDirective; } 37782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner const char *getWeakDefDirective() const { return WeakDefDirective; } 37882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner const char *getLinkOnceDirective() const { return LinkOnceDirective; } 37982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner 38082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner MCSymbolAttr getHiddenVisibilityAttr() const { return HiddenVisibilityAttr;} 38182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner MCSymbolAttr getProtectedVisibilityAttr() const { 38282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner return ProtectedVisibilityAttr; 38382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner } 38482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner bool hasLEB128() const { 38582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner return HasLEB128; 38682d748d55c549dd055528ed10dbb534618ca8115Chris Lattner } 38782d748d55c549dd055528ed10dbb534618ca8115Chris Lattner bool hasDotLocAndDotFile() const { 38882d748d55c549dd055528ed10dbb534618ca8115Chris Lattner return HasDotLocAndDotFile; 38982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner } 39082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner bool doesSupportDebugInformation() const { 39182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner return SupportsDebugInformation; 39282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner } 39382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner bool doesSupportExceptionHandling() const { 394cee63322eaccc2f1067bdf5eab506e440f867da1Chris Lattner return ExceptionsType != ExceptionHandling::None; 3959eb158d5b4cd4f6fc80912e2dd77bdf13c3ca0e7Chris Lattner } 3963a9be0ee36fe2143f514d28315f3dc1bda132b2eChris Lattner ExceptionHandling::ExceptionsType getExceptionHandlingType() const { 3972e2563bf8e0f0a7f8c923000c0206855f16968b2Rafael Espindola return ExceptionsType; 3982e2563bf8e0f0a7f8c923000c0206855f16968b2Rafael Espindola } 3992e2563bf8e0f0a7f8c923000c0206855f16968b2Rafael Espindola bool doesDwarfRequireFrameSection() const { 4003a9be0ee36fe2143f514d28315f3dc1bda132b2eChris Lattner return DwarfRequiresFrameSection; 4013a9be0ee36fe2143f514d28315f3dc1bda132b2eChris Lattner } 40241eb8b47717e1fe1a6d0e99ec1b4e890091f77aaChris Lattner bool doesDwarfUsesInlineInfoSection() const { 40341eb8b47717e1fe1a6d0e99ec1b4e890091f77aaChris Lattner return DwarfUsesInlineInfoSection; 40441eb8b47717e1fe1a6d0e99ec1b4e890091f77aaChris Lattner } 405152a29bfa6fa505182658d046bc75626e10d67c3Chris Lattner const char *getDwarfSectionOffsetDirective() const { 406152a29bfa6fa505182658d046bc75626e10d67c3Chris Lattner return DwarfSectionOffsetDirective; 407152a29bfa6fa505182658d046bc75626e10d67c3Chris Lattner } 408152a29bfa6fa505182658d046bc75626e10d67c3Chris Lattner const char *const *getAsmCBE() const { 40982d748d55c549dd055528ed10dbb534618ca8115Chris Lattner return AsmTransCBE; 41082d748d55c549dd055528ed10dbb534618ca8115Chris Lattner } 41182d748d55c549dd055528ed10dbb534618ca8115Chris Lattner }; 41282d748d55c549dd055528ed10dbb534618ca8115Chris Lattner} 41382d748d55c549dd055528ed10dbb534618ca8115Chris Lattner 41482d748d55c549dd055528ed10dbb534618ca8115Chris Lattner#endif 41582d748d55c549dd055528ed10dbb534618ca8115Chris Lattner