blob: ee1d06316ef3d2290ee4bb5821623b540dcaf330 [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;
Jim Laskeyb82313f2007-02-01 16:31:34 +000032 DwarfEHFrameSection =
33 ".section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support";
Jim Laskeya15be8c2007-02-21 22:43:40 +000034 DwarfExceptionSection = ".section __DATA,__gcc_except_tab";
Jim Laskey8e8de8f2006-09-07 22:05:02 +000035}
Chris Lattnerb56dcc42006-10-05 00:35:50 +000036
Jim Laskeybf111822006-12-21 20:26:09 +000037DarwinTargetAsmInfo::DarwinTargetAsmInfo(const PPCTargetMachine &TM)
38: PPCTargetAsmInfo(TM)
39{
Jim Laskeyb82313f2007-02-01 16:31:34 +000040 PCSymbol = ".";
Jim Laskeybf111822006-12-21 20:26:09 +000041 CommentString = ";";
42 GlobalPrefix = "_";
43 PrivateGlobalPrefix = "L";
44 ConstantPoolSection = "\t.const\t";
45 JumpTableDataSection = ".const";
46 CStringSection = "\t.cstring";
Evan Cheng98ded762007-03-08 01:25:25 +000047 FourByteConstantSection = "\t.literal4\n";
48 EightByteConstantSection = "\t.literal8\n";
49 ReadOnlySection = "\t.const\n";
Evan Chengb267ca12007-01-30 08:04:53 +000050 if (TM.getRelocationModel() == Reloc::Static) {
51 StaticCtorsSection = ".constructor";
52 StaticDtorsSection = ".destructor";
53 } else {
54 StaticCtorsSection = ".mod_init_func";
55 StaticDtorsSection = ".mod_term_func";
56 }
Jim Laskeybf111822006-12-21 20:26:09 +000057 UsedDirective = "\t.no_dead_strip\t";
Dale Johannesen1d4ce2a2007-11-20 23:24:42 +000058 WeakDefDirective = "\t.weak_definition\t";
Jim Laskeybf111822006-12-21 20:26:09 +000059 WeakRefDirective = "\t.weak_reference\t";
Chris Lattner70d41072007-01-14 06:37:54 +000060 HiddenDirective = "\t.private_extern\t";
Dale Johannesenb1d40d92007-11-13 19:16:02 +000061 SupportsExceptionHandling = false;
Bill Wendlingfe4afb12007-09-11 23:55:40 +000062 NeedsIndirectEncoding = true;
Nick Lewyckyf4c164c2007-11-04 17:32:10 +000063 BSSSection = 0;
Nick Lewyckye2b90522007-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";
Dale Johannesen1d4ce2a2007-11-20 23:24:42 +000069 GlobalEHDirective = "\t.globl\t";
Nick Lewyckye2b90522007-07-25 03:48:45 +000070 DwarfPubNamesSection = ".section __DWARF,__debug_pubnames,regular,debug";
71 DwarfPubTypesSection = ".section __DWARF,__debug_pubtypes,regular,debug";
72 DwarfStrSection = ".section __DWARF,__debug_str,regular,debug";
73 DwarfLocSection = ".section __DWARF,__debug_loc,regular,debug";
74 DwarfARangesSection = ".section __DWARF,__debug_aranges,regular,debug";
75 DwarfRangesSection = ".section __DWARF,__debug_ranges,regular,debug";
76 DwarfMacInfoSection = ".section __DWARF,__debug_macinfo,regular,debug";
Chris Lattnerb266ccd2007-01-18 01:15:58 +000077
78 // In non-PIC modes, emit a special label before jump tables so that the
79 // linker can perform more accurate dead code stripping.
80 if (TM.getRelocationModel() != Reloc::PIC_) {
81 // Emit a local label that is preserved until the linker runs.
82 JumpTableSpecialLabelPrefix = "l";
83 }
Jim Laskeybf111822006-12-21 20:26:09 +000084}
85
86LinuxTargetAsmInfo::LinuxTargetAsmInfo(const PPCTargetMachine &TM)
87: PPCTargetAsmInfo(TM)
88{
89 CommentString = "#";
90 GlobalPrefix = "";
91 PrivateGlobalPrefix = "";
92 ConstantPoolSection = "\t.section .rodata.cst4\t";
93 JumpTableDataSection = ".section .rodata.cst4";
94 CStringSection = "\t.section\t.rodata";
95 StaticCtorsSection = ".section\t.ctors,\"aw\",@progbits";
96 StaticDtorsSection = ".section\t.dtors,\"aw\",@progbits";
97 UsedDirective = "\t# .no_dead_strip\t";
98 WeakRefDirective = "\t.weak\t";
Nick Lewyckyf4c164c2007-11-04 17:32:10 +000099 BSSSection = "\t.section\t\".sbss\",\"aw\",@nobits";
Nick Lewyckye2b90522007-07-25 03:48:45 +0000100
101 DwarfAbbrevSection = "\t.section\t.debug_abbrev,\"\",@progbits";
102 DwarfInfoSection = "\t.section\t.debug_info,\"\",@progbits";
103 DwarfLineSection = "\t.section\t.debug_line,\"\",@progbits";
104 DwarfFrameSection = "\t.section\t.debug_frame,\"\",@progbits";
105 DwarfPubNamesSection ="\t.section\t.debug_pubnames,\"\",@progbits";
106 DwarfPubTypesSection ="\t.section\t.debug_pubtypes,\"\",@progbits";
107 DwarfStrSection = "\t.section\t.debug_str,\"\",@progbits";
108 DwarfLocSection = "\t.section\t.debug_loc,\"\",@progbits";
109 DwarfARangesSection = "\t.section\t.debug_aranges,\"\",@progbits";
110 DwarfRangesSection = "\t.section\t.debug_ranges,\"\",@progbits";
111 DwarfMacInfoSection = "\t.section\t.debug_macinfo,\"\",@progbits";
Jim Laskeybf111822006-12-21 20:26:09 +0000112}