remove the x86/ppc impls of getEHGlobalPrefix, which is already dead.
[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 is distributed under the University of Illinois Open Source
6 // 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 #include "llvm/DerivedTypes.h"
18 #include "llvm/InlineAsm.h"
19 #include "llvm/Instructions.h"
20 #include "llvm/Intrinsics.h"
21 #include "llvm/Module.h"
22 #include "llvm/ADT/StringExtras.h"
23 #include "llvm/Support/Dwarf.h"
24 #include "llvm/Support/ErrorHandling.h"
25
26 using namespace llvm;
27 using namespace llvm::dwarf;
28
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};
40
41 X86DarwinTargetAsmInfo::X86DarwinTargetAsmInfo(const X86TargetMachine &TM):
42   X86TargetAsmInfo<DarwinTargetAsmInfo>(TM) {
43   const X86Subtarget *Subtarget = &TM.getSubtarget<X86Subtarget>();
44   bool is64Bit = Subtarget->is64Bit();
45
46   AlignmentIsInBytes = false;
47   TextAlignFillValue = 0x90;
48
49
50   if (!is64Bit)
51     Data64bitsDirective = 0;       // we can't emit a 64-bit unit
52   ZeroDirective = "\t.space\t";  // ".space N" emits N zeros.
53   ZeroFillDirective = "\t.zerofill\t";  // Uses .zerofill
54   LCOMMDirective = "\t.lcomm\t";
55
56   // Leopard and above support aligned common symbols.
57   COMMDirectiveTakesAlignment = (Subtarget->getDarwinVers() >= 9);
58   HasDotTypeDotSizeDirective = false;
59
60   if (is64Bit) {
61     PersonalityPrefix = "";
62     PersonalitySuffix = "+4@GOTPCREL";
63   } else {
64     PersonalityPrefix = "L";
65     PersonalitySuffix = "$non_lazy_ptr";
66   }
67
68   InlineAsmStart = "## InlineAsm Start";
69   InlineAsmEnd = "## InlineAsm End";
70   CommentString = "##";
71   SetDirective = "\t.set";
72   PCSymbol = ".";
73   UsedDirective = "\t.no_dead_strip\t";
74   ProtectedDirective = "\t.globl\t";
75
76   SupportsDebugInformation = true;
77   DwarfDebugInlineSection = ".section __DWARF,__debug_inlined,regular,debug";
78   DwarfUsesInlineInfoSection = true;
79
80   // Exceptions handling
81   SupportsExceptionHandling = true;
82   GlobalEHDirective = "\t.globl\t";
83   SupportsWeakOmittedEHFrame = false;
84   AbsoluteEHSectionOffsets = false;
85   DwarfEHFrameSection =
86   ".section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support";
87 }
88
89 X86ELFTargetAsmInfo::X86ELFTargetAsmInfo(const X86TargetMachine &TM) :
90   X86TargetAsmInfo<ELFTargetAsmInfo>(TM) {
91
92   PrivateGlobalPrefix = ".L";
93   WeakRefDirective = "\t.weak\t";
94   SetDirective = "\t.set\t";
95   PCSymbol = ".";
96
97   // Set up DWARF directives
98   HasLEB128 = true;  // Target asm supports leb128 directives (little-endian)
99
100   // Debug Information
101   AbsoluteDebugSectionOffsets = true;
102   SupportsDebugInformation = true;
103   DwarfAbbrevSection =  "\t.section\t.debug_abbrev,\"\",@progbits";
104   DwarfInfoSection =    "\t.section\t.debug_info,\"\",@progbits";
105   DwarfLineSection =    "\t.section\t.debug_line,\"\",@progbits";
106   DwarfFrameSection =   "\t.section\t.debug_frame,\"\",@progbits";
107   DwarfPubNamesSection ="\t.section\t.debug_pubnames,\"\",@progbits";
108   DwarfPubTypesSection ="\t.section\t.debug_pubtypes,\"\",@progbits";
109   DwarfStrSection =     "\t.section\t.debug_str,\"\",@progbits";
110   DwarfLocSection =     "\t.section\t.debug_loc,\"\",@progbits";
111   DwarfARangesSection = "\t.section\t.debug_aranges,\"\",@progbits";
112   DwarfRangesSection =  "\t.section\t.debug_ranges,\"\",@progbits";
113   DwarfMacroInfoSection = "\t.section\t.debug_macinfo,\"\",@progbits";
114
115   // Exceptions handling
116   SupportsExceptionHandling = true;
117   AbsoluteEHSectionOffsets = false;
118   DwarfEHFrameSection = "\t.section\t.eh_frame,\"aw\",@progbits";
119
120   // On Linux we must declare when we can use a non-executable stack.
121   if (TM.getSubtarget<X86Subtarget>().isLinux())
122     NonexecutableStackDirective = "\t.section\t.note.GNU-stack,\"\",@progbits";
123 }
124
125
126 X86WinTargetAsmInfo::X86WinTargetAsmInfo(const X86TargetMachine &TM):
127   X86TargetAsmInfo<TargetAsmInfo>(TM) {
128   GlobalPrefix = "_";
129   CommentString = ";";
130
131   InlineAsmStart = "; InlineAsm Start";
132   InlineAsmEnd   = "; InlineAsm End";
133
134   PrivateGlobalPrefix = "$";
135   AlignDirective = "\tALIGN\t";
136   ZeroDirective = "\tdb\t";
137   ZeroDirectiveSuffix = " dup(0)";
138   AsciiDirective = "\tdb\t";
139   AscizDirective = 0;
140   Data8bitsDirective = "\tdb\t";
141   Data16bitsDirective = "\tdw\t";
142   Data32bitsDirective = "\tdd\t";
143   Data64bitsDirective = "\tdq\t";
144   HasDotTypeDotSizeDirective = false;
145   HasSingleParameterDotFile = false;
146
147   AlignmentIsInBytes = true;
148
149   SwitchToSectionDirective = "";
150   TextSectionStartSuffix = "\tSEGMENT PARA 'CODE'";
151   DataSectionStartSuffix = "\tSEGMENT PARA 'DATA'";
152   SectionEndDirectiveSuffix = "\tends\n";
153 }
154
155 // Instantiate default implementation.
156 TEMPLATE_INSTANTIATION(class X86TargetAsmInfo<TargetAsmInfo>);