Committing X86-64 support.
[oota-llvm.git] / lib / Target / X86 / X86TargetAsmInfo.cpp
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     if (!Subtarget->is64Bit())
30       Data64bitsDirective = 0;       // we can't emit a 64-bit unit
31     ZeroDirective = "\t.space\t";  // ".space N" emits N zeros.
32     PrivateGlobalPrefix = "L";     // Marker for constant pool idxs
33     ConstantPoolSection = "\t.const\n";
34     JumpTableDataSection = "\t.const\n"; // FIXME: depends on PIC mode
35     FourByteConstantSection = "\t.literal4\n";
36     EightByteConstantSection = "\t.literal8\n";
37     if (Subtarget->is64Bit())
38       SixteenByteConstantSection = "\t.literal16\n";
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";
47     
48     NeedsSet = true;
49     DwarfAbbrevSection = ".section __DWARF,__debug_abbrev,regular,debug";
50     DwarfInfoSection = ".section __DWARF,__debug_info,regular,debug";
51     DwarfLineSection = ".section __DWARF,__debug_line,regular,debug";
52     DwarfFrameSection = ".section __DWARF,__debug_frame,regular,debug";
53     DwarfPubNamesSection = ".section __DWARF,__debug_pubnames,regular,debug";
54     DwarfPubTypesSection = ".section __DWARF,__debug_pubtypes,regular,debug";
55     DwarfStrSection = ".section __DWARF,__debug_str,regular,debug";
56     DwarfLocSection = ".section __DWARF,__debug_loc,regular,debug";
57     DwarfARangesSection = ".section __DWARF,__debug_aranges,regular,debug";
58     DwarfRangesSection = ".section __DWARF,__debug_ranges,regular,debug";
59     DwarfMacInfoSection = ".section __DWARF,__debug_macinfo,regular,debug";
60     break;
61   case X86Subtarget::isCygwin:
62     GlobalPrefix = "_";
63     COMMDirectiveTakesAlignment = false;
64     HasDotTypeDotSizeDirective = false;
65     StaticCtorsSection = "\t.section .ctors,\"aw\"";
66     StaticDtorsSection = "\t.section .dtors,\"aw\"";
67     break;
68   case X86Subtarget::isWindows:
69     GlobalPrefix = "_";
70     HasDotTypeDotSizeDirective = false;
71     break;
72   default: break;
73   }
74   
75   if (Subtarget->isFlavorIntel()) {
76     GlobalPrefix = "_";
77     CommentString = ";";
78   
79     PrivateGlobalPrefix = "$";
80     AlignDirective = "\talign\t";
81     ZeroDirective = "\tdb\t";
82     ZeroDirectiveSuffix = " dup(0)";
83     AsciiDirective = "\tdb\t";
84     AscizDirective = 0;
85     Data8bitsDirective = "\tdb\t";
86     Data16bitsDirective = "\tdw\t";
87     Data32bitsDirective = "\tdd\t";
88     Data64bitsDirective = "\tdq\t";
89     HasDotTypeDotSizeDirective = false;
90     
91     TextSection = "_text";
92     DataSection = "_data";
93     SwitchToSectionDirective = "";
94     TextSectionStartSuffix = "\tsegment 'CODE'";
95     DataSectionStartSuffix = "\tsegment 'DATA'";
96     SectionEndDirectiveSuffix = "\tends\n";
97   }
98 }