blob: 196348b9e9c7b4ca0b5611c81a6519fe0fdef37d [file] [log] [blame]
Jim Laskey8e8de8f2006-09-07 22:05:02 +00001//===-- ARMTargetAsmInfo.cpp - ARM 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 ARMTargetAsmInfo properties.
11//
12//===----------------------------------------------------------------------===//
13
14#include "ARMTargetAsmInfo.h"
Evan Chenga8e29892007-01-19 07:51:42 +000015#include "ARMTargetMachine.h"
Dale Johannesen24fb52d2007-04-23 20:04:35 +000016#include <cstring>
17#include <cctype>
Jim Laskey8e8de8f2006-09-07 22:05:02 +000018using namespace llvm;
19
20ARMTargetAsmInfo::ARMTargetAsmInfo(const ARMTargetMachine &TM) {
Evan Chenga8e29892007-01-19 07:51:42 +000021 const ARMSubtarget *Subtarget = &TM.getSubtarget<ARMSubtarget>();
Evan Chenge433ea92007-01-19 19:23:47 +000022 if (Subtarget->isTargetDarwin()) {
Evan Chenga8e29892007-01-19 07:51:42 +000023 GlobalPrefix = "_";
Evan Chenge433ea92007-01-19 19:23:47 +000024 PrivateGlobalPrefix = "L";
25 BSSSection = 0; // no BSS section.
26 ZeroFillDirective = "\t.zerofill\t"; // Uses .zerofill
Evan Chenga8e29892007-01-19 07:51:42 +000027 SetDirective = "\t.set";
28 WeakRefDirective = "\t.weak_reference\t";
Evan Chenga6f567c2007-01-23 19:06:03 +000029 HiddenDirective = "\t.private_extern\t";
Evan Chenga8e29892007-01-19 07:51:42 +000030 JumpTableDataSection = ".const";
31 CStringSection = "\t.cstring";
Evan Cheng98ded762007-03-08 01:25:25 +000032 FourByteConstantSection = "\t.literal4\n";
33 EightByteConstantSection = "\t.literal8\n";
34 ReadOnlySection = "\t.const\n";
Evan Chenge433ea92007-01-19 19:23:47 +000035 HasDotTypeDotSizeDirective = false;
Evan Chengb267ca12007-01-30 08:04:53 +000036 if (TM.getRelocationModel() == Reloc::Static) {
37 StaticCtorsSection = ".constructor";
38 StaticDtorsSection = ".destructor";
39 } else {
40 StaticCtorsSection = ".mod_init_func";
41 StaticDtorsSection = ".mod_term_func";
42 }
Evan Chenga8e29892007-01-19 07:51:42 +000043
Evan Cheng8e1185b2007-01-19 18:59:56 +000044 // In non-PIC modes, emit a special label before jump tables so that the
45 // linker can perform more accurate dead code stripping.
46 if (TM.getRelocationModel() != Reloc::PIC_) {
47 // Emit a local label that is preserved until the linker runs.
48 JumpTableSpecialLabelPrefix = "l";
49 }
50
Evan Chenga8e29892007-01-19 07:51:42 +000051 NeedsSet = true;
52 DwarfAbbrevSection = ".section __DWARF,__debug_abbrev,regular,debug";
53 DwarfInfoSection = ".section __DWARF,__debug_info,regular,debug";
54 DwarfLineSection = ".section __DWARF,__debug_line,regular,debug";
55 DwarfFrameSection = ".section __DWARF,__debug_frame,regular,debug";
56 DwarfPubNamesSection = ".section __DWARF,__debug_pubnames,regular,debug";
57 DwarfPubTypesSection = ".section __DWARF,__debug_pubtypes,regular,debug";
58 DwarfStrSection = ".section __DWARF,__debug_str,regular,debug";
59 DwarfLocSection = ".section __DWARF,__debug_loc,regular,debug";
60 DwarfARangesSection = ".section __DWARF,__debug_aranges,regular,debug";
61 DwarfRangesSection = ".section __DWARF,__debug_ranges,regular,debug";
62 DwarfMacInfoSection = ".section __DWARF,__debug_macinfo,regular,debug";
63 } else {
Lauro Ramos Venancioc33f6742007-02-01 21:43:53 +000064 PrivateGlobalPrefix = ".L";
Evan Chenga8e29892007-01-19 07:51:42 +000065 WeakRefDirective = "\t.weak\t";
Lauro Ramos Venancio6d7dd8e2007-03-05 17:59:58 +000066 if (Subtarget->isAAPCS_ABI()) {
67 StaticCtorsSection = "\t.section .init_array,\"aw\",%init_array";
68 StaticDtorsSection = "\t.section .fini_array,\"aw\",%fini_array";
69 } else {
70 StaticCtorsSection = "\t.section .ctors,\"aw\",%progbits";
71 StaticDtorsSection = "\t.section .dtors,\"aw\",%progbits";
72 }
Lauro Ramos Venancio64f4fa52007-04-27 13:54:47 +000073 TLSDataSection = "\t.section .tdata,\"awT\",%progbits";
74 TLSBSSSection = "\t.section .tbss,\"awT\",%nobits";
Evan Chenga8e29892007-01-19 07:51:42 +000075 }
Lauro Ramos Venancioea9fc582007-01-26 23:24:43 +000076
77 ZeroDirective = "\t.space\t";
78 AlignmentIsInBytes = false;
Jim Laskey8e8de8f2006-09-07 22:05:02 +000079 Data64bitsDirective = 0;
Jim Laskey8e8de8f2006-09-07 22:05:02 +000080 CommentString = "@";
Evan Chenga8e29892007-01-19 07:51:42 +000081 DataSection = "\t.data";
Jim Laskey8e8de8f2006-09-07 22:05:02 +000082 ConstantPoolSection = "\t.text\n";
Lauro Ramos Venancioea9fc582007-01-26 23:24:43 +000083 COMMDirectiveTakesAlignment = false;
84 InlineAsmStart = "@ InlineAsm Start";
85 InlineAsmEnd = "@ InlineAsm End";
86 LCOMMDirective = "\t.lcomm\t";
Dale Johannesen24fb52d2007-04-23 20:04:35 +000087 isThumb = Subtarget->isThumb();
Jim Laskey8e8de8f2006-09-07 22:05:02 +000088}