1 //===-- X86TargetAsmInfo.cpp - X86 asm properties ---------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by James M. Laskey and is distributed under the
6 // University of Illinois Open Source 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"
20 static const char* x86_asm_table[] = {"{si}", "S",
31 X86TargetAsmInfo::X86TargetAsmInfo(const X86TargetMachine &TM) {
32 const X86Subtarget *Subtarget = &TM.getSubtarget<X86Subtarget>();
34 // FIXME - Should be simplified.
36 AsmTransCBE = x86_asm_table;
38 switch (Subtarget->TargetType) {
39 case X86Subtarget::isDarwin:
40 AlignmentIsInBytes = false;
42 if (!Subtarget->is64Bit())
43 Data64bitsDirective = 0; // we can't emit a 64-bit unit
44 ZeroDirective = "\t.space\t"; // ".space N" emits N zeros.
45 PrivateGlobalPrefix = "L"; // Marker for constant pool idxs
46 ConstantPoolSection = "\t.const\n";
47 JumpTableDataSection = "\t.const\n";
48 CStringSection = "\t.cstring";
49 FourByteConstantSection = "\t.literal4\n";
50 EightByteConstantSection = "\t.literal8\n";
51 if (Subtarget->is64Bit())
52 SixteenByteConstantSection = "\t.literal16\n";
53 LCOMMDirective = "\t.lcomm\t";
54 COMMDirectiveTakesAlignment = false;
55 HasDotTypeDotSizeDirective = false;
56 StaticCtorsSection = ".mod_init_func";
57 StaticDtorsSection = ".mod_term_func";
58 InlineAsmStart = "# InlineAsm Start";
59 InlineAsmEnd = "# InlineAsm End";
60 SetDirective = "\t.set";
61 UsedDirective = "\t.no_dead_strip\t";
64 DwarfAbbrevSection = ".section __DWARF,__debug_abbrev,regular,debug";
65 DwarfInfoSection = ".section __DWARF,__debug_info,regular,debug";
66 DwarfLineSection = ".section __DWARF,__debug_line,regular,debug";
67 DwarfFrameSection = ".section __DWARF,__debug_frame,regular,debug";
68 DwarfPubNamesSection = ".section __DWARF,__debug_pubnames,regular,debug";
69 DwarfPubTypesSection = ".section __DWARF,__debug_pubtypes,regular,debug";
70 DwarfStrSection = ".section __DWARF,__debug_str,regular,debug";
71 DwarfLocSection = ".section __DWARF,__debug_loc,regular,debug";
72 DwarfARangesSection = ".section __DWARF,__debug_aranges,regular,debug";
73 DwarfRangesSection = ".section __DWARF,__debug_ranges,regular,debug";
74 DwarfMacInfoSection = ".section __DWARF,__debug_macinfo,regular,debug";
77 case X86Subtarget::isELF:
78 // Set up DWARF directives
79 HasLEB128 = true; // Target asm supports leb128 directives (little-endian)
80 // bool HasLEB128; // Defaults to false.
81 // hasDotLoc - True if target asm supports .loc directives.
82 // bool HasDotLoc; // Defaults to false.
83 // HasDotFile - True if target asm supports .file directives.
84 // bool HasDotFile; // Defaults to false.
85 PrivateGlobalPrefix = "."; // Prefix for private global symbols
86 DwarfRequiresFrameSection = false;
87 DwarfAbbrevSection = "\t.section\t.debug_abbrev,\"\",@progbits";
88 DwarfInfoSection = "\t.section\t.debug_info,\"\",@progbits";
89 DwarfLineSection = "\t.section\t.debug_line,\"\",@progbits";
90 DwarfFrameSection = "\t.section\t.debug_frame,\"\",@progbits";
91 DwarfPubNamesSection ="\t.section\t.debug_pubnames,\"\",@progbits";
92 DwarfPubTypesSection ="\t.section\t.debug_pubtypes,\"\",@progbits";
93 DwarfStrSection = "\t.section\t.debug_str,\"\",@progbits";
94 DwarfLocSection = "\t.section\t.debug_loc,\"\",@progbits";
95 DwarfARangesSection = "\t.section\t.debug_aranges,\"\",@progbits";
96 DwarfRangesSection = "\t.section\t.debug_ranges,\"\",@progbits";
97 DwarfMacInfoSection = "\t.section\t.debug_macinfo,\"\",@progbits";
100 case X86Subtarget::isCygwin:
102 COMMDirectiveTakesAlignment = false;
103 HasDotTypeDotSizeDirective = false;
104 StaticCtorsSection = "\t.section .ctors,\"aw\"";
105 StaticDtorsSection = "\t.section .dtors,\"aw\"";
107 // Set up DWARF directives
108 HasLEB128 = true; // Target asm supports leb128 directives (little-endian)
109 PrivateGlobalPrefix = "L"; // Prefix for private global symbols
110 DwarfRequiresFrameSection = false;
111 DwarfAbbrevSection = "\t.section\t.debug_abbrev,\"dr\"";
112 DwarfInfoSection = "\t.section\t.debug_info,\"dr\"";
113 DwarfLineSection = "\t.section\t.debug_line,\"dr\"";
114 DwarfFrameSection = "\t.section\t.debug_frame,\"dr\"";
115 DwarfPubNamesSection ="\t.section\t.debug_pubnames,\"dr\"";
116 DwarfPubTypesSection ="\t.section\t.debug_pubtypes,\"dr\"";
117 DwarfStrSection = "\t.section\t.debug_str,\"dr\"";
118 DwarfLocSection = "\t.section\t.debug_loc,\"dr\"";
119 DwarfARangesSection = "\t.section\t.debug_aranges,\"dr\"";
120 DwarfRangesSection = "\t.section\t.debug_ranges,\"dr\"";
121 DwarfMacInfoSection = "\t.section\t.debug_macinfo,\"dr\"";
125 case X86Subtarget::isWindows:
127 HasDotTypeDotSizeDirective = false;
132 if (Subtarget->isFlavorIntel()) {
136 PrivateGlobalPrefix = "$";
137 AlignDirective = "\talign\t";
138 ZeroDirective = "\tdb\t";
139 ZeroDirectiveSuffix = " dup(0)";
140 AsciiDirective = "\tdb\t";
142 Data8bitsDirective = "\tdb\t";
143 Data16bitsDirective = "\tdw\t";
144 Data32bitsDirective = "\tdd\t";
145 Data64bitsDirective = "\tdq\t";
146 HasDotTypeDotSizeDirective = false;
148 TextSection = "_text";
149 DataSection = "_data";
150 SwitchToSectionDirective = "";
151 TextSectionStartSuffix = "\tsegment 'CODE'";
152 DataSectionStartSuffix = "\tsegment 'DATA'";
153 SectionEndDirectiveSuffix = "\tends\n";