1 //===-- X86TargetAsmInfo.cpp - X86 asm properties ---------------*- C++ -*-===//
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 X86TargetAsmInfo properties.
12 //===----------------------------------------------------------------------===//
14 #include "X86TargetAsmInfo.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 X86DarwinTargetAsmInfo::X86DarwinTargetAsmInfo(const Triple &Triple)
47 : DarwinTargetAsmInfo(Triple) {
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
59 PersonalityPrefix = "";
60 PersonalitySuffix = "+4@GOTPCREL";
62 PersonalityPrefix = "L";
63 PersonalitySuffix = "$non_lazy_ptr";
69 SupportsDebugInformation = true;
70 DwarfUsesInlineInfoSection = true;
72 // Exceptions handling
73 ExceptionsType = ExceptionHandling::Dwarf;
74 AbsoluteEHSectionOffsets = false;
77 X86ELFTargetAsmInfo::X86ELFTargetAsmInfo(const Triple &Triple) {
78 AsmTransCBE = x86_asm_table;
79 AssemblerDialect = AsmWriterFlavor;
81 PrivateGlobalPrefix = ".L";
82 WeakRefDirective = "\t.weak\t";
83 SetDirective = "\t.set\t";
86 // Set up DWARF directives
87 HasLEB128 = true; // Target asm supports leb128 directives (little-endian)
90 AbsoluteDebugSectionOffsets = true;
91 SupportsDebugInformation = true;
93 // Exceptions handling
94 ExceptionsType = ExceptionHandling::Dwarf;
95 AbsoluteEHSectionOffsets = false;
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";
102 X86COFFTargetAsmInfo::X86COFFTargetAsmInfo(const Triple &Triple) {
103 AsmTransCBE = x86_asm_table;
104 AssemblerDialect = AsmWriterFlavor;
108 X86WinTargetAsmInfo::X86WinTargetAsmInfo(const Triple &Triple) {
109 AsmTransCBE = x86_asm_table;
110 AssemblerDialect = AsmWriterFlavor;
115 PrivateGlobalPrefix = "$";
116 AlignDirective = "\tALIGN\t";
117 ZeroDirective = "\tdb\t";
118 ZeroDirectiveSuffix = " dup(0)";
119 AsciiDirective = "\tdb\t";
121 Data8bitsDirective = "\tdb\t";
122 Data16bitsDirective = "\tdw\t";
123 Data32bitsDirective = "\tdd\t";
124 Data64bitsDirective = "\tdq\t";
125 HasDotTypeDotSizeDirective = false;
126 HasSingleParameterDotFile = false;
128 AlignmentIsInBytes = true;