blob: bdda9909f4a9a52a932365cb4f6c34b6adcdc62d [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 Laskey5059dda2006-10-17 11:30:57 +000033 DwarfAbbrevSection = ".section __DWARF,__debug_abbrev,regular,debug";
34 DwarfInfoSection = ".section __DWARF,__debug_info,regular,debug";
35 DwarfLineSection = ".section __DWARF,__debug_line,regular,debug";
36 DwarfFrameSection = ".section __DWARF,__debug_frame,regular,debug";
37 DwarfPubNamesSection = ".section __DWARF,__debug_pubnames,regular,debug";
38 DwarfPubTypesSection = ".section __DWARF,__debug_pubtypes,regular,debug";
39 DwarfStrSection = ".section __DWARF,__debug_str,regular,debug";
40 DwarfLocSection = ".section __DWARF,__debug_loc,regular,debug";
41 DwarfARangesSection = ".section __DWARF,__debug_aranges,regular,debug";
42 DwarfRangesSection = ".section __DWARF,__debug_ranges,regular,debug";
43 DwarfMacInfoSection = ".section __DWARF,__debug_macinfo,regular,debug";
Jim Laskeyb82313f2007-02-01 16:31:34 +000044 DwarfEHFrameSection =
45 ".section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support";
Jim Laskeya15be8c2007-02-21 22:43:40 +000046 DwarfExceptionSection = ".section __DATA,__gcc_except_tab";
Jim Laskey8e8de8f2006-09-07 22:05:02 +000047}
Chris Lattnerb56dcc42006-10-05 00:35:50 +000048
Jim Laskeybf111822006-12-21 20:26:09 +000049DarwinTargetAsmInfo::DarwinTargetAsmInfo(const PPCTargetMachine &TM)
50: PPCTargetAsmInfo(TM)
51{
Jim Laskeyb82313f2007-02-01 16:31:34 +000052 PCSymbol = ".";
Jim Laskeybf111822006-12-21 20:26:09 +000053 CommentString = ";";
54 GlobalPrefix = "_";
55 PrivateGlobalPrefix = "L";
56 ConstantPoolSection = "\t.const\t";
57 JumpTableDataSection = ".const";
Jim Laskey072200c2007-01-29 18:51:14 +000058 GlobalDirective = "\t.globl\t";
Jim Laskeybf111822006-12-21 20:26:09 +000059 CStringSection = "\t.cstring";
Evan Chengb267ca12007-01-30 08:04:53 +000060 if (TM.getRelocationModel() == Reloc::Static) {
61 StaticCtorsSection = ".constructor";
62 StaticDtorsSection = ".destructor";
63 } else {
64 StaticCtorsSection = ".mod_init_func";
65 StaticDtorsSection = ".mod_term_func";
66 }
Jim Laskeybf111822006-12-21 20:26:09 +000067 UsedDirective = "\t.no_dead_strip\t";
68 WeakRefDirective = "\t.weak_reference\t";
Chris Lattner70d41072007-01-14 06:37:54 +000069 HiddenDirective = "\t.private_extern\t";
Jim Laskey072200c2007-01-29 18:51:14 +000070 SupportsExceptionHandling = true;
Chris Lattnerb266ccd2007-01-18 01:15:58 +000071
72 // In non-PIC modes, emit a special label before jump tables so that the
73 // linker can perform more accurate dead code stripping.
74 if (TM.getRelocationModel() != Reloc::PIC_) {
75 // Emit a local label that is preserved until the linker runs.
76 JumpTableSpecialLabelPrefix = "l";
77 }
Jim Laskeybf111822006-12-21 20:26:09 +000078}
79
80LinuxTargetAsmInfo::LinuxTargetAsmInfo(const PPCTargetMachine &TM)
81: PPCTargetAsmInfo(TM)
82{
83 CommentString = "#";
84 GlobalPrefix = "";
85 PrivateGlobalPrefix = "";
86 ConstantPoolSection = "\t.section .rodata.cst4\t";
87 JumpTableDataSection = ".section .rodata.cst4";
88 CStringSection = "\t.section\t.rodata";
89 StaticCtorsSection = ".section\t.ctors,\"aw\",@progbits";
90 StaticDtorsSection = ".section\t.dtors,\"aw\",@progbits";
91 UsedDirective = "\t# .no_dead_strip\t";
92 WeakRefDirective = "\t.weak\t";
93}