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 | |
| 23 | //FIXME - Should to be simplified. |
| 24 | |
| 25 | switch (Subtarget->TargetType) { |
| 26 | case X86Subtarget::isDarwin: |
| 27 | AlignmentIsInBytes = false; |
| 28 | GlobalPrefix = "_"; |
| 29 | Data64bitsDirective = 0; // we can't emit a 64-bit unit |
| 30 | ZeroDirective = "\t.space\t"; // ".space N" emits N zeros. |
| 31 | PrivateGlobalPrefix = "L"; // Marker for constant pool idxs |
| 32 | ConstantPoolSection = "\t.const\n"; |
| 33 | JumpTableDataSection = "\t.const\n"; // FIXME: depends on PIC mode |
| 34 | FourByteConstantSection = "\t.literal4\n"; |
| 35 | EightByteConstantSection = "\t.literal8\n"; |
| 36 | LCOMMDirective = "\t.lcomm\t"; |
| 37 | COMMDirectiveTakesAlignment = false; |
| 38 | HasDotTypeDotSizeDirective = false; |
| 39 | StaticCtorsSection = ".mod_init_func"; |
| 40 | StaticDtorsSection = ".mod_term_func"; |
| 41 | InlineAsmStart = "# InlineAsm Start"; |
| 42 | InlineAsmEnd = "# InlineAsm End"; |
| 43 | SetDirective = "\t.set"; |
| 44 | |
| 45 | NeedsSet = true; |
| 46 | DwarfAbbrevSection = ".section __DWARF,__debug_abbrev,regular,debug"; |
| 47 | DwarfInfoSection = ".section __DWARF,__debug_info,regular,debug"; |
| 48 | DwarfLineSection = ".section __DWARF,__debug_line,regular,debug"; |
| 49 | DwarfFrameSection = ".section __DWARF,__debug_frame,regular,debug"; |
| 50 | DwarfPubNamesSection = ".section __DWARF,__debug_pubnames,regular,debug"; |
| 51 | DwarfPubTypesSection = ".section __DWARF,__debug_pubtypes,regular,debug"; |
| 52 | DwarfStrSection = ".section __DWARF,__debug_str,regular,debug"; |
| 53 | DwarfLocSection = ".section __DWARF,__debug_loc,regular,debug"; |
| 54 | DwarfARangesSection = ".section __DWARF,__debug_aranges,regular,debug"; |
| 55 | DwarfRangesSection = ".section __DWARF,__debug_ranges,regular,debug"; |
| 56 | DwarfMacInfoSection = ".section __DWARF,__debug_macinfo,regular,debug"; |
| 57 | break; |
| 58 | case X86Subtarget::isCygwin: |
| 59 | GlobalPrefix = "_"; |
| 60 | COMMDirectiveTakesAlignment = false; |
| 61 | HasDotTypeDotSizeDirective = false; |
| 62 | StaticCtorsSection = "\t.section .ctors,\"aw\""; |
| 63 | StaticDtorsSection = "\t.section .dtors,\"aw\""; |
| 64 | break; |
| 65 | case X86Subtarget::isWindows: |
| 66 | GlobalPrefix = "_"; |
| 67 | HasDotTypeDotSizeDirective = false; |
| 68 | break; |
| 69 | default: break; |
| 70 | } |
| 71 | |
| 72 | if (Subtarget->isFlavorIntel()) { |
| 73 | GlobalPrefix = "_"; |
| 74 | CommentString = ";"; |
| 75 | |
| 76 | PrivateGlobalPrefix = "$"; |
| 77 | AlignDirective = "\talign\t"; |
| 78 | ZeroDirective = "\tdb\t"; |
| 79 | ZeroDirectiveSuffix = " dup(0)"; |
| 80 | AsciiDirective = "\tdb\t"; |
| 81 | AscizDirective = 0; |
| 82 | Data8bitsDirective = "\tdb\t"; |
| 83 | Data16bitsDirective = "\tdw\t"; |
| 84 | Data32bitsDirective = "\tdd\t"; |
| 85 | Data64bitsDirective = "\tdq\t"; |
| 86 | HasDotTypeDotSizeDirective = false; |
| 87 | |
| 88 | TextSection = "_text"; |
| 89 | DataSection = "_data"; |
| 90 | SwitchToSectionDirective = ""; |
| 91 | TextSectionStartSuffix = "\tsegment 'CODE'"; |
| 92 | DataSectionStartSuffix = "\tsegment 'DATA'"; |
| 93 | SectionEndDirectiveSuffix = "\tends\n"; |
| 94 | } |
| 95 | } |