blob: 6b43ecbba5a116426c3a09e8c3483fced7a5bf43 [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001//===-- PPCTargetAsmInfo.cpp - PPC 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 DarwinTargetAsmInfo properties.
11//
12//===----------------------------------------------------------------------===//
13
14#include "PPCTargetAsmInfo.h"
15#include "PPCTargetMachine.h"
16#include "llvm/Function.h"
17using namespace llvm;
18
19PPCTargetAsmInfo::PPCTargetAsmInfo(const PPCTargetMachine &TM) {
20 bool isPPC64 = TM.getSubtargetImpl()->isPPC64();
21
22 ZeroDirective = "\t.space\t";
23 SetDirective = "\t.set";
24 Data64bitsDirective = isPPC64 ? "\t.quad\t" : 0;
25 AlignmentIsInBytes = false;
26 LCOMMDirective = "\t.lcomm\t";
27 InlineAsmStart = "# InlineAsm Start";
28 InlineAsmEnd = "# InlineAsm End";
29 AssemblerDialect = TM.getSubtargetImpl()->getAsmFlavor();
30
31 NeedsSet = true;
Dan Gohmanf17a25c2007-07-18 16:29:46 +000032 DwarfEHFrameSection =
33 ".section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support";
34 DwarfExceptionSection = ".section __DATA,__gcc_except_tab";
35}
36
37DarwinTargetAsmInfo::DarwinTargetAsmInfo(const PPCTargetMachine &TM)
38: PPCTargetAsmInfo(TM)
39{
40 PCSymbol = ".";
41 CommentString = ";";
42 GlobalPrefix = "_";
43 PrivateGlobalPrefix = "L";
44 ConstantPoolSection = "\t.const\t";
45 JumpTableDataSection = ".const";
46 GlobalDirective = "\t.globl\t";
47 CStringSection = "\t.cstring";
48 FourByteConstantSection = "\t.literal4\n";
49 EightByteConstantSection = "\t.literal8\n";
50 ReadOnlySection = "\t.const\n";
51 if (TM.getRelocationModel() == Reloc::Static) {
52 StaticCtorsSection = ".constructor";
53 StaticDtorsSection = ".destructor";
54 } else {
55 StaticCtorsSection = ".mod_init_func";
56 StaticDtorsSection = ".mod_term_func";
57 }
58 UsedDirective = "\t.no_dead_strip\t";
59 WeakRefDirective = "\t.weak_reference\t";
60 HiddenDirective = "\t.private_extern\t";
Dale Johannesenf5a11532007-11-13 19:13:01 +000061 SupportsExceptionHandling = true;
Bill Wendling909ec562007-09-11 23:55:40 +000062 NeedsIndirectEncoding = true;
Nick Lewyckyc6583752007-11-04 17:32:10 +000063 BSSSection = 0;
Nick Lewycky3246a9c2007-07-25 03:48:45 +000064
65 DwarfAbbrevSection = ".section __DWARF,__debug_abbrev,regular,debug";
66 DwarfInfoSection = ".section __DWARF,__debug_info,regular,debug";
67 DwarfLineSection = ".section __DWARF,__debug_line,regular,debug";
68 DwarfFrameSection = ".section __DWARF,__debug_frame,regular,debug";
69 DwarfPubNamesSection = ".section __DWARF,__debug_pubnames,regular,debug";
70 DwarfPubTypesSection = ".section __DWARF,__debug_pubtypes,regular,debug";
71 DwarfStrSection = ".section __DWARF,__debug_str,regular,debug";
72 DwarfLocSection = ".section __DWARF,__debug_loc,regular,debug";
73 DwarfARangesSection = ".section __DWARF,__debug_aranges,regular,debug";
74 DwarfRangesSection = ".section __DWARF,__debug_ranges,regular,debug";
75 DwarfMacInfoSection = ".section __DWARF,__debug_macinfo,regular,debug";
Dan Gohmanf17a25c2007-07-18 16:29:46 +000076
77 // In non-PIC modes, emit a special label before jump tables so that the
78 // linker can perform more accurate dead code stripping.
79 if (TM.getRelocationModel() != Reloc::PIC_) {
80 // Emit a local label that is preserved until the linker runs.
81 JumpTableSpecialLabelPrefix = "l";
82 }
83}
84
85LinuxTargetAsmInfo::LinuxTargetAsmInfo(const PPCTargetMachine &TM)
86: PPCTargetAsmInfo(TM)
87{
88 CommentString = "#";
89 GlobalPrefix = "";
90 PrivateGlobalPrefix = "";
91 ConstantPoolSection = "\t.section .rodata.cst4\t";
92 JumpTableDataSection = ".section .rodata.cst4";
93 CStringSection = "\t.section\t.rodata";
94 StaticCtorsSection = ".section\t.ctors,\"aw\",@progbits";
95 StaticDtorsSection = ".section\t.dtors,\"aw\",@progbits";
96 UsedDirective = "\t# .no_dead_strip\t";
97 WeakRefDirective = "\t.weak\t";
Nick Lewyckyc6583752007-11-04 17:32:10 +000098 BSSSection = "\t.section\t\".sbss\",\"aw\",@nobits";
Nick Lewycky3246a9c2007-07-25 03:48:45 +000099
100 DwarfAbbrevSection = "\t.section\t.debug_abbrev,\"\",@progbits";
101 DwarfInfoSection = "\t.section\t.debug_info,\"\",@progbits";
102 DwarfLineSection = "\t.section\t.debug_line,\"\",@progbits";
103 DwarfFrameSection = "\t.section\t.debug_frame,\"\",@progbits";
104 DwarfPubNamesSection ="\t.section\t.debug_pubnames,\"\",@progbits";
105 DwarfPubTypesSection ="\t.section\t.debug_pubtypes,\"\",@progbits";
106 DwarfStrSection = "\t.section\t.debug_str,\"\",@progbits";
107 DwarfLocSection = "\t.section\t.debug_loc,\"\",@progbits";
108 DwarfARangesSection = "\t.section\t.debug_aranges,\"\",@progbits";
109 DwarfRangesSection = "\t.section\t.debug_ranges,\"\",@progbits";
110 DwarfMacInfoSection = "\t.section\t.debug_macinfo,\"\",@progbits";
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000111}