fix a minor fixme. When building with SL and later tools, the ".eh" symbols
[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 "llvm/ADT/Triple.h"
17 #include "llvm/Support/CommandLine.h"
18 using namespace llvm;
19
20 enum AsmWriterFlavorTy {
21   // Note: This numbering has to match the GCC assembler dialects for inline
22   // asm alternatives to work right.
23   ATT = 0, Intel = 1
24 };
25
26 static cl::opt<AsmWriterFlavorTy>
27 AsmWriterFlavor("x86-asm-syntax", cl::init(ATT),
28   cl::desc("Choose style of code to emit from X86 backend:"),
29   cl::values(clEnumValN(ATT,   "att",   "Emit AT&T-style assembly"),
30              clEnumValN(Intel, "intel", "Emit Intel-style assembly"),
31              clEnumValEnd));
32
33
34 static const char *const x86_asm_table[] = {
35   "{si}", "S",
36   "{di}", "D",
37   "{ax}", "a",
38   "{cx}", "c",
39   "{memory}", "memory",
40   "{flags}", "",
41   "{dirflag}", "",
42   "{fpsr}", "",
43   "{cc}", "cc",
44   0,0};
45
46 X86DarwinTargetAsmInfo::X86DarwinTargetAsmInfo(const Triple &Triple)
47   : DarwinTargetAsmInfo(Triple) {
48   AsmTransCBE = x86_asm_table;
49   AssemblerDialect = AsmWriterFlavor;
50     
51   bool is64Bit = Triple.getArch() == Triple::x86_64;
52
53   TextAlignFillValue = 0x90;
54
55   if (!is64Bit)
56     Data64bitsDirective = 0;       // we can't emit a 64-bit unit
57
58   if (is64Bit) {
59     PersonalityPrefix = "";
60     PersonalitySuffix = "+4@GOTPCREL";
61   } else {
62     PersonalityPrefix = "L";
63     PersonalitySuffix = "$non_lazy_ptr";
64   }
65
66   CommentString = "##";
67   PCSymbol = ".";
68
69   SupportsDebugInformation = true;
70   DwarfUsesInlineInfoSection = true;
71
72   // Exceptions handling
73   ExceptionsType = ExceptionHandling::Dwarf;
74   AbsoluteEHSectionOffsets = false;
75 }
76
77 X86ELFTargetAsmInfo::X86ELFTargetAsmInfo(const Triple &Triple) {
78   AsmTransCBE = x86_asm_table;
79   AssemblerDialect = AsmWriterFlavor;
80
81   PrivateGlobalPrefix = ".L";
82   WeakRefDirective = "\t.weak\t";
83   SetDirective = "\t.set\t";
84   PCSymbol = ".";
85
86   // Set up DWARF directives
87   HasLEB128 = true;  // Target asm supports leb128 directives (little-endian)
88
89   // Debug Information
90   AbsoluteDebugSectionOffsets = true;
91   SupportsDebugInformation = true;
92
93   // Exceptions handling
94   ExceptionsType = ExceptionHandling::Dwarf;
95   AbsoluteEHSectionOffsets = false;
96
97   // On Linux we must declare when we can use a non-executable stack.
98   if (Triple.getOS() == Triple::Linux)
99     NonexecutableStackDirective = "\t.section\t.note.GNU-stack,\"\",@progbits";
100 }
101
102 X86COFFTargetAsmInfo::X86COFFTargetAsmInfo(const Triple &Triple) {
103   AsmTransCBE = x86_asm_table;
104   AssemblerDialect = AsmWriterFlavor;
105 }
106
107
108 X86WinTargetAsmInfo::X86WinTargetAsmInfo(const Triple &Triple) {
109   AsmTransCBE = x86_asm_table;
110   AssemblerDialect = AsmWriterFlavor;
111
112   GlobalPrefix = "_";
113   CommentString = ";";
114
115   PrivateGlobalPrefix = "$";
116   AlignDirective = "\tALIGN\t";
117   ZeroDirective = "\tdb\t";
118   ZeroDirectiveSuffix = " dup(0)";
119   AsciiDirective = "\tdb\t";
120   AscizDirective = 0;
121   Data8bitsDirective = "\tdb\t";
122   Data16bitsDirective = "\tdw\t";
123   Data32bitsDirective = "\tdd\t";
124   Data64bitsDirective = "\tdq\t";
125   HasDotTypeDotSizeDirective = false;
126   HasSingleParameterDotFile = false;
127
128   AlignmentIsInBytes = true;
129 }