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 | // |
| 5 | // This file was developed by James M. Laskey and is distributed under the |
| 6 | // University of Illinois Open Source License. See LICENSE.TXT for details. |
| 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" |
| 17 | |
| 18 | using namespace llvm; |
| 19 | |
| 20 | X86TargetAsmInfo::X86TargetAsmInfo(const X86TargetMachine &TM) { |
| 21 | const X86Subtarget *Subtarget = &TM.getSubtarget<X86Subtarget>(); |
| 22 | |
Chris Lattner | afbfded | 2006-10-05 02:43:52 +0000 | [diff] [blame] | 23 | // FIXME - Should be simplified. |
Jim Laskey | 8e8de8f | 2006-09-07 22:05:02 +0000 | [diff] [blame] | 24 | |
| 25 | switch (Subtarget->TargetType) { |
| 26 | case X86Subtarget::isDarwin: |
| 27 | AlignmentIsInBytes = false; |
| 28 | GlobalPrefix = "_"; |
Evan Cheng | 25ab690 | 2006-09-08 06:48:29 +0000 | [diff] [blame] | 29 | if (!Subtarget->is64Bit()) |
| 30 | Data64bitsDirective = 0; // we can't emit a 64-bit unit |
Jim Laskey | 8e8de8f | 2006-09-07 22:05:02 +0000 | [diff] [blame] | 31 | ZeroDirective = "\t.space\t"; // ".space N" emits N zeros. |
| 32 | PrivateGlobalPrefix = "L"; // Marker for constant pool idxs |
| 33 | ConstantPoolSection = "\t.const\n"; |
Chris Lattner | afbfded | 2006-10-05 02:43:52 +0000 | [diff] [blame] | 34 | JumpTableDataSection = "\t.const\n"; |
Jim Laskey | 8e8de8f | 2006-09-07 22:05:02 +0000 | [diff] [blame] | 35 | FourByteConstantSection = "\t.literal4\n"; |
| 36 | EightByteConstantSection = "\t.literal8\n"; |
Evan Cheng | 25ab690 | 2006-09-08 06:48:29 +0000 | [diff] [blame] | 37 | if (Subtarget->is64Bit()) |
| 38 | SixteenByteConstantSection = "\t.literal16\n"; |
Jim Laskey | 8e8de8f | 2006-09-07 22:05:02 +0000 | [diff] [blame] | 39 | LCOMMDirective = "\t.lcomm\t"; |
| 40 | COMMDirectiveTakesAlignment = false; |
| 41 | HasDotTypeDotSizeDirective = false; |
| 42 | StaticCtorsSection = ".mod_init_func"; |
| 43 | StaticDtorsSection = ".mod_term_func"; |
| 44 | InlineAsmStart = "# InlineAsm Start"; |
| 45 | InlineAsmEnd = "# InlineAsm End"; |
| 46 | SetDirective = "\t.set"; |
Chris Lattner | a53115b | 2006-09-26 03:39:53 +0000 | [diff] [blame] | 47 | UsedDirective = "\t.no_dead_strip\t"; |
Jim Laskey | 8e8de8f | 2006-09-07 22:05:02 +0000 | [diff] [blame] | 48 | |
| 49 | NeedsSet = true; |
| 50 | DwarfAbbrevSection = ".section __DWARF,__debug_abbrev,regular,debug"; |
| 51 | DwarfInfoSection = ".section __DWARF,__debug_info,regular,debug"; |
| 52 | DwarfLineSection = ".section __DWARF,__debug_line,regular,debug"; |
| 53 | DwarfFrameSection = ".section __DWARF,__debug_frame,regular,debug"; |
| 54 | DwarfPubNamesSection = ".section __DWARF,__debug_pubnames,regular,debug"; |
| 55 | DwarfPubTypesSection = ".section __DWARF,__debug_pubtypes,regular,debug"; |
| 56 | DwarfStrSection = ".section __DWARF,__debug_str,regular,debug"; |
| 57 | DwarfLocSection = ".section __DWARF,__debug_loc,regular,debug"; |
| 58 | DwarfARangesSection = ".section __DWARF,__debug_aranges,regular,debug"; |
| 59 | DwarfRangesSection = ".section __DWARF,__debug_ranges,regular,debug"; |
| 60 | DwarfMacInfoSection = ".section __DWARF,__debug_macinfo,regular,debug"; |
| 61 | break; |
| 62 | case X86Subtarget::isCygwin: |
| 63 | GlobalPrefix = "_"; |
| 64 | COMMDirectiveTakesAlignment = false; |
| 65 | HasDotTypeDotSizeDirective = false; |
| 66 | StaticCtorsSection = "\t.section .ctors,\"aw\""; |
| 67 | StaticDtorsSection = "\t.section .dtors,\"aw\""; |
| 68 | break; |
| 69 | case X86Subtarget::isWindows: |
| 70 | GlobalPrefix = "_"; |
| 71 | HasDotTypeDotSizeDirective = false; |
| 72 | break; |
| 73 | default: break; |
| 74 | } |
| 75 | |
| 76 | if (Subtarget->isFlavorIntel()) { |
| 77 | GlobalPrefix = "_"; |
| 78 | CommentString = ";"; |
| 79 | |
| 80 | PrivateGlobalPrefix = "$"; |
| 81 | AlignDirective = "\talign\t"; |
| 82 | ZeroDirective = "\tdb\t"; |
| 83 | ZeroDirectiveSuffix = " dup(0)"; |
| 84 | AsciiDirective = "\tdb\t"; |
| 85 | AscizDirective = 0; |
| 86 | Data8bitsDirective = "\tdb\t"; |
| 87 | Data16bitsDirective = "\tdw\t"; |
| 88 | Data32bitsDirective = "\tdd\t"; |
| 89 | Data64bitsDirective = "\tdq\t"; |
| 90 | HasDotTypeDotSizeDirective = false; |
| 91 | |
| 92 | TextSection = "_text"; |
| 93 | DataSection = "_data"; |
| 94 | SwitchToSectionDirective = ""; |
| 95 | TextSectionStartSuffix = "\tsegment 'CODE'"; |
| 96 | DataSectionStartSuffix = "\tsegment 'DATA'"; |
| 97 | SectionEndDirectiveSuffix = "\tends\n"; |
| 98 | } |
| 99 | } |
Chris Lattner | afbfded | 2006-10-05 02:43:52 +0000 | [diff] [blame] | 100 | |