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;
86 ".section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support";
89 X86ELFTargetAsmInfo::X86ELFTargetAsmInfo(const X86TargetMachine &TM) :
90 X86TargetAsmInfo<ELFTargetAsmInfo>(TM) {
92 PrivateGlobalPrefix = ".L";
93 WeakRefDirective = "\t.weak\t";
94 SetDirective = "\t.set\t";
97 // Set up DWARF directives
98 HasLEB128 = true; // Target asm supports leb128 directives (little-endian)
101 AbsoluteDebugSectionOffsets = true;
102 SupportsDebugInformation = true;
103 DwarfAbbrevSection = "\t.section\t.debug_abbrev,\"\",@progbits";
104 DwarfInfoSection = "\t.section\t.debug_info,\"\",@progbits";
105 DwarfLineSection = "\t.section\t.debug_line,\"\",@progbits";
106 DwarfFrameSection = "\t.section\t.debug_frame,\"\",@progbits";
107 DwarfPubNamesSection ="\t.section\t.debug_pubnames,\"\",@progbits";
108 DwarfPubTypesSection ="\t.section\t.debug_pubtypes,\"\",@progbits";
109 DwarfStrSection = "\t.section\t.debug_str,\"\",@progbits";
110 DwarfLocSection = "\t.section\t.debug_loc,\"\",@progbits";
111 DwarfARangesSection = "\t.section\t.debug_aranges,\"\",@progbits";
112 DwarfRangesSection = "\t.section\t.debug_ranges,\"\",@progbits";
113 DwarfMacroInfoSection = "\t.section\t.debug_macinfo,\"\",@progbits";
115 // Exceptions handling
116 SupportsExceptionHandling = true;
117 AbsoluteEHSectionOffsets = false;
118 DwarfEHFrameSection = "\t.section\t.eh_frame,\"aw\",@progbits";
120 // On Linux we must declare when we can use a non-executable stack.
121 if (TM.getSubtarget<X86Subtarget>().isLinux())
122 NonexecutableStackDirective = "\t.section\t.note.GNU-stack,\"\",@progbits";
126 X86WinTargetAsmInfo::X86WinTargetAsmInfo(const X86TargetMachine &TM):
127 X86TargetAsmInfo<TargetAsmInfo>(TM) {
131 InlineAsmStart = "; InlineAsm Start";
132 InlineAsmEnd = "; InlineAsm End";
134 PrivateGlobalPrefix = "$";
135 AlignDirective = "\tALIGN\t";
136 ZeroDirective = "\tdb\t";
137 ZeroDirectiveSuffix = " dup(0)";
138 AsciiDirective = "\tdb\t";
140 Data8bitsDirective = "\tdb\t";
141 Data16bitsDirective = "\tdw\t";
142 Data32bitsDirective = "\tdd\t";
143 Data64bitsDirective = "\tdq\t";
144 HasDotTypeDotSizeDirective = false;
145 HasSingleParameterDotFile = false;
147 AlignmentIsInBytes = true;
149 SwitchToSectionDirective = "";
150 TextSectionStartSuffix = "\tSEGMENT PARA 'CODE'";
151 DataSectionStartSuffix = "\tSEGMENT PARA 'DATA'";
152 SectionEndDirectiveSuffix = "\tends\n";
155 // Instantiate default implementation.
156 TEMPLATE_INSTANTIATION(class X86TargetAsmInfo<TargetAsmInfo>);