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 "X86Subtarget.h"
17 #include "llvm/DerivedTypes.h"
18 #include "llvm/InlineAsm.h"
19 #include "llvm/Instructions.h"
20 #include "llvm/Intrinsics.h"
21 #include "llvm/Module.h"
22 #include "llvm/ADT/StringExtras.h"
23 #include "llvm/Support/Dwarf.h"
24 #include "llvm/Support/ErrorHandling.h"
27 using namespace llvm::dwarf;
29 const char *const llvm::x86_asm_table[] = {
41 X86DarwinTargetAsmInfo::X86DarwinTargetAsmInfo(const X86TargetMachine &TM):
42 X86TargetAsmInfo<DarwinTargetAsmInfo>(TM) {
43 const X86Subtarget *Subtarget = &TM.getSubtarget<X86Subtarget>();
44 bool is64Bit = Subtarget->is64Bit();
46 AlignmentIsInBytes = false;
47 TextAlignFillValue = 0x90;
51 Data64bitsDirective = 0; // we can't emit a 64-bit unit
52 ZeroDirective = "\t.space\t"; // ".space N" emits N zeros.
53 ZeroFillDirective = "\t.zerofill\t"; // Uses .zerofill
54 LCOMMDirective = "\t.lcomm\t";
56 // Leopard and above support aligned common symbols.
57 COMMDirectiveTakesAlignment = (Subtarget->getDarwinVers() >= 9);
58 HasDotTypeDotSizeDirective = false;
61 PersonalityPrefix = "";
62 PersonalitySuffix = "+4@GOTPCREL";
64 PersonalityPrefix = "L";
65 PersonalitySuffix = "$non_lazy_ptr";
68 InlineAsmStart = "## InlineAsm Start";
69 InlineAsmEnd = "## InlineAsm End";
71 SetDirective = "\t.set";
73 UsedDirective = "\t.no_dead_strip\t";
74 ProtectedDirective = "\t.globl\t";
76 SupportsDebugInformation = true;
77 DwarfUsesInlineInfoSection = true;
79 // Exceptions handling
80 ExceptionsType = ExceptionHandling::Dwarf;
81 GlobalEHDirective = "\t.globl\t";
82 SupportsWeakOmittedEHFrame = false;
83 AbsoluteEHSectionOffsets = false;
86 X86ELFTargetAsmInfo::X86ELFTargetAsmInfo(const X86TargetMachine &TM) :
87 X86TargetAsmInfo<TargetAsmInfo>(TM) {
89 PrivateGlobalPrefix = ".L";
90 WeakRefDirective = "\t.weak\t";
91 SetDirective = "\t.set\t";
94 // Set up DWARF directives
95 HasLEB128 = true; // Target asm supports leb128 directives (little-endian)
98 AbsoluteDebugSectionOffsets = true;
99 SupportsDebugInformation = true;
101 // Exceptions handling
102 ExceptionsType = ExceptionHandling::Dwarf;
103 AbsoluteEHSectionOffsets = false;
105 // On Linux we must declare when we can use a non-executable stack.
106 if (TM.getSubtarget<X86Subtarget>().isLinux())
107 NonexecutableStackDirective = "\t.section\t.note.GNU-stack,\"\",@progbits";
111 X86WinTargetAsmInfo::X86WinTargetAsmInfo(const X86TargetMachine &TM):
112 X86TargetAsmInfo<TargetAsmInfo>(TM) {
116 InlineAsmStart = "; InlineAsm Start";
117 InlineAsmEnd = "; InlineAsm End";
119 PrivateGlobalPrefix = "$";
120 AlignDirective = "\tALIGN\t";
121 ZeroDirective = "\tdb\t";
122 ZeroDirectiveSuffix = " dup(0)";
123 AsciiDirective = "\tdb\t";
125 Data8bitsDirective = "\tdb\t";
126 Data16bitsDirective = "\tdw\t";
127 Data32bitsDirective = "\tdd\t";
128 Data64bitsDirective = "\tdq\t";
129 HasDotTypeDotSizeDirective = false;
130 HasSingleParameterDotFile = false;
132 AlignmentIsInBytes = true;
135 // Instantiate default implementation.
136 TEMPLATE_INSTANTIATION(class X86TargetAsmInfo<TargetAsmInfo>);