1 //===-- X86MCAsmInfo.cpp - X86 asm properties -----------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file contains the declarations of the X86MCAsmInfo properties.
12 //===----------------------------------------------------------------------===//
14 #include "X86MCAsmInfo.h"
15 #include "X86TargetMachine.h"
16 #include "llvm/ADT/Triple.h"
17 #include "llvm/Support/CommandLine.h"
20 enum AsmWriterFlavorTy {
21 // Note: This numbering has to match the GCC assembler dialects for inline
22 // asm alternatives to work right.
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"),
34 static const char *const x86_asm_table[] = {
46 X86MCAsmInfoDarwin::X86MCAsmInfoDarwin(const Triple &Triple)
47 : MCAsmInfoDarwin(true /*islittleendian*/) {
48 AsmTransCBE = x86_asm_table;
49 AssemblerDialect = AsmWriterFlavor;
51 bool is64Bit = Triple.getArch() == Triple::x86_64;
53 TextAlignFillValue = 0x90;
56 Data64bitsDirective = 0; // we can't emit a 64-bit unit
58 // Leopard and above support aligned common symbols.
59 COMMDirectiveTakesAlignment = Triple.getDarwinMajorNumber() >= 9;
64 SupportsDebugInformation = true;
65 DwarfUsesInlineInfoSection = true;
67 // Exceptions handling
68 ExceptionsType = ExceptionHandling::Dwarf;
69 AbsoluteEHSectionOffsets = false;
72 X86ELFMCAsmInfo::X86ELFMCAsmInfo(const Triple &Triple)
73 : MCAsmInfo(true /*islittleendian*/) {
74 AsmTransCBE = x86_asm_table;
75 AssemblerDialect = AsmWriterFlavor;
77 PrivateGlobalPrefix = ".L";
78 WeakRefDirective = "\t.weak\t";
79 SetDirective = "\t.set\t";
82 // Set up DWARF directives
83 HasLEB128 = true; // Target asm supports leb128 directives (little-endian)
86 AbsoluteDebugSectionOffsets = true;
87 SupportsDebugInformation = true;
89 // Exceptions handling
90 ExceptionsType = ExceptionHandling::Dwarf;
91 AbsoluteEHSectionOffsets = false;
93 // On Linux we must declare when we can use a non-executable stack.
94 if (Triple.getOS() == Triple::Linux)
95 NonexecutableStackDirective = "\t.section\t.note.GNU-stack,\"\",@progbits";
98 X86MCAsmInfoCOFF::X86MCAsmInfoCOFF(const Triple &Triple)
99 : MCAsmInfoCOFF(true /*islittleendian*/) {
100 AsmTransCBE = x86_asm_table;
101 AssemblerDialect = AsmWriterFlavor;
105 X86WinMCAsmInfo::X86WinMCAsmInfo(const Triple &Triple)
106 : MCAsmInfo(true /*islittleendian*/) {
107 AsmTransCBE = x86_asm_table;
108 AssemblerDialect = AsmWriterFlavor;
113 PrivateGlobalPrefix = "$";
114 AlignDirective = "\tALIGN\t";
115 ZeroDirective = "\tdb\t";
116 AsciiDirective = "\tdb\t";
118 Data8bitsDirective = "\tdb\t";
119 Data16bitsDirective = "\tdw\t";
120 Data32bitsDirective = "\tdd\t";
121 Data64bitsDirective = "\tdq\t";
122 HasDotTypeDotSizeDirective = false;
123 HasSingleParameterDotFile = false;
125 AlignmentIsInBytes = true;