1. Clean up code due to changes in SwitchTo*Section(2)
[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 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";
35     CStringSection = "\t.cstring";
36     FourByteConstantSection = "\t.literal4\n";
37     EightByteConstantSection = "\t.literal8\n";
38     if (Subtarget->is64Bit())
39       SixteenByteConstantSection = "\t.literal16\n";
40     LCOMMDirective = "\t.lcomm\t";
41     COMMDirectiveTakesAlignment = false;
42     HasDotTypeDotSizeDirective = false;
43     StaticCtorsSection = ".mod_init_func";
44     StaticDtorsSection = ".mod_term_func";
45     InlineAsmStart = "# InlineAsm Start";
46     InlineAsmEnd = "# InlineAsm End";
47     SetDirective = "\t.set";
48     UsedDirective = "\t.no_dead_strip\t";
49     
50     NeedsSet = true;
51     DwarfAbbrevSection = ".section __DWARF,__debug_abbrev,regular,debug";
52     DwarfInfoSection = ".section __DWARF,__debug_info,regular,debug";
53     DwarfLineSection = ".section __DWARF,__debug_line,regular,debug";
54     DwarfFrameSection = ".section __DWARF,__debug_frame,regular,debug";
55     DwarfPubNamesSection = ".section __DWARF,__debug_pubnames,regular,debug";
56     DwarfPubTypesSection = ".section __DWARF,__debug_pubtypes,regular,debug";
57     DwarfStrSection = ".section __DWARF,__debug_str,regular,debug";
58     DwarfLocSection = ".section __DWARF,__debug_loc,regular,debug";
59     DwarfARangesSection = ".section __DWARF,__debug_aranges,regular,debug";
60     DwarfRangesSection = ".section __DWARF,__debug_ranges,regular,debug";
61     DwarfMacInfoSection = ".section __DWARF,__debug_macinfo,regular,debug";
62     break;
63
64   case X86Subtarget::isELF:
65     // Set up DWARF directives
66     HasLEB128 = true;  // Target asm supports leb128 directives (little-endian)
67     // bool HasLEB128; // Defaults to false.
68     // hasDotLoc - True if target asm supports .loc directives.
69     // bool HasDotLoc; // Defaults to false.
70     // HasDotFile - True if target asm supports .file directives.
71     // bool HasDotFile; // Defaults to false.
72     PrivateGlobalPrefix = ".";  // Prefix for private global symbols
73     DwarfRequiresFrameSection = false;
74     DwarfAbbrevSection =  "\t.section\t.debug_abbrev,\"\",@progbits";
75     DwarfInfoSection =    "\t.section\t.debug_info,\"\",@progbits";
76     DwarfLineSection =    "\t.section\t.debug_line,\"\",@progbits";
77     DwarfFrameSection =   "\t.section\t.debug_frame,\"\",@progbits";
78     DwarfPubNamesSection ="\t.section\t.debug_pubnames,\"\",@progbits";
79     DwarfPubTypesSection ="\t.section\t.debug_pubtypes,\"\",@progbits";
80     DwarfStrSection =     "\t.section\t.debug_str,\"\",@progbits";
81     DwarfLocSection =     "\t.section\t.debug_loc,\"\",@progbits";
82     DwarfARangesSection = "\t.section\t.debug_aranges,\"\",@progbits";
83     DwarfRangesSection =  "\t.section\t.debug_ranges,\"\",@progbits";
84     DwarfMacInfoSection = "\t.section\t.debug_macinfo,\"\",@progbits";
85     break;
86
87   case X86Subtarget::isCygwin:
88     GlobalPrefix = "_";
89     COMMDirectiveTakesAlignment = false;
90     HasDotTypeDotSizeDirective = false;
91     StaticCtorsSection = "\t.section .ctors,\"aw\"";
92     StaticDtorsSection = "\t.section .dtors,\"aw\"";
93
94     // Set up DWARF directives
95     HasLEB128 = true;  // Target asm supports leb128 directives (little-endian)
96     PrivateGlobalPrefix = "L";  // Prefix for private global symbols
97     DwarfRequiresFrameSection = false;
98     DwarfAbbrevSection =  "\t.section\t.debug_abbrev,\"dr\"";
99     DwarfInfoSection =    "\t.section\t.debug_info,\"dr\"";
100     DwarfLineSection =    "\t.section\t.debug_line,\"dr\"";
101     DwarfFrameSection =   "\t.section\t.debug_frame,\"dr\"";
102     DwarfPubNamesSection ="\t.section\t.debug_pubnames,\"dr\"";
103     DwarfPubTypesSection ="\t.section\t.debug_pubtypes,\"dr\"";
104     DwarfStrSection =     "\t.section\t.debug_str,\"dr\"";
105     DwarfLocSection =     "\t.section\t.debug_loc,\"dr\"";
106     DwarfARangesSection = "\t.section\t.debug_aranges,\"dr\"";
107     DwarfRangesSection =  "\t.section\t.debug_ranges,\"dr\"";
108     DwarfMacInfoSection = "\t.section\t.debug_macinfo,\"dr\"";
109     break;
110     
111     break;
112   case X86Subtarget::isWindows:
113     GlobalPrefix = "_";
114     HasDotTypeDotSizeDirective = false;
115     break;
116   default: break;
117   }
118   
119   if (Subtarget->isFlavorIntel()) {
120     GlobalPrefix = "_";
121     CommentString = ";";
122   
123     PrivateGlobalPrefix = "$";
124     AlignDirective = "\talign\t";
125     ZeroDirective = "\tdb\t";
126     ZeroDirectiveSuffix = " dup(0)";
127     AsciiDirective = "\tdb\t";
128     AscizDirective = 0;
129     Data8bitsDirective = "\tdb\t";
130     Data16bitsDirective = "\tdw\t";
131     Data32bitsDirective = "\tdd\t";
132     Data64bitsDirective = "\tdq\t";
133     HasDotTypeDotSizeDirective = false;
134     
135     TextSection = "_text";
136     DataSection = "_data";
137     SwitchToSectionDirective = "";
138     TextSectionStartSuffix = "\tsegment 'CODE'";
139     DataSectionStartSuffix = "\tsegment 'DATA'";
140     SectionEndDirectiveSuffix = "\tends\n";
141   }
142 }
143