blob: 458c0551af75e56f7b234d182fcd608e685366ab [file] [log] [blame]
Jim Laskey8e8de8f2006-09-07 22:05:02 +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"
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
31 NeedsSet = true;
32 AddressSize = isPPC64 ? 8 : 4;
Jim Laskeyb82313f2007-02-01 16:31:34 +000033 DwarfEHFrameSection =
34 ".section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support";
Jim Laskeya15be8c2007-02-21 22:43:40 +000035 DwarfExceptionSection = ".section __DATA,__gcc_except_tab";
Jim Laskey8e8de8f2006-09-07 22:05:02 +000036}
Chris Lattnerb56dcc42006-10-05 00:35:50 +000037
Jim Laskeybf111822006-12-21 20:26:09 +000038DarwinTargetAsmInfo::DarwinTargetAsmInfo(const PPCTargetMachine &TM)
39: PPCTargetAsmInfo(TM)
40{
Jim Laskeyb82313f2007-02-01 16:31:34 +000041 PCSymbol = ".";
Jim Laskeybf111822006-12-21 20:26:09 +000042 CommentString = ";";
43 GlobalPrefix = "_";
44 PrivateGlobalPrefix = "L";
45 ConstantPoolSection = "\t.const\t";
46 JumpTableDataSection = ".const";
Jim Laskey072200c2007-01-29 18:51:14 +000047 GlobalDirective = "\t.globl\t";
Jim Laskeybf111822006-12-21 20:26:09 +000048 CStringSection = "\t.cstring";
Evan Cheng98ded762007-03-08 01:25:25 +000049 FourByteConstantSection = "\t.literal4\n";
50 EightByteConstantSection = "\t.literal8\n";
51 ReadOnlySection = "\t.const\n";
Evan Chengb267ca12007-01-30 08:04:53 +000052 if (TM.getRelocationModel() == Reloc::Static) {
53 StaticCtorsSection = ".constructor";
54 StaticDtorsSection = ".destructor";
55 } else {
56 StaticCtorsSection = ".mod_init_func";
57 StaticDtorsSection = ".mod_term_func";
58 }
Jim Laskeybf111822006-12-21 20:26:09 +000059 UsedDirective = "\t.no_dead_strip\t";
60 WeakRefDirective = "\t.weak_reference\t";
Chris Lattner70d41072007-01-14 06:37:54 +000061 HiddenDirective = "\t.private_extern\t";
Jim Laskey072200c2007-01-29 18:51:14 +000062 SupportsExceptionHandling = true;
Nick Lewyckye2b90522007-07-25 03:48:45 +000063
64 DwarfAbbrevSection = ".section __DWARF,__debug_abbrev,regular,debug";
65 DwarfInfoSection = ".section __DWARF,__debug_info,regular,debug";
66 DwarfLineSection = ".section __DWARF,__debug_line,regular,debug";
67 DwarfFrameSection = ".section __DWARF,__debug_frame,regular,debug";
68 DwarfPubNamesSection = ".section __DWARF,__debug_pubnames,regular,debug";
69 DwarfPubTypesSection = ".section __DWARF,__debug_pubtypes,regular,debug";
70 DwarfStrSection = ".section __DWARF,__debug_str,regular,debug";
71 DwarfLocSection = ".section __DWARF,__debug_loc,regular,debug";
72 DwarfARangesSection = ".section __DWARF,__debug_aranges,regular,debug";
73 DwarfRangesSection = ".section __DWARF,__debug_ranges,regular,debug";
74 DwarfMacInfoSection = ".section __DWARF,__debug_macinfo,regular,debug";
Chris Lattnerb266ccd2007-01-18 01:15:58 +000075
76 // In non-PIC modes, emit a special label before jump tables so that the
77 // linker can perform more accurate dead code stripping.
78 if (TM.getRelocationModel() != Reloc::PIC_) {
79 // Emit a local label that is preserved until the linker runs.
80 JumpTableSpecialLabelPrefix = "l";
81 }
Jim Laskeybf111822006-12-21 20:26:09 +000082}
83
84LinuxTargetAsmInfo::LinuxTargetAsmInfo(const PPCTargetMachine &TM)
85: PPCTargetAsmInfo(TM)
86{
87 CommentString = "#";
88 GlobalPrefix = "";
89 PrivateGlobalPrefix = "";
90 ConstantPoolSection = "\t.section .rodata.cst4\t";
91 JumpTableDataSection = ".section .rodata.cst4";
92 CStringSection = "\t.section\t.rodata";
93 StaticCtorsSection = ".section\t.ctors,\"aw\",@progbits";
94 StaticDtorsSection = ".section\t.dtors,\"aw\",@progbits";
95 UsedDirective = "\t# .no_dead_strip\t";
96 WeakRefDirective = "\t.weak\t";
Nick Lewyckye2b90522007-07-25 03:48:45 +000097
98 DwarfAbbrevSection = "\t.section\t.debug_abbrev,\"\",@progbits";
99 DwarfInfoSection = "\t.section\t.debug_info,\"\",@progbits";
100 DwarfLineSection = "\t.section\t.debug_line,\"\",@progbits";
101 DwarfFrameSection = "\t.section\t.debug_frame,\"\",@progbits";
102 DwarfPubNamesSection ="\t.section\t.debug_pubnames,\"\",@progbits";
103 DwarfPubTypesSection ="\t.section\t.debug_pubtypes,\"\",@progbits";
104 DwarfStrSection = "\t.section\t.debug_str,\"\",@progbits";
105 DwarfLocSection = "\t.section\t.debug_loc,\"\",@progbits";
106 DwarfARangesSection = "\t.section\t.debug_aranges,\"\",@progbits";
107 DwarfRangesSection = "\t.section\t.debug_ranges,\"\",@progbits";
108 DwarfMacInfoSection = "\t.section\t.debug_macinfo,\"\",@progbits";
Jim Laskeybf111822006-12-21 20:26:09 +0000109}