blob: e593482c65ac4a0803d851e5eca851ce7866624e [file] [log] [blame]
Jim Laskey8e8de8f2006-09-07 22:05:02 +00001//===-- PPCTargetAsmInfo.cpp - PPC asm properties ---------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner4ee451d2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Jim Laskey8e8de8f2006-09-07 22:05:02 +00007//
8//===----------------------------------------------------------------------===//
9//
10// This file contains the declarations of the DarwinTargetAsmInfo properties.
11//
12//===----------------------------------------------------------------------===//
13
14#include "PPCTargetAsmInfo.h"
15#include "PPCTargetMachine.h"
Chris Lattnerb56dcc42006-10-05 00:35:50 +000016#include "llvm/Function.h"
Jim Laskey8e8de8f2006-09-07 22:05:02 +000017using namespace llvm;
18
Jim Laskeybf111822006-12-21 20:26:09 +000019PPCTargetAsmInfo::PPCTargetAsmInfo(const PPCTargetMachine &TM) {
Jim Laskey8e8de8f2006-09-07 22:05:02 +000020 bool isPPC64 = TM.getSubtargetImpl()->isPPC64();
Jim Laskeybf111822006-12-21 20:26:09 +000021
Jim Laskey8e8de8f2006-09-07 22:05:02 +000022 ZeroDirective = "\t.space\t";
23 SetDirective = "\t.set";
Jim Laskeyf45c25f2006-09-08 13:06:56 +000024 Data64bitsDirective = isPPC64 ? "\t.quad\t" : 0;
Jim Laskey8e8de8f2006-09-07 22:05:02 +000025 AlignmentIsInBytes = false;
Jim Laskey8e8de8f2006-09-07 22:05:02 +000026 LCOMMDirective = "\t.lcomm\t";
Jim Laskey8e8de8f2006-09-07 22:05:02 +000027 InlineAsmStart = "# InlineAsm Start";
28 InlineAsmEnd = "# InlineAsm End";
Bill Wendlingcb900992007-01-16 09:29:17 +000029 AssemblerDialect = TM.getSubtargetImpl()->getAsmFlavor();
Jim Laskey8e8de8f2006-09-07 22:05:02 +000030
Jim Laskey8e8de8f2006-09-07 22:05:02 +000031}
Chris Lattnerb56dcc42006-10-05 00:35:50 +000032
Jim Laskeybf111822006-12-21 20:26:09 +000033DarwinTargetAsmInfo::DarwinTargetAsmInfo(const PPCTargetMachine &TM)
34: PPCTargetAsmInfo(TM)
35{
Jim Laskeyb82313f2007-02-01 16:31:34 +000036 PCSymbol = ".";
Jim Laskeybf111822006-12-21 20:26:09 +000037 CommentString = ";";
38 GlobalPrefix = "_";
39 PrivateGlobalPrefix = "L";
40 ConstantPoolSection = "\t.const\t";
41 JumpTableDataSection = ".const";
42 CStringSection = "\t.cstring";
Evan Cheng98ded762007-03-08 01:25:25 +000043 FourByteConstantSection = "\t.literal4\n";
44 EightByteConstantSection = "\t.literal8\n";
45 ReadOnlySection = "\t.const\n";
Evan Chengb267ca12007-01-30 08:04:53 +000046 if (TM.getRelocationModel() == Reloc::Static) {
47 StaticCtorsSection = ".constructor";
48 StaticDtorsSection = ".destructor";
49 } else {
50 StaticCtorsSection = ".mod_init_func";
51 StaticDtorsSection = ".mod_term_func";
52 }
Jim Laskeybf111822006-12-21 20:26:09 +000053 UsedDirective = "\t.no_dead_strip\t";
Dale Johannesen038129d2008-01-10 02:03:30 +000054 WeakDefDirective = "\t.weak_definition ";
55 WeakRefDirective = "\t.weak_reference ";
Dale Johannesenc7406ae2008-01-11 00:54:37 +000056 HiddenDirective = "\t.private_extern ";
Dale Johannesen696f7682007-12-19 21:54:36 +000057 SupportsExceptionHandling = true;
Bill Wendlingfe4afb12007-09-11 23:55:40 +000058 NeedsIndirectEncoding = true;
Nicolas Geoffray616585b2007-12-21 12:19:44 +000059 NeedsSet = true;
Nick Lewyckyf4c164c2007-11-04 17:32:10 +000060 BSSSection = 0;
Nicolas Geoffray616585b2007-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";
Dale Johannesen038129d2008-01-10 02:03:30 +000065 GlobalEHDirective = "\t.globl\t";
66 SupportsWeakOmittedEHFrame = false;
Nick Lewyckye2b90522007-07-25 03:48:45 +000067
68 DwarfAbbrevSection = ".section __DWARF,__debug_abbrev,regular,debug";
69 DwarfInfoSection = ".section __DWARF,__debug_info,regular,debug";
70 DwarfLineSection = ".section __DWARF,__debug_line,regular,debug";
71 DwarfFrameSection = ".section __DWARF,__debug_frame,regular,debug";
72 DwarfPubNamesSection = ".section __DWARF,__debug_pubnames,regular,debug";
73 DwarfPubTypesSection = ".section __DWARF,__debug_pubtypes,regular,debug";
74 DwarfStrSection = ".section __DWARF,__debug_str,regular,debug";
75 DwarfLocSection = ".section __DWARF,__debug_loc,regular,debug";
76 DwarfARangesSection = ".section __DWARF,__debug_aranges,regular,debug";
77 DwarfRangesSection = ".section __DWARF,__debug_ranges,regular,debug";
78 DwarfMacInfoSection = ".section __DWARF,__debug_macinfo,regular,debug";
Chris Lattnerb266ccd2007-01-18 01:15:58 +000079
80 // In non-PIC modes, emit a special label before jump tables so that the
81 // linker can perform more accurate dead code stripping.
82 if (TM.getRelocationModel() != Reloc::PIC_) {
83 // Emit a local label that is preserved until the linker runs.
84 JumpTableSpecialLabelPrefix = "l";
85 }
Jim Laskeybf111822006-12-21 20:26:09 +000086}
87
88LinuxTargetAsmInfo::LinuxTargetAsmInfo(const PPCTargetMachine &TM)
89: PPCTargetAsmInfo(TM)
90{
91 CommentString = "#";
92 GlobalPrefix = "";
93 PrivateGlobalPrefix = "";
94 ConstantPoolSection = "\t.section .rodata.cst4\t";
95 JumpTableDataSection = ".section .rodata.cst4";
96 CStringSection = "\t.section\t.rodata";
97 StaticCtorsSection = ".section\t.ctors,\"aw\",@progbits";
98 StaticDtorsSection = ".section\t.dtors,\"aw\",@progbits";
99 UsedDirective = "\t# .no_dead_strip\t";
100 WeakRefDirective = "\t.weak\t";
Nick Lewyckyf4c164c2007-11-04 17:32:10 +0000101 BSSSection = "\t.section\t\".sbss\",\"aw\",@nobits";
Nick Lewyckye2b90522007-07-25 03:48:45 +0000102
Nicolas Geoffray616585b2007-12-21 12:19:44 +0000103 // Debug Information
104 AbsoluteDebugSectionOffsets = true;
105 SupportsDebugInformation = true;
Nick Lewyckye2b90522007-07-25 03:48:45 +0000106 DwarfAbbrevSection = "\t.section\t.debug_abbrev,\"\",@progbits";
107 DwarfInfoSection = "\t.section\t.debug_info,\"\",@progbits";
108 DwarfLineSection = "\t.section\t.debug_line,\"\",@progbits";
109 DwarfFrameSection = "\t.section\t.debug_frame,\"\",@progbits";
110 DwarfPubNamesSection ="\t.section\t.debug_pubnames,\"\",@progbits";
111 DwarfPubTypesSection ="\t.section\t.debug_pubtypes,\"\",@progbits";
112 DwarfStrSection = "\t.section\t.debug_str,\"\",@progbits";
113 DwarfLocSection = "\t.section\t.debug_loc,\"\",@progbits";
114 DwarfARangesSection = "\t.section\t.debug_aranges,\"\",@progbits";
115 DwarfRangesSection = "\t.section\t.debug_ranges,\"\",@progbits";
116 DwarfMacInfoSection = "\t.section\t.debug_macinfo,\"\",@progbits";
Nicolas Geoffray616585b2007-12-21 12:19:44 +0000117
118 ReadOnlySection = "\t.section\t.rodata";
119 FourByteConstantSection = "\t.section\t.rodata.cst4,\"aM\",@progbits,4";
120 EightByteConstantSection = "\t.section\t.rodata.cst8,\"aM\",@progbits,8";
121 SixteenByteConstantSection = "\t.section\t.rodata.cst16,\"aM\",@progbits,16";
122 PCSymbol = ".";
123
124 // Set up DWARF directives
125 HasLEB128 = true; // Target asm supports leb128 directives (little-endian)
126
127 // Exceptions handling
128 if (!TM.getSubtargetImpl()->isPPC64())
129 SupportsExceptionHandling = true;
130 AbsoluteEHSectionOffsets = false;
131 DwarfEHFrameSection = "\t.section\t.eh_frame,\"aw\",@progbits";
132 DwarfExceptionSection = "\t.section\t.gcc_except_table,\"a\",@progbits";
Jim Laskeybf111822006-12-21 20:26:09 +0000133}