blob: f90c0f78ee9ad663a9d7fa2a67bf0c996ddb5512 [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
Dan Gohmanf17a25c2007-07-18 16:29:46 +000031}
32
33DarwinTargetAsmInfo::DarwinTargetAsmInfo(const PPCTargetMachine &TM)
34: PPCTargetAsmInfo(TM)
35{
36 PCSymbol = ".";
37 CommentString = ";";
38 GlobalPrefix = "_";
39 PrivateGlobalPrefix = "L";
40 ConstantPoolSection = "\t.const\t";
41 JumpTableDataSection = ".const";
Dan Gohmanf17a25c2007-07-18 16:29:46 +000042 CStringSection = "\t.cstring";
43 FourByteConstantSection = "\t.literal4\n";
44 EightByteConstantSection = "\t.literal8\n";
45 ReadOnlySection = "\t.const\n";
46 if (TM.getRelocationModel() == Reloc::Static) {
47 StaticCtorsSection = ".constructor";
48 StaticDtorsSection = ".destructor";
49 } else {
50 StaticCtorsSection = ".mod_init_func";
51 StaticDtorsSection = ".mod_term_func";
52 }
53 UsedDirective = "\t.no_dead_strip\t";
Dale Johannesenfb3ac732007-11-20 23:24:42 +000054 WeakDefDirective = "\t.weak_definition\t";
Dan Gohmanf17a25c2007-07-18 16:29:46 +000055 WeakRefDirective = "\t.weak_reference\t";
56 HiddenDirective = "\t.private_extern\t";
Dale Johannesen15e8f532007-12-19 21:54:36 +000057 SupportsExceptionHandling = true;
Bill Wendling909ec562007-09-11 23:55:40 +000058 NeedsIndirectEncoding = true;
Nicolas Geoffray61864762007-12-21 12:19:44 +000059 NeedsSet = true;
Nick Lewyckyc6583752007-11-04 17:32:10 +000060 BSSSection = 0;
Nicolas Geoffray61864762007-12-21 12:19:44 +000061
62 DwarfEHFrameSection =
63 ".section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support";
64 DwarfExceptionSection = ".section __DATA,__gcc_except_tab";
Nick Lewycky3246a9c2007-07-25 03:48:45 +000065
66 DwarfAbbrevSection = ".section __DWARF,__debug_abbrev,regular,debug";
67 DwarfInfoSection = ".section __DWARF,__debug_info,regular,debug";
68 DwarfLineSection = ".section __DWARF,__debug_line,regular,debug";
69 DwarfFrameSection = ".section __DWARF,__debug_frame,regular,debug";
Dale Johannesenfb3ac732007-11-20 23:24:42 +000070 GlobalEHDirective = "\t.globl\t";
Nick Lewycky3246a9c2007-07-25 03:48:45 +000071 DwarfPubNamesSection = ".section __DWARF,__debug_pubnames,regular,debug";
72 DwarfPubTypesSection = ".section __DWARF,__debug_pubtypes,regular,debug";
73 DwarfStrSection = ".section __DWARF,__debug_str,regular,debug";
74 DwarfLocSection = ".section __DWARF,__debug_loc,regular,debug";
75 DwarfARangesSection = ".section __DWARF,__debug_aranges,regular,debug";
76 DwarfRangesSection = ".section __DWARF,__debug_ranges,regular,debug";
77 DwarfMacInfoSection = ".section __DWARF,__debug_macinfo,regular,debug";
Dan Gohmanf17a25c2007-07-18 16:29:46 +000078
79 // In non-PIC modes, emit a special label before jump tables so that the
80 // linker can perform more accurate dead code stripping.
81 if (TM.getRelocationModel() != Reloc::PIC_) {
82 // Emit a local label that is preserved until the linker runs.
83 JumpTableSpecialLabelPrefix = "l";
84 }
85}
86
87LinuxTargetAsmInfo::LinuxTargetAsmInfo(const PPCTargetMachine &TM)
88: PPCTargetAsmInfo(TM)
89{
90 CommentString = "#";
91 GlobalPrefix = "";
92 PrivateGlobalPrefix = "";
93 ConstantPoolSection = "\t.section .rodata.cst4\t";
94 JumpTableDataSection = ".section .rodata.cst4";
95 CStringSection = "\t.section\t.rodata";
96 StaticCtorsSection = ".section\t.ctors,\"aw\",@progbits";
97 StaticDtorsSection = ".section\t.dtors,\"aw\",@progbits";
98 UsedDirective = "\t# .no_dead_strip\t";
99 WeakRefDirective = "\t.weak\t";
Nick Lewyckyc6583752007-11-04 17:32:10 +0000100 BSSSection = "\t.section\t\".sbss\",\"aw\",@nobits";
Nick Lewycky3246a9c2007-07-25 03:48:45 +0000101
Nicolas Geoffray61864762007-12-21 12:19:44 +0000102 // Debug Information
103 AbsoluteDebugSectionOffsets = true;
104 SupportsDebugInformation = true;
Nick Lewycky3246a9c2007-07-25 03:48:45 +0000105 DwarfAbbrevSection = "\t.section\t.debug_abbrev,\"\",@progbits";
106 DwarfInfoSection = "\t.section\t.debug_info,\"\",@progbits";
107 DwarfLineSection = "\t.section\t.debug_line,\"\",@progbits";
108 DwarfFrameSection = "\t.section\t.debug_frame,\"\",@progbits";
109 DwarfPubNamesSection ="\t.section\t.debug_pubnames,\"\",@progbits";
110 DwarfPubTypesSection ="\t.section\t.debug_pubtypes,\"\",@progbits";
111 DwarfStrSection = "\t.section\t.debug_str,\"\",@progbits";
112 DwarfLocSection = "\t.section\t.debug_loc,\"\",@progbits";
113 DwarfARangesSection = "\t.section\t.debug_aranges,\"\",@progbits";
114 DwarfRangesSection = "\t.section\t.debug_ranges,\"\",@progbits";
115 DwarfMacInfoSection = "\t.section\t.debug_macinfo,\"\",@progbits";
Nicolas Geoffray61864762007-12-21 12:19:44 +0000116
117 ReadOnlySection = "\t.section\t.rodata";
118 FourByteConstantSection = "\t.section\t.rodata.cst4,\"aM\",@progbits,4";
119 EightByteConstantSection = "\t.section\t.rodata.cst8,\"aM\",@progbits,8";
120 SixteenByteConstantSection = "\t.section\t.rodata.cst16,\"aM\",@progbits,16";
121 PCSymbol = ".";
122
123 // Set up DWARF directives
124 HasLEB128 = true; // Target asm supports leb128 directives (little-endian)
125
126 // Exceptions handling
127 if (!TM.getSubtargetImpl()->isPPC64())
128 SupportsExceptionHandling = true;
129 AbsoluteEHSectionOffsets = false;
130 DwarfEHFrameSection = "\t.section\t.eh_frame,\"aw\",@progbits";
131 DwarfExceptionSection = "\t.section\t.gcc_except_table,\"a\",@progbits";
Dan Gohmanf17a25c2007-07-18 16:29:46 +0000132}