MCAsmInfo.h revision 328066513d18acd4e44ad57172c73f1a2a026022
15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//===-- llvm/MC/MCAsmInfo.h - Asm info --------------------------*- C++ -*-===// 25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// The LLVM Compiler Infrastructure 45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// This file is distributed under the University of Illinois Open Source 65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// License. See LICENSE.TXT for details. 75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//===----------------------------------------------------------------------===// 95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// This file contains a class to be used as the basis for target specific 112a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// asm writers. This class primarily takes care of global printing constants, 12868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// which are used in very similar ways across all targets. 135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//===----------------------------------------------------------------------===// 15b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) 165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef LLVM_MC_MCASMINFO_H 175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define LLVM_MC_MCASMINFO_H 185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "llvm/MC/MCDirectives.h" 205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "llvm/MC/MCDwarf.h" 21c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)#include "llvm/MC/MachineLocation.h" 22c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)#include <cassert> 23c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)#include <vector> 24c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) 255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace llvm { 265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) class MCExpr; 275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) class MCSection; 285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) class MCStreamer; 295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) class MCSymbol; 302a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) class MCContext; 312a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 322a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) namespace ExceptionHandling { 335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) enum ExceptionsType { None, DwarfCFI, SjLj, ARM, Win64 }; 345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) } 355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 362a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) namespace LCOMM { 372a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) enum LCOMMType { NoAlignment, ByteAlignment, Log2Alignment }; 385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) } 395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /// MCAsmInfo - This class is intended to be used as a base class for asm 415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /// properties and features specific to the target. 425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) class MCAsmInfo { 435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) protected: 445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) //===------------------------------------------------------------------===// 455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Properties to be set by the target writer, used to configure asm printer. 465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // 475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /// PointerSize - Pointer size in bytes. 495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /// Default is 4. 505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) unsigned PointerSize; 515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /// CalleeSaveStackSlotSize - Size of the stack slot reserved for 535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /// callee-saved registers, in bytes. 545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /// Default is same as pointer size. 552a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) unsigned CalleeSaveStackSlotSize; 562a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 572a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) /// IsLittleEndian - True if target is little endian. 582a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) /// Default is true. 592a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) bool IsLittleEndian; 605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /// StackGrowsUp - True if target stack grow up. 625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /// Default is false. 635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool StackGrowsUp; 645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 65c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) /// HasSubsectionsViaSymbols - True if this target has the MachO 66c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) /// .subsections_via_symbols directive. 6790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) bool HasSubsectionsViaSymbols; // Default is false. 685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 6990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) /// HasMachoZeroFillDirective - True if this is a MachO target that supports 7090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) /// the macho-specific .zerofill directive for emitting BSS Symbols. 715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool HasMachoZeroFillDirective; // Default is false. 725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /// HasMachoTBSSDirective - True if this is a MachO target that supports 742a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) /// the macho-specific .tbss directive for emitting thread local BSS Symbols 752a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) bool HasMachoTBSSDirective; // Default is false. 765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 772a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) /// HasStaticCtorDtorReferenceInStaticMode - True if the compiler should 782a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) /// emit a ".reference .constructors_used" or ".reference .destructors_used" 795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /// directive after the a static ctor/dtor list. This directive is only 805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /// emitted in Static relocation model. 815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool HasStaticCtorDtorReferenceInStaticMode; // Default is false. 825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /// LinkerRequiresNonEmptyDwarfLines - True if the linker has a bug and 845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /// requires that the debug_line section be of a minimum size. In practice 855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /// such a linker requires a non empty line sequence if a file is present. 865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool LinkerRequiresNonEmptyDwarfLines; // Default to false. 875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /// MaxInstLength - This is the maximum possible length of an instruction, 895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /// which is needed to compute the size of an inline asm. 905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) unsigned MaxInstLength; // Defaults to 4. 915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /// MinInstAlignment - Every possible instruction length is a multiple of 935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /// this value. Factored out in .debug_frame and .debug_line. 945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) unsigned MinInstAlignment; // Defaults to 1. 955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /// DollarIsPC - The '$' token, when not referencing an identifier or 975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /// constant, refers to the current PC. 98c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) bool DollarIsPC; // Defaults to false. 99c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) 100c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) /// SeparatorString - This string, if specified, is used to separate 1015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /// instructions from each other when on the same line. 1025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const char *SeparatorString; // Defaults to ';' 1035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 104c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) /// CommentColumn - This indicates the comment num (zero-based) at 105c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) /// which asm comments should be printed. 106c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) unsigned CommentColumn; // Defaults to 40 107c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) 108c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) /// CommentString - This indicates the comment character used by the 1095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /// assembler. 1105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const char *CommentString; // Defaults to "#" 1115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /// LabelSuffix - This is appended to emitted labels. 1135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const char *LabelSuffix; // Defaults to ":" 1145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1152a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) /// LabelSuffix - This is appended to emitted labels. 1162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const char *DebugLabelSuffix; // Defaults to ":" 1175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1182a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) /// GlobalPrefix - If this is set to a non-empty string, it is prepended 1192a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) /// onto all global symbols. This is often used for "_" or ".". 1202a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const char *GlobalPrefix; // Defaults to "" 1215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /// PrivateGlobalPrefix - This prefix is used for globals like constant 1235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /// pool entries that are completely private to the .s file and should not 1245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /// have names in the .o file. This is often "." or "L". 1255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const char *PrivateGlobalPrefix; // Defaults to "." 1262a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /// LinkerPrivateGlobalPrefix - This prefix is used for symbols that should 1285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /// be passed through the assembler but be removed by the linker. This 1295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /// is "l" on Darwin, currently used for some ObjC metadata. 1305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const char *LinkerPrivateGlobalPrefix; // Defaults to "" 1315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /// InlineAsmStart/End - If these are nonempty, they contain a directive to 1332a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) /// emit before and after an inline assembly statement. 13490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) const char *InlineAsmStart; // Defaults to "#APP\n" 1355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const char *InlineAsmEnd; // Defaults to "#NO_APP\n" 1365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /// Code16Directive, Code32Directive, Code64Directive - These are assembly 1385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /// directives that tells the assembler to interpret the following 1392a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) /// instructions differently. 1405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const char *Code16Directive; // Defaults to ".code16" 1415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const char *Code32Directive; // Defaults to ".code32" 1425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const char *Code64Directive; // Defaults to ".code64" 1435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) /// AssemblerDialect - Which dialect of an assembler variant to use. 1455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) unsigned AssemblerDialect; // Defaults to 0 146 147 /// AllowQuotesInName - This is true if the assembler allows for complex 148 /// symbol names to be surrounded in quotes. This defaults to false. 149 bool AllowQuotesInName; 150 151 /// AllowNameToStartWithDigit - This is true if the assembler allows symbol 152 /// names to start with a digit (e.g., "0x0021"). This defaults to false. 153 bool AllowNameToStartWithDigit; 154 155 /// AllowPeriodsInName - This is true if the assembler allows periods in 156 /// symbol names. This defaults to true. 157 bool AllowPeriodsInName; 158 159 /// \brief This is true if the assembler allows @ characters in symbol 160 /// names. Defaults to false. 161 bool AllowAtInName; 162 163 /// UseDataRegionDirectives - This is true if data region markers should 164 /// be printed as ".data_region/.end_data_region" directives. If false, 165 /// use "$d/$a" labels instead. 166 bool UseDataRegionDirectives; 167 168 //===--- Data Emission Directives -------------------------------------===// 169 170 /// ZeroDirective - this should be set to the directive used to get some 171 /// number of zero bytes emitted to the current section. Common cases are 172 /// "\t.zero\t" and "\t.space\t". If this is set to null, the 173 /// Data*bitsDirective's will be used to emit zero bytes. 174 const char *ZeroDirective; // Defaults to "\t.zero\t" 175 176 /// AsciiDirective - This directive allows emission of an ascii string with 177 /// the standard C escape characters embedded into it. 178 const char *AsciiDirective; // Defaults to "\t.ascii\t" 179 180 /// AscizDirective - If not null, this allows for special handling of 181 /// zero terminated strings on this target. This is commonly supported as 182 /// ".asciz". If a target doesn't support this, it can be set to null. 183 const char *AscizDirective; // Defaults to "\t.asciz\t" 184 185 /// DataDirectives - These directives are used to output some unit of 186 /// integer data to the current section. If a data directive is set to 187 /// null, smaller data directives will be used to emit the large sizes. 188 const char *Data8bitsDirective; // Defaults to "\t.byte\t" 189 const char *Data16bitsDirective; // Defaults to "\t.short\t" 190 const char *Data32bitsDirective; // Defaults to "\t.long\t" 191 const char *Data64bitsDirective; // Defaults to "\t.quad\t" 192 193 /// GPRel64Directive - if non-null, a directive that is used to emit a word 194 /// which should be relocated as a 64-bit GP-relative offset, e.g. .gpdword 195 /// on Mips. 196 const char *GPRel64Directive; // Defaults to NULL. 197 198 /// GPRel32Directive - if non-null, a directive that is used to emit a word 199 /// which should be relocated as a 32-bit GP-relative offset, e.g. .gpword 200 /// on Mips or .gprel32 on Alpha. 201 const char *GPRel32Directive; // Defaults to NULL. 202 203 /// SunStyleELFSectionSwitchSyntax - This is true if this target uses "Sun 204 /// Style" syntax for section switching ("#alloc,#write" etc) instead of the 205 /// normal ELF syntax (,"a,w") in .section directives. 206 bool SunStyleELFSectionSwitchSyntax; // Defaults to false. 207 208 /// UsesELFSectionDirectiveForBSS - This is true if this target uses ELF 209 /// '.section' directive before the '.bss' one. It's used for PPC/Linux 210 /// which doesn't support the '.bss' directive only. 211 bool UsesELFSectionDirectiveForBSS; // Defaults to false. 212 213 /// HasMicrosoftFastStdCallMangling - True if this target uses microsoft 214 /// style mangling for functions with X86_StdCall/X86_FastCall calling 215 /// convention. 216 bool HasMicrosoftFastStdCallMangling; // Defaults to false. 217 218 bool NeedsDwarfSectionOffsetDirective; 219 220 //===--- Alignment Information ----------------------------------------===// 221 222 /// AlignDirective - The directive used to emit round up to an alignment 223 /// boundary. 224 /// 225 const char *AlignDirective; // Defaults to "\t.align\t" 226 227 /// AlignmentIsInBytes - If this is true (the default) then the asmprinter 228 /// emits ".align N" directives, where N is the number of bytes to align to. 229 /// Otherwise, it emits ".align log2(N)", e.g. 3 to align to an 8 byte 230 /// boundary. 231 bool AlignmentIsInBytes; // Defaults to true 232 233 /// TextAlignFillValue - If non-zero, this is used to fill the executable 234 /// space created as the result of a alignment directive. 235 unsigned TextAlignFillValue; // Defaults to 0 236 237 //===--- Global Variable Emission Directives --------------------------===// 238 239 /// GlobalDirective - This is the directive used to declare a global entity. 240 /// 241 const char *GlobalDirective; // Defaults to NULL. 242 243 /// HasSetDirective - True if the assembler supports the .set directive. 244 bool HasSetDirective; // Defaults to true. 245 246 /// HasAggressiveSymbolFolding - False if the assembler requires that we use 247 /// Lc = a - b 248 /// .long Lc 249 /// instead of 250 /// .long a - b 251 bool HasAggressiveSymbolFolding; // Defaults to true. 252 253 /// COMMDirectiveAlignmentIsInBytes - True is .comm's and .lcomms optional 254 /// alignment is to be specified in bytes instead of log2(n). 255 bool COMMDirectiveAlignmentIsInBytes; // Defaults to true; 256 257 /// LCOMMDirectiveAlignment - Describes if the .lcomm directive for the 258 /// target supports an alignment argument and how it is interpreted. 259 LCOMM::LCOMMType LCOMMDirectiveAlignmentType; // Defaults to NoAlignment. 260 261 /// HasDotTypeDotSizeDirective - True if the target has .type and .size 262 /// directives, this is true for most ELF targets. 263 bool HasDotTypeDotSizeDirective; // Defaults to true. 264 265 /// HasSingleParameterDotFile - True if the target has a single parameter 266 /// .file directive, this is true for ELF targets. 267 bool HasSingleParameterDotFile; // Defaults to true. 268 269 /// hasIdentDirective - True if the target has a .ident directive, this is 270 /// true for ELF targets. 271 bool HasIdentDirective; // Defaults to false. 272 273 /// HasNoDeadStrip - True if this target supports the MachO .no_dead_strip 274 /// directive. 275 bool HasNoDeadStrip; // Defaults to false. 276 277 /// WeakRefDirective - This directive, if non-null, is used to declare a 278 /// global as being a weak undefined symbol. 279 const char *WeakRefDirective; // Defaults to NULL. 280 281 /// WeakDefDirective - This directive, if non-null, is used to declare a 282 /// global as being a weak defined symbol. 283 const char *WeakDefDirective; // Defaults to NULL. 284 285 /// LinkOnceDirective - This directive, if non-null is used to declare a 286 /// global as being a weak defined symbol. This is used on cygwin/mingw. 287 const char *LinkOnceDirective; // Defaults to NULL. 288 289 /// HiddenVisibilityAttr - This attribute, if not MCSA_Invalid, is used to 290 /// declare a symbol as having hidden visibility. 291 MCSymbolAttr HiddenVisibilityAttr; // Defaults to MCSA_Hidden. 292 293 /// HiddenDeclarationVisibilityAttr - This attribute, if not MCSA_Invalid, 294 /// is used to declare an undefined symbol as having hidden visibility. 295 MCSymbolAttr HiddenDeclarationVisibilityAttr; // Defaults to MCSA_Hidden. 296 297 298 /// ProtectedVisibilityAttr - This attribute, if not MCSA_Invalid, is used 299 /// to declare a symbol as having protected visibility. 300 MCSymbolAttr ProtectedVisibilityAttr; // Defaults to MCSA_Protected 301 302 //===--- Dwarf Emission Directives -----------------------------------===// 303 304 /// HasLEB128 - True if target asm supports leb128 directives. 305 bool HasLEB128; // Defaults to false. 306 307 /// SupportsDebugInformation - True if target supports emission of debugging 308 /// information. 309 bool SupportsDebugInformation; // Defaults to false. 310 311 /// SupportsExceptionHandling - True if target supports exception handling. 312 ExceptionHandling::ExceptionsType ExceptionsType; // Defaults to None 313 314 /// DwarfUsesRelocationsAcrossSections - True if Dwarf2 output generally 315 /// uses relocations for references to other .debug_* sections. 316 bool DwarfUsesRelocationsAcrossSections; 317 318 /// DwarfRegNumForCFI - True if dwarf register numbers are printed 319 /// instead of symbolic register names in .cfi_* directives. 320 bool DwarfRegNumForCFI; // Defaults to false; 321 322 //===--- Prologue State ----------------------------------------------===// 323 324 std::vector<MCCFIInstruction> InitialFrameState; 325 326 public: 327 explicit MCAsmInfo(); 328 virtual ~MCAsmInfo(); 329 330 // FIXME: move these methods to DwarfPrinter when the JIT stops using them. 331 static unsigned getSLEB128Size(int64_t Value); 332 static unsigned getULEB128Size(uint64_t Value); 333 334 /// getPointerSize - Get the pointer size in bytes. 335 unsigned getPointerSize() const { 336 return PointerSize; 337 } 338 339 /// getCalleeSaveStackSlotSize - Get the callee-saved register stack slot 340 /// size in bytes. 341 unsigned getCalleeSaveStackSlotSize() const { 342 return CalleeSaveStackSlotSize; 343 } 344 345 /// isLittleEndian - True if the target is little endian. 346 bool isLittleEndian() const { 347 return IsLittleEndian; 348 } 349 350 /// isStackGrowthDirectionUp - True if target stack grow up. 351 bool isStackGrowthDirectionUp() const { 352 return StackGrowsUp; 353 } 354 355 bool hasSubsectionsViaSymbols() const { return HasSubsectionsViaSymbols; } 356 357 // Data directive accessors. 358 // 359 const char *getData8bitsDirective() const { 360 return Data8bitsDirective; 361 } 362 const char *getData16bitsDirective() const { 363 return Data16bitsDirective; 364 } 365 const char *getData32bitsDirective() const { 366 return Data32bitsDirective; 367 } 368 const char *getData64bitsDirective() const { 369 return Data64bitsDirective; 370 } 371 const char *getGPRel64Directive() const { return GPRel64Directive; } 372 const char *getGPRel32Directive() const { return GPRel32Directive; } 373 374 /// getNonexecutableStackSection - Targets can implement this method to 375 /// specify a section to switch to if the translation unit doesn't have any 376 /// trampolines that require an executable stack. 377 virtual const MCSection *getNonexecutableStackSection(MCContext &Ctx) const{ 378 return 0; 379 } 380 381 virtual const MCExpr * 382 getExprForPersonalitySymbol(const MCSymbol *Sym, 383 unsigned Encoding, 384 MCStreamer &Streamer) const; 385 386 const MCExpr * 387 getExprForFDESymbol(const MCSymbol *Sym, 388 unsigned Encoding, 389 MCStreamer &Streamer) const; 390 391 bool usesSunStyleELFSectionSwitchSyntax() const { 392 return SunStyleELFSectionSwitchSyntax; 393 } 394 395 bool usesELFSectionDirectiveForBSS() const { 396 return UsesELFSectionDirectiveForBSS; 397 } 398 399 bool hasMicrosoftFastStdCallMangling() const { 400 return HasMicrosoftFastStdCallMangling; 401 } 402 403 bool needsDwarfSectionOffsetDirective() const { 404 return NeedsDwarfSectionOffsetDirective; 405 } 406 407 // Accessors. 408 // 409 bool hasMachoZeroFillDirective() const { return HasMachoZeroFillDirective; } 410 bool hasMachoTBSSDirective() const { return HasMachoTBSSDirective; } 411 bool hasStaticCtorDtorReferenceInStaticMode() const { 412 return HasStaticCtorDtorReferenceInStaticMode; 413 } 414 bool getLinkerRequiresNonEmptyDwarfLines() const { 415 return LinkerRequiresNonEmptyDwarfLines; 416 } 417 unsigned getMaxInstLength() const { 418 return MaxInstLength; 419 } 420 unsigned getMinInstAlignment() const { 421 return MinInstAlignment; 422 } 423 bool getDollarIsPC() const { 424 return DollarIsPC; 425 } 426 const char *getSeparatorString() const { 427 return SeparatorString; 428 } 429 unsigned getCommentColumn() const { 430 return CommentColumn; 431 } 432 const char *getCommentString() const { 433 return CommentString; 434 } 435 const char *getLabelSuffix() const { 436 return LabelSuffix; 437 } 438 439 const char *getDebugLabelSuffix() const { 440 return DebugLabelSuffix; 441 } 442 443 const char *getGlobalPrefix() const { 444 return GlobalPrefix; 445 } 446 const char *getPrivateGlobalPrefix() const { 447 return PrivateGlobalPrefix; 448 } 449 const char *getLinkerPrivateGlobalPrefix() const { 450 return LinkerPrivateGlobalPrefix; 451 } 452 const char *getInlineAsmStart() const { 453 return InlineAsmStart; 454 } 455 const char *getInlineAsmEnd() const { 456 return InlineAsmEnd; 457 } 458 const char *getCode16Directive() const { 459 return Code16Directive; 460 } 461 const char *getCode32Directive() const { 462 return Code32Directive; 463 } 464 const char *getCode64Directive() const { 465 return Code64Directive; 466 } 467 unsigned getAssemblerDialect() const { 468 return AssemblerDialect; 469 } 470 bool doesAllowQuotesInName() const { 471 return AllowQuotesInName; 472 } 473 bool doesAllowNameToStartWithDigit() const { 474 return AllowNameToStartWithDigit; 475 } 476 bool doesAllowPeriodsInName() const { 477 return AllowPeriodsInName; 478 } 479 bool doesAllowAtInName() const { 480 return AllowAtInName; 481 } 482 bool doesSupportDataRegionDirectives() const { 483 return UseDataRegionDirectives; 484 } 485 const char *getZeroDirective() const { 486 return ZeroDirective; 487 } 488 const char *getAsciiDirective() const { 489 return AsciiDirective; 490 } 491 const char *getAscizDirective() const { 492 return AscizDirective; 493 } 494 const char *getAlignDirective() const { 495 return AlignDirective; 496 } 497 bool getAlignmentIsInBytes() const { 498 return AlignmentIsInBytes; 499 } 500 unsigned getTextAlignFillValue() const { 501 return TextAlignFillValue; 502 } 503 const char *getGlobalDirective() const { 504 return GlobalDirective; 505 } 506 bool hasSetDirective() const { return HasSetDirective; } 507 bool hasAggressiveSymbolFolding() const { 508 return HasAggressiveSymbolFolding; 509 } 510 bool getCOMMDirectiveAlignmentIsInBytes() const { 511 return COMMDirectiveAlignmentIsInBytes; 512 } 513 LCOMM::LCOMMType getLCOMMDirectiveAlignmentType() const { 514 return LCOMMDirectiveAlignmentType; 515 } 516 bool hasDotTypeDotSizeDirective() const {return HasDotTypeDotSizeDirective;} 517 bool hasSingleParameterDotFile() const { return HasSingleParameterDotFile; } 518 bool hasIdentDirective() const { return HasIdentDirective; } 519 bool hasNoDeadStrip() const { return HasNoDeadStrip; } 520 const char *getWeakRefDirective() const { return WeakRefDirective; } 521 const char *getWeakDefDirective() const { return WeakDefDirective; } 522 const char *getLinkOnceDirective() const { return LinkOnceDirective; } 523 524 MCSymbolAttr getHiddenVisibilityAttr() const { return HiddenVisibilityAttr;} 525 MCSymbolAttr getHiddenDeclarationVisibilityAttr() const { 526 return HiddenDeclarationVisibilityAttr; 527 } 528 MCSymbolAttr getProtectedVisibilityAttr() const { 529 return ProtectedVisibilityAttr; 530 } 531 bool hasLEB128() const { 532 return HasLEB128; 533 } 534 bool doesSupportDebugInformation() const { 535 return SupportsDebugInformation; 536 } 537 bool doesSupportExceptionHandling() const { 538 return ExceptionsType != ExceptionHandling::None; 539 } 540 ExceptionHandling::ExceptionsType getExceptionHandlingType() const { 541 return ExceptionsType; 542 } 543 bool isExceptionHandlingDwarf() const { 544 return 545 (ExceptionsType == ExceptionHandling::DwarfCFI || 546 ExceptionsType == ExceptionHandling::ARM || 547 ExceptionsType == ExceptionHandling::Win64); 548 } 549 bool doesDwarfUseRelocationsAcrossSections() const { 550 return DwarfUsesRelocationsAcrossSections; 551 } 552 bool useDwarfRegNumForCFI() const { 553 return DwarfRegNumForCFI; 554 } 555 556 void addInitialFrameState(const MCCFIInstruction &Inst) { 557 InitialFrameState.push_back(Inst); 558 } 559 560 const std::vector<MCCFIInstruction> &getInitialFrameState() const { 561 return InitialFrameState; 562 } 563 }; 564} 565 566#endif 567