blob: e67773711cbe07875d561550903170cad403be60 [file] [log] [blame]
Jim Laskey8e8de8f2006-09-07 22:05:02 +00001//===-- X86TargetAsmInfo.cpp - X86 asm properties ---------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
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.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file contains the declarations of the X86TargetAsmInfo properties.
11//
12//===----------------------------------------------------------------------===//
13
14#include "X86TargetAsmInfo.h"
15#include "X86TargetMachine.h"
16#include "X86Subtarget.h"
17
18using namespace llvm;
19
20X86TargetAsmInfo::X86TargetAsmInfo(const X86TargetMachine &TM) {
21 const X86Subtarget *Subtarget = &TM.getSubtarget<X86Subtarget>();
22
Chris Lattnerafbfded2006-10-05 02:43:52 +000023 // FIXME - Should be simplified.
Jim Laskey8e8de8f2006-09-07 22:05:02 +000024
25 switch (Subtarget->TargetType) {
26 case X86Subtarget::isDarwin:
27 AlignmentIsInBytes = false;
28 GlobalPrefix = "_";
Evan Cheng25ab6902006-09-08 06:48:29 +000029 if (!Subtarget->is64Bit())
30 Data64bitsDirective = 0; // we can't emit a 64-bit unit
Jim Laskey8e8de8f2006-09-07 22:05:02 +000031 ZeroDirective = "\t.space\t"; // ".space N" emits N zeros.
32 PrivateGlobalPrefix = "L"; // Marker for constant pool idxs
33 ConstantPoolSection = "\t.const\n";
Chris Lattnerafbfded2006-10-05 02:43:52 +000034 JumpTableDataSection = "\t.const\n";
Evan Cheng8910c1c2006-10-26 19:18:18 +000035 CStringSection = "\t.cstring";
Jim Laskey8e8de8f2006-09-07 22:05:02 +000036 FourByteConstantSection = "\t.literal4\n";
37 EightByteConstantSection = "\t.literal8\n";
Evan Cheng25ab6902006-09-08 06:48:29 +000038 if (Subtarget->is64Bit())
39 SixteenByteConstantSection = "\t.literal16\n";
Jim Laskey8e8de8f2006-09-07 22:05:02 +000040 LCOMMDirective = "\t.lcomm\t";
41 COMMDirectiveTakesAlignment = false;
42 HasDotTypeDotSizeDirective = false;
43 StaticCtorsSection = ".mod_init_func";
44 StaticDtorsSection = ".mod_term_func";
45 InlineAsmStart = "# InlineAsm Start";
46 InlineAsmEnd = "# InlineAsm End";
47 SetDirective = "\t.set";
Chris Lattnera53115b2006-09-26 03:39:53 +000048 UsedDirective = "\t.no_dead_strip\t";
Jim Laskey8e8de8f2006-09-07 22:05:02 +000049
50 NeedsSet = true;
51 DwarfAbbrevSection = ".section __DWARF,__debug_abbrev,regular,debug";
52 DwarfInfoSection = ".section __DWARF,__debug_info,regular,debug";
53 DwarfLineSection = ".section __DWARF,__debug_line,regular,debug";
54 DwarfFrameSection = ".section __DWARF,__debug_frame,regular,debug";
55 DwarfPubNamesSection = ".section __DWARF,__debug_pubnames,regular,debug";
56 DwarfPubTypesSection = ".section __DWARF,__debug_pubtypes,regular,debug";
57 DwarfStrSection = ".section __DWARF,__debug_str,regular,debug";
58 DwarfLocSection = ".section __DWARF,__debug_loc,regular,debug";
59 DwarfARangesSection = ".section __DWARF,__debug_aranges,regular,debug";
60 DwarfRangesSection = ".section __DWARF,__debug_ranges,regular,debug";
61 DwarfMacInfoSection = ".section __DWARF,__debug_macinfo,regular,debug";
62 break;
63 case X86Subtarget::isCygwin:
64 GlobalPrefix = "_";
65 COMMDirectiveTakesAlignment = false;
66 HasDotTypeDotSizeDirective = false;
67 StaticCtorsSection = "\t.section .ctors,\"aw\"";
68 StaticDtorsSection = "\t.section .dtors,\"aw\"";
69 break;
70 case X86Subtarget::isWindows:
71 GlobalPrefix = "_";
72 HasDotTypeDotSizeDirective = false;
73 break;
74 default: break;
75 }
76
77 if (Subtarget->isFlavorIntel()) {
78 GlobalPrefix = "_";
79 CommentString = ";";
80
81 PrivateGlobalPrefix = "$";
82 AlignDirective = "\talign\t";
83 ZeroDirective = "\tdb\t";
84 ZeroDirectiveSuffix = " dup(0)";
85 AsciiDirective = "\tdb\t";
86 AscizDirective = 0;
87 Data8bitsDirective = "\tdb\t";
88 Data16bitsDirective = "\tdw\t";
89 Data32bitsDirective = "\tdd\t";
90 Data64bitsDirective = "\tdq\t";
91 HasDotTypeDotSizeDirective = false;
92
93 TextSection = "_text";
94 DataSection = "_data";
95 SwitchToSectionDirective = "";
96 TextSectionStartSuffix = "\tsegment 'CODE'";
97 DataSectionStartSuffix = "\tsegment 'DATA'";
98 SectionEndDirectiveSuffix = "\tends\n";
99 }
100}
Chris Lattnerafbfded2006-10-05 02:43:52 +0000101