1 //===-- PPCTargetAsmInfo.cpp - PPC asm properties ---------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file contains the declarations of the DarwinTargetAsmInfo properties.
12 //===----------------------------------------------------------------------===//
14 #include "PPCTargetAsmInfo.h"
15 #include "PPCTargetMachine.h"
16 #include "llvm/Function.h"
19 PPCTargetAsmInfo::PPCTargetAsmInfo(const PPCTargetMachine
&TM
) {
20 bool isPPC64
= TM
.getSubtargetImpl()->isPPC64();
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();
33 DarwinTargetAsmInfo::DarwinTargetAsmInfo(const PPCTargetMachine
&TM
)
34 : PPCTargetAsmInfo(TM
)
39 PrivateGlobalPrefix
= "L";
40 ConstantPoolSection
= "\t.const\t";
41 JumpTableDataSection
= ".const";
42 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";
50 StaticCtorsSection
= ".mod_init_func";
51 StaticDtorsSection
= ".mod_term_func";
53 SwitchToSectionDirective
= "\t.section ";
54 UsedDirective
= "\t.no_dead_strip\t";
55 WeakDefDirective
= "\t.weak_definition ";
56 WeakRefDirective
= "\t.weak_reference ";
57 HiddenDirective
= "\t.private_extern ";
58 SupportsExceptionHandling
= true;
59 NeedsIndirectEncoding
= true;
64 ".section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support";
65 DwarfExceptionSection
= ".section __DATA,__gcc_except_tab";
66 GlobalEHDirective
= "\t.globl\t";
67 SupportsWeakOmittedEHFrame
= false;
69 DwarfAbbrevSection
= ".section __DWARF,__debug_abbrev,regular,debug";
70 DwarfInfoSection
= ".section __DWARF,__debug_info,regular,debug";
71 DwarfLineSection
= ".section __DWARF,__debug_line,regular,debug";
72 DwarfFrameSection
= ".section __DWARF,__debug_frame,regular,debug";
73 DwarfPubNamesSection
= ".section __DWARF,__debug_pubnames,regular,debug";
74 DwarfPubTypesSection
= ".section __DWARF,__debug_pubtypes,regular,debug";
75 DwarfStrSection
= ".section __DWARF,__debug_str,regular,debug";
76 DwarfLocSection
= ".section __DWARF,__debug_loc,regular,debug";
77 DwarfARangesSection
= ".section __DWARF,__debug_aranges,regular,debug";
78 DwarfRangesSection
= ".section __DWARF,__debug_ranges,regular,debug";
79 DwarfMacInfoSection
= ".section __DWARF,__debug_macinfo,regular,debug";
81 // In non-PIC modes, emit a special label before jump tables so that the
82 // linker can perform more accurate dead code stripping.
83 if (TM
.getRelocationModel() != Reloc::PIC_
) {
84 // Emit a local label that is preserved until the linker runs.
85 JumpTableSpecialLabelPrefix
= "l";
89 LinuxTargetAsmInfo::LinuxTargetAsmInfo(const PPCTargetMachine
&TM
)
90 : PPCTargetAsmInfo(TM
)
94 PrivateGlobalPrefix
= "";
95 ConstantPoolSection
= "\t.section .rodata.cst4\t";
96 JumpTableDataSection
= ".section .rodata.cst4";
97 CStringSection
= "\t.section\t.rodata";
98 StaticCtorsSection
= ".section\t.ctors,\"aw\",@progbits";
99 StaticDtorsSection
= ".section\t.dtors,\"aw\",@progbits";
100 UsedDirective
= "\t# .no_dead_strip\t";
101 WeakRefDirective
= "\t.weak\t";
102 BSSSection
= "\t.section\t\".sbss\",\"aw\",@nobits";
105 AbsoluteDebugSectionOffsets
= true;
106 SupportsDebugInformation
= true;
107 DwarfAbbrevSection
= "\t.section\t.debug_abbrev,\"\",@progbits";
108 DwarfInfoSection
= "\t.section\t.debug_info,\"\",@progbits";
109 DwarfLineSection
= "\t.section\t.debug_line,\"\",@progbits";
110 DwarfFrameSection
= "\t.section\t.debug_frame,\"\",@progbits";
111 DwarfPubNamesSection
="\t.section\t.debug_pubnames,\"\",@progbits";
112 DwarfPubTypesSection
="\t.section\t.debug_pubtypes,\"\",@progbits";
113 DwarfStrSection
= "\t.section\t.debug_str,\"\",@progbits";
114 DwarfLocSection
= "\t.section\t.debug_loc,\"\",@progbits";
115 DwarfARangesSection
= "\t.section\t.debug_aranges,\"\",@progbits";
116 DwarfRangesSection
= "\t.section\t.debug_ranges,\"\",@progbits";
117 DwarfMacInfoSection
= "\t.section\t.debug_macinfo,\"\",@progbits";
119 ReadOnlySection
= "\t.section\t.rodata";
120 FourByteConstantSection
= "\t.section\t.rodata.cst4,\"aM\",@progbits,4";
121 EightByteConstantSection
= "\t.section\t.rodata.cst8,\"aM\",@progbits,8";
122 SixteenByteConstantSection
= "\t.section\t.rodata.cst16,\"aM\",@progbits,16";
125 // Set up DWARF directives
126 HasLEB128
= true; // Target asm supports leb128 directives (little-endian)
128 // Exceptions handling
129 if (!TM
.getSubtargetImpl()->isPPC64())
130 SupportsExceptionHandling
= true;
131 AbsoluteEHSectionOffsets
= false;
132 DwarfEHFrameSection
= "\t.section\t.eh_frame,\"aw\",@progbits";
133 DwarfExceptionSection
= "\t.section\t.gcc_except_table,\"a\",@progbits";