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 DwarfDebugInlineSection = ".section __DWARF,__debug_inlined,regular,debug";
78 DwarfUsesInlineInfoSection = true;
80 // Exceptions handling
81 SupportsExceptionHandling = true;
82 GlobalEHDirective = "\t.globl\t";
83 SupportsWeakOmittedEHFrame = false;
84 AbsoluteEHSectionOffsets = false;
87 X86ELFTargetAsmInfo::X86ELFTargetAsmInfo(const X86TargetMachine &TM) :
88 X86TargetAsmInfo<TargetAsmInfo>(TM) {
90 PrivateGlobalPrefix = ".L";
91 WeakRefDirective = "\t.weak\t";
92 SetDirective = "\t.set\t";
95 // Set up DWARF directives
96 HasLEB128 = true; // Target asm supports leb128 directives (little-endian)
99 AbsoluteDebugSectionOffsets = true;
100 SupportsDebugInformation = true;
101 DwarfAbbrevSection = "\t.section\t.debug_abbrev,\"\",@progbits";
102 DwarfInfoSection = "\t.section\t.debug_info,\"\",@progbits";
103 DwarfLineSection = "\t.section\t.debug_line,\"\",@progbits";
104 DwarfFrameSection = "\t.section\t.debug_frame,\"\",@progbits";
105 DwarfPubNamesSection ="\t.section\t.debug_pubnames,\"\",@progbits";
106 DwarfPubTypesSection ="\t.section\t.debug_pubtypes,\"\",@progbits";
107 DwarfStrSection = "\t.section\t.debug_str,\"\",@progbits";
108 DwarfLocSection = "\t.section\t.debug_loc,\"\",@progbits";
109 DwarfARangesSection = "\t.section\t.debug_aranges,\"\",@progbits";
110 DwarfRangesSection = "\t.section\t.debug_ranges,\"\",@progbits";
111 DwarfMacroInfoSection = "\t.section\t.debug_macinfo,\"\",@progbits";
113 // Exceptions handling
114 SupportsExceptionHandling = true;
115 AbsoluteEHSectionOffsets = false;
117 // On Linux we must declare when we can use a non-executable stack.
118 if (TM.getSubtarget<X86Subtarget>().isLinux())
119 NonexecutableStackDirective = "\t.section\t.note.GNU-stack,\"\",@progbits";
123 X86WinTargetAsmInfo::X86WinTargetAsmInfo(const X86TargetMachine &TM):
124 X86TargetAsmInfo<TargetAsmInfo>(TM) {
128 InlineAsmStart = "; InlineAsm Start";
129 InlineAsmEnd = "; InlineAsm End";
131 PrivateGlobalPrefix = "$";
132 AlignDirective = "\tALIGN\t";
133 ZeroDirective = "\tdb\t";
134 ZeroDirectiveSuffix = " dup(0)";
135 AsciiDirective = "\tdb\t";
137 Data8bitsDirective = "\tdb\t";
138 Data16bitsDirective = "\tdw\t";
139 Data32bitsDirective = "\tdd\t";
140 Data64bitsDirective = "\tdq\t";
141 HasDotTypeDotSizeDirective = false;
142 HasSingleParameterDotFile = false;
144 AlignmentIsInBytes = true;
146 SwitchToSectionDirective = "";
147 TextSectionStartSuffix = "\tSEGMENT PARA 'CODE'";
148 DataSectionStartSuffix = "\tSEGMENT PARA 'DATA'";
149 SectionEndDirectiveSuffix = "\tends\n";
152 // Instantiate default implementation.
153 TEMPLATE_INSTANTIATION(class X86TargetAsmInfo<TargetAsmInfo>);