Jim Laskey | 8e8de8f | 2006-09-07 22:05:02 +0000 | [diff] [blame] | 1 | //===-- X86TargetAsmInfo.cpp - X86 asm properties ---------------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | 4ee451d | 2007-12-29 20:36:04 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Jim Laskey | 8e8de8f | 2006-09-07 22:05:02 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file contains the declarations of the X86TargetAsmInfo properties. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #include "X86TargetAsmInfo.h" |
| 15 | #include "X86TargetMachine.h" |
| 16 | #include "X86Subtarget.h" |
Reid Spencer | 7aa8a45 | 2007-01-12 23:22:14 +0000 | [diff] [blame] | 17 | #include "llvm/DerivedTypes.h" |
Chris Lattner | 625bd05 | 2006-11-29 01:14:06 +0000 | [diff] [blame] | 18 | #include "llvm/InlineAsm.h" |
| 19 | #include "llvm/Instructions.h" |
Chris Lattner | 3e9f1d0 | 2007-04-01 20:49:36 +0000 | [diff] [blame] | 20 | #include "llvm/Intrinsics.h" |
Chris Lattner | 625bd05 | 2006-11-29 01:14:06 +0000 | [diff] [blame] | 21 | #include "llvm/Module.h" |
| 22 | #include "llvm/ADT/StringExtras.h" |
Anton Korobeynikov | cee750f | 2008-02-27 23:33:50 +0000 | [diff] [blame] | 23 | #include "llvm/Support/Dwarf.h" |
Torok Edwin | c25e758 | 2009-07-11 20:10:48 +0000 | [diff] [blame] | 24 | #include "llvm/Support/ErrorHandling.h" |
Anton Korobeynikov | cee750f | 2008-02-27 23:33:50 +0000 | [diff] [blame] | 25 | |
Jim Laskey | 8e8de8f | 2006-09-07 22:05:02 +0000 | [diff] [blame] | 26 | using namespace llvm; |
Anton Korobeynikov | cee750f | 2008-02-27 23:33:50 +0000 | [diff] [blame] | 27 | using namespace llvm::dwarf; |
Jim Laskey | 8e8de8f | 2006-09-07 22:05:02 +0000 | [diff] [blame] | 28 | |
Anton Korobeynikov | 32b952a | 2008-09-25 21:00:33 +0000 | [diff] [blame] | 29 | const char *const llvm::x86_asm_table[] = { |
| 30 | "{si}", "S", |
| 31 | "{di}", "D", |
| 32 | "{ax}", "a", |
| 33 | "{cx}", "c", |
| 34 | "{memory}", "memory", |
| 35 | "{flags}", "", |
| 36 | "{dirflag}", "", |
| 37 | "{fpsr}", "", |
| 38 | "{cc}", "cc", |
| 39 | 0,0}; |
Andrew Lenharth | 6c0695f | 2006-11-28 19:52:49 +0000 | [diff] [blame] | 40 | |
Anton Korobeynikov | 4468b7a | 2008-07-09 13:20:48 +0000 | [diff] [blame] | 41 | X86DarwinTargetAsmInfo::X86DarwinTargetAsmInfo(const X86TargetMachine &TM): |
Anton Korobeynikov | 32b952a | 2008-09-25 21:00:33 +0000 | [diff] [blame] | 42 | X86TargetAsmInfo<DarwinTargetAsmInfo>(TM) { |
Bill Wendling | b6be139 | 2009-07-13 18:48:39 +0000 | [diff] [blame] | 43 | const X86Subtarget *Subtarget = &TM.getSubtarget<X86Subtarget>(); |
Anton Korobeynikov | 16b7f51 | 2008-08-08 18:25:52 +0000 | [diff] [blame] | 44 | bool is64Bit = Subtarget->is64Bit(); |
Anton Korobeynikov | 4468b7a | 2008-07-09 13:20:48 +0000 | [diff] [blame] | 45 | |
| 46 | AlignmentIsInBytes = false; |
| 47 | TextAlignFillValue = 0x90; |
Daniel Dunbar | f6ccee5 | 2009-07-24 08:24:36 +0000 | [diff] [blame^] | 48 | |
| 49 | |
Anton Korobeynikov | 4468b7a | 2008-07-09 13:20:48 +0000 | [diff] [blame] | 50 | if (!is64Bit) |
| 51 | Data64bitsDirective = 0; // we can't emit a 64-bit unit |
| 52 | ZeroDirective = "\t.space\t"; // ".space N" emits N zeros. |
Anton Korobeynikov | 4468b7a | 2008-07-09 13:20:48 +0000 | [diff] [blame] | 53 | ZeroFillDirective = "\t.zerofill\t"; // Uses .zerofill |
Dan Gohman | 8f09225 | 2008-11-03 18:22:42 +0000 | [diff] [blame] | 54 | if (TM.getRelocationModel() != Reloc::Static) |
Anton Korobeynikov | 7705ea3 | 2008-07-09 21:54:26 +0000 | [diff] [blame] | 55 | ConstantPoolSection = "\t.const_data"; |
| 56 | else |
| 57 | ConstantPoolSection = "\t.const\n"; |
Chris Lattner | 4e0f25b | 2009-06-19 00:08:39 +0000 | [diff] [blame] | 58 | // FIXME: Why don't we always use this section? |
| 59 | if (is64Bit) |
Anton Korobeynikov | 6481873 | 2008-09-24 22:18:54 +0000 | [diff] [blame] | 60 | SixteenByteConstantSection = getUnnamedSection("\t.literal16\n", |
| 61 | SectionFlags::Mergeable); |
Anton Korobeynikov | 4468b7a | 2008-07-09 13:20:48 +0000 | [diff] [blame] | 62 | LCOMMDirective = "\t.lcomm\t"; |
Bill Wendling | b6be139 | 2009-07-13 18:48:39 +0000 | [diff] [blame] | 63 | |
Anton Korobeynikov | 16b7f51 | 2008-08-08 18:25:52 +0000 | [diff] [blame] | 64 | // Leopard and above support aligned common symbols. |
| 65 | COMMDirectiveTakesAlignment = (Subtarget->getDarwinVers() >= 9); |
Anton Korobeynikov | 4468b7a | 2008-07-09 13:20:48 +0000 | [diff] [blame] | 66 | HasDotTypeDotSizeDirective = false; |
Daniel Dunbar | f6ccee5 | 2009-07-24 08:24:36 +0000 | [diff] [blame^] | 67 | |
Anton Korobeynikov | 4468b7a | 2008-07-09 13:20:48 +0000 | [diff] [blame] | 68 | if (is64Bit) { |
| 69 | PersonalityPrefix = ""; |
| 70 | PersonalitySuffix = "+4@GOTPCREL"; |
| 71 | } else { |
| 72 | PersonalityPrefix = "L"; |
| 73 | PersonalitySuffix = "$non_lazy_ptr"; |
| 74 | } |
Bill Wendling | b6be139 | 2009-07-13 18:48:39 +0000 | [diff] [blame] | 75 | |
Anton Korobeynikov | 4468b7a | 2008-07-09 13:20:48 +0000 | [diff] [blame] | 76 | InlineAsmStart = "## InlineAsm Start"; |
| 77 | InlineAsmEnd = "## InlineAsm End"; |
| 78 | CommentString = "##"; |
| 79 | SetDirective = "\t.set"; |
| 80 | PCSymbol = "."; |
| 81 | UsedDirective = "\t.no_dead_strip\t"; |
Anton Korobeynikov | 4468b7a | 2008-07-09 13:20:48 +0000 | [diff] [blame] | 82 | ProtectedDirective = "\t.globl\t"; |
| 83 | |
Anton Korobeynikov | 4468b7a | 2008-07-09 13:20:48 +0000 | [diff] [blame] | 84 | SupportsDebugInformation = true; |
Devang Patel | 0f7fef3 | 2009-04-13 17:02:03 +0000 | [diff] [blame] | 85 | DwarfDebugInlineSection = ".section __DWARF,__debug_inlined,regular,debug"; |
| 86 | DwarfUsesInlineInfoSection = true; |
Anton Korobeynikov | 4468b7a | 2008-07-09 13:20:48 +0000 | [diff] [blame] | 87 | |
| 88 | // Exceptions handling |
| 89 | SupportsExceptionHandling = true; |
| 90 | GlobalEHDirective = "\t.globl\t"; |
| 91 | SupportsWeakOmittedEHFrame = false; |
| 92 | AbsoluteEHSectionOffsets = false; |
| 93 | DwarfEHFrameSection = |
| 94 | ".section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support"; |
Bill Wendling | db42549 | 2009-07-13 20:27:41 +0000 | [diff] [blame] | 95 | DwarfExceptionSection = ".section __DATA,__gcc_except_tab"; |
Anton Korobeynikov | 4468b7a | 2008-07-09 13:20:48 +0000 | [diff] [blame] | 96 | } |
| 97 | |
Anton Korobeynikov | b9e58ef | 2008-07-09 13:21:08 +0000 | [diff] [blame] | 98 | unsigned |
| 99 | X86DarwinTargetAsmInfo::PreferredEHDataFormat(DwarfEncoding::Target Reason, |
| 100 | bool Global) const { |
| 101 | if (Reason == DwarfEncoding::Functions && Global) |
| 102 | return (DW_EH_PE_pcrel | DW_EH_PE_indirect | DW_EH_PE_sdata4); |
| 103 | else if (Reason == DwarfEncoding::CodeLabels || !Global) |
| 104 | return DW_EH_PE_pcrel; |
| 105 | else |
| 106 | return DW_EH_PE_absptr; |
| 107 | } |
| 108 | |
Rafael Espindola | 2f6fea9 | 2008-12-19 10:55:56 +0000 | [diff] [blame] | 109 | const char * |
| 110 | X86DarwinTargetAsmInfo::getEHGlobalPrefix() const |
| 111 | { |
| 112 | const X86Subtarget* Subtarget = &TM.getSubtarget<X86Subtarget>(); |
| 113 | if (Subtarget->getDarwinVers() > 9) |
| 114 | return PrivateGlobalPrefix; |
| 115 | else |
| 116 | return ""; |
| 117 | } |
| 118 | |
Anton Korobeynikov | 4468b7a | 2008-07-09 13:20:48 +0000 | [diff] [blame] | 119 | X86ELFTargetAsmInfo::X86ELFTargetAsmInfo(const X86TargetMachine &TM): |
Anton Korobeynikov | 32b952a | 2008-09-25 21:00:33 +0000 | [diff] [blame] | 120 | X86TargetAsmInfo<ELFTargetAsmInfo>(TM) { |
Anton Korobeynikov | 0d44ba8 | 2008-07-09 13:28:49 +0000 | [diff] [blame] | 121 | |
Anton Korobeynikov | b20015b | 2008-07-09 13:25:26 +0000 | [diff] [blame] | 122 | CStringSection = ".rodata.str"; |
Anton Korobeynikov | 4468b7a | 2008-07-09 13:20:48 +0000 | [diff] [blame] | 123 | PrivateGlobalPrefix = ".L"; |
| 124 | WeakRefDirective = "\t.weak\t"; |
| 125 | SetDirective = "\t.set\t"; |
| 126 | PCSymbol = "."; |
| 127 | |
| 128 | // Set up DWARF directives |
| 129 | HasLEB128 = true; // Target asm supports leb128 directives (little-endian) |
| 130 | |
| 131 | // Debug Information |
| 132 | AbsoluteDebugSectionOffsets = true; |
| 133 | SupportsDebugInformation = true; |
| 134 | DwarfAbbrevSection = "\t.section\t.debug_abbrev,\"\",@progbits"; |
| 135 | DwarfInfoSection = "\t.section\t.debug_info,\"\",@progbits"; |
| 136 | DwarfLineSection = "\t.section\t.debug_line,\"\",@progbits"; |
| 137 | DwarfFrameSection = "\t.section\t.debug_frame,\"\",@progbits"; |
| 138 | DwarfPubNamesSection ="\t.section\t.debug_pubnames,\"\",@progbits"; |
| 139 | DwarfPubTypesSection ="\t.section\t.debug_pubtypes,\"\",@progbits"; |
| 140 | DwarfStrSection = "\t.section\t.debug_str,\"\",@progbits"; |
| 141 | DwarfLocSection = "\t.section\t.debug_loc,\"\",@progbits"; |
| 142 | DwarfARangesSection = "\t.section\t.debug_aranges,\"\",@progbits"; |
| 143 | DwarfRangesSection = "\t.section\t.debug_ranges,\"\",@progbits"; |
Chris Lattner | b839c3f | 2009-06-18 23:31:37 +0000 | [diff] [blame] | 144 | DwarfMacroInfoSection = "\t.section\t.debug_macinfo,\"\",@progbits"; |
Anton Korobeynikov | 4468b7a | 2008-07-09 13:20:48 +0000 | [diff] [blame] | 145 | |
| 146 | // Exceptions handling |
Anton Korobeynikov | c4da15a | 2008-09-08 21:13:08 +0000 | [diff] [blame] | 147 | SupportsExceptionHandling = true; |
Anton Korobeynikov | 4468b7a | 2008-07-09 13:20:48 +0000 | [diff] [blame] | 148 | AbsoluteEHSectionOffsets = false; |
| 149 | DwarfEHFrameSection = "\t.section\t.eh_frame,\"aw\",@progbits"; |
| 150 | DwarfExceptionSection = "\t.section\t.gcc_except_table,\"a\",@progbits"; |
| 151 | |
| 152 | // On Linux we must declare when we can use a non-executable stack. |
Dan Gohman | 8f09225 | 2008-11-03 18:22:42 +0000 | [diff] [blame] | 153 | if (TM.getSubtarget<X86Subtarget>().isLinux()) |
Anton Korobeynikov | 4468b7a | 2008-07-09 13:20:48 +0000 | [diff] [blame] | 154 | NonexecutableStackDirective = "\t.section\t.note.GNU-stack,\"\",@progbits"; |
| 155 | } |
| 156 | |
Anton Korobeynikov | b9e58ef | 2008-07-09 13:21:08 +0000 | [diff] [blame] | 157 | unsigned |
| 158 | X86ELFTargetAsmInfo::PreferredEHDataFormat(DwarfEncoding::Target Reason, |
| 159 | bool Global) const { |
Dan Gohman | 8f09225 | 2008-11-03 18:22:42 +0000 | [diff] [blame] | 160 | CodeModel::Model CM = TM.getCodeModel(); |
| 161 | bool is64Bit = TM.getSubtarget<X86Subtarget>().is64Bit(); |
Anton Korobeynikov | b9e58ef | 2008-07-09 13:21:08 +0000 | [diff] [blame] | 162 | |
Dan Gohman | 8f09225 | 2008-11-03 18:22:42 +0000 | [diff] [blame] | 163 | if (TM.getRelocationModel() == Reloc::PIC_) { |
Anton Korobeynikov | b9e58ef | 2008-07-09 13:21:08 +0000 | [diff] [blame] | 164 | unsigned Format = 0; |
| 165 | |
| 166 | if (!is64Bit) |
| 167 | // 32 bit targets always encode pointers as 4 bytes |
| 168 | Format = DW_EH_PE_sdata4; |
| 169 | else { |
| 170 | // 64 bit targets encode pointers in 4 bytes iff: |
| 171 | // - code model is small OR |
| 172 | // - code model is medium and we're emitting externally visible symbols |
| 173 | // or any code symbols |
| 174 | if (CM == CodeModel::Small || |
| 175 | (CM == CodeModel::Medium && (Global || |
| 176 | Reason != DwarfEncoding::Data))) |
| 177 | Format = DW_EH_PE_sdata4; |
| 178 | else |
| 179 | Format = DW_EH_PE_sdata8; |
| 180 | } |
| 181 | |
| 182 | if (Global) |
| 183 | Format |= DW_EH_PE_indirect; |
| 184 | |
| 185 | return (Format | DW_EH_PE_pcrel); |
| 186 | } else { |
| 187 | if (is64Bit && |
| 188 | (CM == CodeModel::Small || |
| 189 | (CM == CodeModel::Medium && Reason != DwarfEncoding::Data))) |
| 190 | return DW_EH_PE_udata4; |
| 191 | else |
| 192 | return DW_EH_PE_absptr; |
| 193 | } |
| 194 | } |
| 195 | |
Anton Korobeynikov | 4468b7a | 2008-07-09 13:20:48 +0000 | [diff] [blame] | 196 | X86COFFTargetAsmInfo::X86COFFTargetAsmInfo(const X86TargetMachine &TM): |
Anton Korobeynikov | 32b952a | 2008-09-25 21:00:33 +0000 | [diff] [blame] | 197 | X86GenericTargetAsmInfo(TM) { |
Anton Korobeynikov | 18f6ed9 | 2008-07-19 13:15:21 +0000 | [diff] [blame] | 198 | |
Anton Korobeynikov | 4468b7a | 2008-07-09 13:20:48 +0000 | [diff] [blame] | 199 | GlobalPrefix = "_"; |
| 200 | LCOMMDirective = "\t.lcomm\t"; |
| 201 | COMMDirectiveTakesAlignment = false; |
| 202 | HasDotTypeDotSizeDirective = false; |
Rafael Espindola | 952b839 | 2008-12-03 11:01:37 +0000 | [diff] [blame] | 203 | HasSingleParameterDotFile = false; |
Anton Korobeynikov | 4468b7a | 2008-07-09 13:20:48 +0000 | [diff] [blame] | 204 | StaticCtorsSection = "\t.section .ctors,\"aw\""; |
| 205 | StaticDtorsSection = "\t.section .dtors,\"aw\""; |
| 206 | HiddenDirective = NULL; |
| 207 | PrivateGlobalPrefix = "L"; // Prefix for private global symbols |
| 208 | WeakRefDirective = "\t.weak\t"; |
| 209 | SetDirective = "\t.set\t"; |
| 210 | |
| 211 | // Set up DWARF directives |
| 212 | HasLEB128 = true; // Target asm supports leb128 directives (little-endian) |
| 213 | AbsoluteDebugSectionOffsets = true; |
| 214 | AbsoluteEHSectionOffsets = false; |
| 215 | SupportsDebugInformation = true; |
| 216 | DwarfSectionOffsetDirective = "\t.secrel32\t"; |
| 217 | DwarfAbbrevSection = "\t.section\t.debug_abbrev,\"dr\""; |
| 218 | DwarfInfoSection = "\t.section\t.debug_info,\"dr\""; |
| 219 | DwarfLineSection = "\t.section\t.debug_line,\"dr\""; |
| 220 | DwarfFrameSection = "\t.section\t.debug_frame,\"dr\""; |
| 221 | DwarfPubNamesSection ="\t.section\t.debug_pubnames,\"dr\""; |
| 222 | DwarfPubTypesSection ="\t.section\t.debug_pubtypes,\"dr\""; |
| 223 | DwarfStrSection = "\t.section\t.debug_str,\"dr\""; |
| 224 | DwarfLocSection = "\t.section\t.debug_loc,\"dr\""; |
| 225 | DwarfARangesSection = "\t.section\t.debug_aranges,\"dr\""; |
| 226 | DwarfRangesSection = "\t.section\t.debug_ranges,\"dr\""; |
Chris Lattner | b839c3f | 2009-06-18 23:31:37 +0000 | [diff] [blame] | 227 | DwarfMacroInfoSection = "\t.section\t.debug_macinfo,\"dr\""; |
Anton Korobeynikov | 4468b7a | 2008-07-09 13:20:48 +0000 | [diff] [blame] | 228 | } |
| 229 | |
Anton Korobeynikov | b9e58ef | 2008-07-09 13:21:08 +0000 | [diff] [blame] | 230 | unsigned |
| 231 | X86COFFTargetAsmInfo::PreferredEHDataFormat(DwarfEncoding::Target Reason, |
| 232 | bool Global) const { |
Dan Gohman | 8f09225 | 2008-11-03 18:22:42 +0000 | [diff] [blame] | 233 | CodeModel::Model CM = TM.getCodeModel(); |
| 234 | bool is64Bit = TM.getSubtarget<X86Subtarget>().is64Bit(); |
Anton Korobeynikov | cee750f | 2008-02-27 23:33:50 +0000 | [diff] [blame] | 235 | |
Dan Gohman | 8f09225 | 2008-11-03 18:22:42 +0000 | [diff] [blame] | 236 | if (TM.getRelocationModel() == Reloc::PIC_) { |
Anton Korobeynikov | b9e58ef | 2008-07-09 13:21:08 +0000 | [diff] [blame] | 237 | unsigned Format = 0; |
Anton Korobeynikov | cee750f | 2008-02-27 23:33:50 +0000 | [diff] [blame] | 238 | |
Anton Korobeynikov | b9e58ef | 2008-07-09 13:21:08 +0000 | [diff] [blame] | 239 | if (!is64Bit) |
| 240 | // 32 bit targets always encode pointers as 4 bytes |
| 241 | Format = DW_EH_PE_sdata4; |
| 242 | else { |
| 243 | // 64 bit targets encode pointers in 4 bytes iff: |
| 244 | // - code model is small OR |
| 245 | // - code model is medium and we're emitting externally visible symbols |
| 246 | // or any code symbols |
| 247 | if (CM == CodeModel::Small || |
| 248 | (CM == CodeModel::Medium && (Global || |
| 249 | Reason != DwarfEncoding::Data))) |
Anton Korobeynikov | cee750f | 2008-02-27 23:33:50 +0000 | [diff] [blame] | 250 | Format = DW_EH_PE_sdata4; |
Anton Korobeynikov | cee750f | 2008-02-27 23:33:50 +0000 | [diff] [blame] | 251 | else |
Anton Korobeynikov | b9e58ef | 2008-07-09 13:21:08 +0000 | [diff] [blame] | 252 | Format = DW_EH_PE_sdata8; |
Anton Korobeynikov | cee750f | 2008-02-27 23:33:50 +0000 | [diff] [blame] | 253 | } |
Anton Korobeynikov | cee750f | 2008-02-27 23:33:50 +0000 | [diff] [blame] | 254 | |
Anton Korobeynikov | b9e58ef | 2008-07-09 13:21:08 +0000 | [diff] [blame] | 255 | if (Global) |
| 256 | Format |= DW_EH_PE_indirect; |
| 257 | |
| 258 | return (Format | DW_EH_PE_pcrel); |
Anton Korobeynikov | cee750f | 2008-02-27 23:33:50 +0000 | [diff] [blame] | 259 | } |
Chris Lattner | 55acc68 | 2009-07-24 04:49:34 +0000 | [diff] [blame] | 260 | |
| 261 | if (is64Bit && |
| 262 | (CM == CodeModel::Small || |
| 263 | (CM == CodeModel::Medium && Reason != DwarfEncoding::Data))) |
| 264 | return DW_EH_PE_udata4; |
| 265 | return DW_EH_PE_absptr; |
Anton Korobeynikov | cee750f | 2008-02-27 23:33:50 +0000 | [diff] [blame] | 266 | } |
| 267 | |
Chris Lattner | 55acc68 | 2009-07-24 04:49:34 +0000 | [diff] [blame] | 268 | const char *X86COFFTargetAsmInfo:: |
| 269 | getSectionPrefixForUniqueGlobal(SectionKind::Kind Kind) const { |
| 270 | switch (Kind) { |
| 271 | default: llvm_unreachable("Unknown section kind"); |
| 272 | case SectionKind::Text: return ".text$linkonce"; |
| 273 | case SectionKind::Data: |
| 274 | case SectionKind::BSS: |
| 275 | case SectionKind::ThreadData: |
| 276 | case SectionKind::ThreadBSS: return ".data$linkonce"; |
| 277 | case SectionKind::ROData: |
| 278 | case SectionKind::RODataMergeConst: |
| 279 | case SectionKind::RODataMergeStr: return ".rdata$linkonce"; |
Anton Korobeynikov | 29b03f7 | 2008-07-09 13:19:38 +0000 | [diff] [blame] | 280 | } |
Devang Patel | 8a84e44 | 2009-01-05 17:31:22 +0000 | [diff] [blame] | 281 | return NULL; |
Anton Korobeynikov | 29b03f7 | 2008-07-09 13:19:38 +0000 | [diff] [blame] | 282 | } |
| 283 | |
Anton Korobeynikov | d0c1e29 | 2008-08-16 12:57:07 +0000 | [diff] [blame] | 284 | std::string X86COFFTargetAsmInfo::printSectionFlags(unsigned flags) const { |
Anton Korobeynikov | f447e3d | 2008-07-09 13:21:49 +0000 | [diff] [blame] | 285 | std::string Flags = ",\""; |
| 286 | |
| 287 | if (flags & SectionFlags::Code) |
| 288 | Flags += 'x'; |
| 289 | if (flags & SectionFlags::Writeable) |
| 290 | Flags += 'w'; |
| 291 | |
| 292 | Flags += "\""; |
| 293 | |
| 294 | return Flags; |
| 295 | } |
| 296 | |
| 297 | X86WinTargetAsmInfo::X86WinTargetAsmInfo(const X86TargetMachine &TM): |
Anton Korobeynikov | 32b952a | 2008-09-25 21:00:33 +0000 | [diff] [blame] | 298 | X86GenericTargetAsmInfo(TM) { |
Anton Korobeynikov | f447e3d | 2008-07-09 13:21:49 +0000 | [diff] [blame] | 299 | GlobalPrefix = "_"; |
| 300 | CommentString = ";"; |
| 301 | |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 302 | InlineAsmStart = "; InlineAsm Start"; |
| 303 | InlineAsmEnd = "; InlineAsm End"; |
| 304 | |
Anton Korobeynikov | f447e3d | 2008-07-09 13:21:49 +0000 | [diff] [blame] | 305 | PrivateGlobalPrefix = "$"; |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 306 | AlignDirective = "\tALIGN\t"; |
Anton Korobeynikov | f447e3d | 2008-07-09 13:21:49 +0000 | [diff] [blame] | 307 | ZeroDirective = "\tdb\t"; |
| 308 | ZeroDirectiveSuffix = " dup(0)"; |
| 309 | AsciiDirective = "\tdb\t"; |
| 310 | AscizDirective = 0; |
| 311 | Data8bitsDirective = "\tdb\t"; |
| 312 | Data16bitsDirective = "\tdw\t"; |
| 313 | Data32bitsDirective = "\tdd\t"; |
| 314 | Data64bitsDirective = "\tdq\t"; |
| 315 | HasDotTypeDotSizeDirective = false; |
Rafael Espindola | 952b839 | 2008-12-03 11:01:37 +0000 | [diff] [blame] | 316 | HasSingleParameterDotFile = false; |
Anton Korobeynikov | f447e3d | 2008-07-09 13:21:49 +0000 | [diff] [blame] | 317 | |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 318 | AlignmentIsInBytes = true; |
| 319 | |
Anton Korobeynikov | d7ca416 | 2008-09-24 22:15:21 +0000 | [diff] [blame] | 320 | TextSection = getUnnamedSection("_text", SectionFlags::Code); |
Anton Korobeynikov | 315690e | 2008-09-24 22:16:16 +0000 | [diff] [blame] | 321 | DataSection = getUnnamedSection("_data", SectionFlags::Writeable); |
| 322 | |
Anton Korobeynikov | f447e3d | 2008-07-09 13:21:49 +0000 | [diff] [blame] | 323 | JumpTableDataSection = NULL; |
| 324 | SwitchToSectionDirective = ""; |
Eli Friedman | aace4b1 | 2009-06-19 04:48:38 +0000 | [diff] [blame] | 325 | TextSectionStartSuffix = "\tSEGMENT PARA 'CODE'"; |
| 326 | DataSectionStartSuffix = "\tSEGMENT PARA 'DATA'"; |
Anton Korobeynikov | f447e3d | 2008-07-09 13:21:49 +0000 | [diff] [blame] | 327 | SectionEndDirectiveSuffix = "\tends\n"; |
| 328 | } |
Anton Korobeynikov | 6381a13 | 2008-10-05 08:53:29 +0000 | [diff] [blame] | 329 | |
Anton Korobeynikov | 6381a13 | 2008-10-05 08:53:29 +0000 | [diff] [blame] | 330 | // Instantiate default implementation. |
| 331 | TEMPLATE_INSTANTIATION(class X86TargetAsmInfo<TargetAsmInfo>); |