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 AsmTransCBE = x86_asm_table;
48 AssemblerDialect = AsmWriterFlavor;
50 bool is64Bit = Triple.getArch() == Triple::x86_64;
52 TextAlignFillValue = 0x90;
55 Data64bitsDirective = 0; // we can't emit a 64-bit unit
57 // Leopard and above support aligned common symbols.
58 COMMDirectiveTakesAlignment = Triple.getDarwinMajorNumber() >= 9;
63 SupportsDebugInformation = true;
64 DwarfUsesInlineInfoSection = true;
66 // Exceptions handling
67 ExceptionsType = ExceptionHandling::Dwarf;
68 AbsoluteEHSectionOffsets = false;
71 X86ELFMCAsmInfo::X86ELFMCAsmInfo(const Triple &Triple) {
72 AsmTransCBE = x86_asm_table;
73 AssemblerDialect = AsmWriterFlavor;
75 PrivateGlobalPrefix = ".L";
76 WeakRefDirective = "\t.weak\t";
77 SetDirective = "\t.set\t";
80 // Set up DWARF directives
81 HasLEB128 = true; // Target asm supports leb128 directives (little-endian)
84 AbsoluteDebugSectionOffsets = true;
85 SupportsDebugInformation = true;
87 // Exceptions handling
88 ExceptionsType = ExceptionHandling::Dwarf;
89 AbsoluteEHSectionOffsets = false;
91 // On Linux we must declare when we can use a non-executable stack.
92 if (Triple.getOS() == Triple::Linux)
93 NonexecutableStackDirective = "\t.section\t.note.GNU-stack,\"\",@progbits";
96 X86MCAsmInfoCOFF::X86MCAsmInfoCOFF(const Triple &Triple) {
97 AsmTransCBE = x86_asm_table;
98 AssemblerDialect = AsmWriterFlavor;
102 X86WinMCAsmInfo::X86WinMCAsmInfo(const Triple &Triple) {
103 AsmTransCBE = x86_asm_table;
104 AssemblerDialect = AsmWriterFlavor;
109 PrivateGlobalPrefix = "$";
110 AlignDirective = "\tALIGN\t";
111 ZeroDirective = "\tdb\t";
112 ZeroDirectiveSuffix = " dup(0)";
113 AsciiDirective = "\tdb\t";
115 Data8bitsDirective = "\tdb\t";
116 Data16bitsDirective = "\tdw\t";
117 Data32bitsDirective = "\tdd\t";
118 Data64bitsDirective = "\tdq\t";
119 HasDotTypeDotSizeDirective = false;
120 HasSingleParameterDotFile = false;
122 AlignmentIsInBytes = true;