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 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;
61 PersonalityPrefix
= "";
62 PersonalitySuffix
= "+4@GOTPCREL";
64 PersonalityPrefix
= "L";
65 PersonalitySuffix
= "$non_lazy_ptr";
71 SupportsDebugInformation
= true;
72 DwarfUsesInlineInfoSection
= true;
74 // Exceptions handling
75 ExceptionsType
= ExceptionHandling::Dwarf
;
76 AbsoluteEHSectionOffsets
= false;
79 X86ELFTargetAsmInfo::X86ELFTargetAsmInfo(const Triple
&Triple
) {
80 AsmTransCBE
= x86_asm_table
;
81 AssemblerDialect
= AsmWriterFlavor
;
83 PrivateGlobalPrefix
= ".L";
84 WeakRefDirective
= "\t.weak\t";
85 SetDirective
= "\t.set\t";
88 // Set up DWARF directives
89 HasLEB128
= true; // Target asm supports leb128 directives (little-endian)
92 AbsoluteDebugSectionOffsets
= true;
93 SupportsDebugInformation
= true;
95 // Exceptions handling
96 ExceptionsType
= ExceptionHandling::Dwarf
;
97 AbsoluteEHSectionOffsets
= false;
99 // On Linux we must declare when we can use a non-executable stack.
100 if (Triple
.getOS() == Triple::Linux
)
101 NonexecutableStackDirective
= "\t.section\t.note.GNU-stack,\"\",@progbits";
104 X86COFFTargetAsmInfo::X86COFFTargetAsmInfo(const Triple
&Triple
) {
105 AsmTransCBE
= x86_asm_table
;
106 AssemblerDialect
= AsmWriterFlavor
;
110 X86WinTargetAsmInfo::X86WinTargetAsmInfo(const Triple
&Triple
) {
111 AsmTransCBE
= x86_asm_table
;
112 AssemblerDialect
= AsmWriterFlavor
;
117 PrivateGlobalPrefix
= "$";
118 AlignDirective
= "\tALIGN\t";
119 ZeroDirective
= "\tdb\t";
120 ZeroDirectiveSuffix
= " dup(0)";
121 AsciiDirective
= "\tdb\t";
123 Data8bitsDirective
= "\tdb\t";
124 Data16bitsDirective
= "\tdw\t";
125 Data32bitsDirective
= "\tdd\t";
126 Data64bitsDirective
= "\tdq\t";
127 HasDotTypeDotSizeDirective
= false;
128 HasSingleParameterDotFile
= false;
130 AlignmentIsInBytes
= true;