Hanle i8 returns
[llvm/msp430.git] / lib / Target / PowerPC / PPCTargetAsmInfo.cpp
blobc69e591a6632d81eab00925033c17dc3e1e22c74
1 //===-- PPCTargetAsmInfo.cpp - PPC asm properties ---------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file contains the declarations of the DarwinTargetAsmInfo properties.
12 //===----------------------------------------------------------------------===//
14 #include "PPCTargetAsmInfo.h"
15 #include "PPCTargetMachine.h"
16 #include "llvm/Function.h"
17 #include "llvm/Support/Dwarf.h"
19 using namespace llvm;
20 using namespace llvm::dwarf;
22 PPCDarwinTargetAsmInfo::PPCDarwinTargetAsmInfo(const PPCTargetMachine &TM):
23 PPCTargetAsmInfo<DarwinTargetAsmInfo>(TM) {
24 PCSymbol = ".";
25 CommentString = ";";
26 GlobalPrefix = "_";
27 PrivateGlobalPrefix = "L";
28 LessPrivateGlobalPrefix = "l";
29 StringConstantPrefix = "\1LC";
30 ConstantPoolSection = "\t.const\t";
31 JumpTableDataSection = ".const";
32 CStringSection = "\t.cstring";
33 if (TM.getRelocationModel() == Reloc::Static) {
34 StaticCtorsSection = ".constructor";
35 StaticDtorsSection = ".destructor";
36 } else {
37 StaticCtorsSection = ".mod_init_func";
38 StaticDtorsSection = ".mod_term_func";
40 HasSingleParameterDotFile = false;
41 SwitchToSectionDirective = "\t.section ";
42 UsedDirective = "\t.no_dead_strip\t";
43 WeakDefDirective = "\t.weak_definition ";
44 WeakRefDirective = "\t.weak_reference ";
45 HiddenDirective = "\t.private_extern ";
46 SupportsExceptionHandling = true;
47 NeedsIndirectEncoding = true;
48 NeedsSet = true;
49 BSSSection = 0;
51 DwarfEHFrameSection =
52 ".section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support";
53 DwarfExceptionSection = ".section __DATA,__gcc_except_tab";
54 GlobalEHDirective = "\t.globl\t";
55 SupportsWeakOmittedEHFrame = false;
57 DwarfAbbrevSection = ".section __DWARF,__debug_abbrev,regular,debug";
58 DwarfInfoSection = ".section __DWARF,__debug_info,regular,debug";
59 DwarfLineSection = ".section __DWARF,__debug_line,regular,debug";
60 DwarfFrameSection = ".section __DWARF,__debug_frame,regular,debug";
61 DwarfPubNamesSection = ".section __DWARF,__debug_pubnames,regular,debug";
62 DwarfPubTypesSection = ".section __DWARF,__debug_pubtypes,regular,debug";
63 DwarfStrSection = ".section __DWARF,__debug_str,regular,debug";
64 DwarfLocSection = ".section __DWARF,__debug_loc,regular,debug";
65 DwarfARangesSection = ".section __DWARF,__debug_aranges,regular,debug";
66 DwarfRangesSection = ".section __DWARF,__debug_ranges,regular,debug";
67 DwarfMacInfoSection = ".section __DWARF,__debug_macinfo,regular,debug";
69 // In non-PIC modes, emit a special label before jump tables so that the
70 // linker can perform more accurate dead code stripping.
71 if (TM.getRelocationModel() != Reloc::PIC_) {
72 // Emit a local label that is preserved until the linker runs.
73 JumpTableSpecialLabelPrefix = "l";
77 /// PreferredEHDataFormat - This hook allows the target to select data
78 /// format used for encoding pointers in exception handling data. Reason is
79 /// 0 for data, 1 for code labels, 2 for function pointers. Global is true
80 /// if the symbol can be relocated.
81 unsigned
82 PPCDarwinTargetAsmInfo::PreferredEHDataFormat(DwarfEncoding::Target Reason,
83 bool Global) const {
84 if (Reason == DwarfEncoding::Functions && Global)
85 return (DW_EH_PE_pcrel | DW_EH_PE_indirect | DW_EH_PE_sdata4);
86 else if (Reason == DwarfEncoding::CodeLabels || !Global)
87 return DW_EH_PE_pcrel;
88 else
89 return DW_EH_PE_absptr;
92 const char *
93 PPCDarwinTargetAsmInfo::getEHGlobalPrefix() const
95 const PPCSubtarget* Subtarget = &TM.getSubtarget<PPCSubtarget>();
96 if (Subtarget->getDarwinVers() > 9)
97 return PrivateGlobalPrefix;
98 else
99 return "";
102 PPCLinuxTargetAsmInfo::PPCLinuxTargetAsmInfo(const PPCTargetMachine &TM) :
103 PPCTargetAsmInfo<ELFTargetAsmInfo>(TM) {
104 CommentString = "#";
105 GlobalPrefix = "";
106 PrivateGlobalPrefix = ".L";
107 ConstantPoolSection = "\t.section .rodata.cst4\t";
108 JumpTableDataSection = ".section .rodata.cst4";
109 CStringSection = ".rodata.str";
110 StaticCtorsSection = ".section\t.ctors,\"aw\",@progbits";
111 StaticDtorsSection = ".section\t.dtors,\"aw\",@progbits";
112 UsedDirective = "\t# .no_dead_strip\t";
113 WeakRefDirective = "\t.weak\t";
114 BSSSection = "\t.section\t\".sbss\",\"aw\",@nobits";
116 // PPC/Linux normally uses named section for BSS.
117 BSSSection_ = getNamedSection("\t.bss",
118 SectionFlags::Writeable | SectionFlags::BSS,
119 /* Override */ true);
121 // Debug Information
122 AbsoluteDebugSectionOffsets = true;
123 SupportsDebugInformation = true;
124 DwarfAbbrevSection = "\t.section\t.debug_abbrev,\"\",@progbits";
125 DwarfInfoSection = "\t.section\t.debug_info,\"\",@progbits";
126 DwarfLineSection = "\t.section\t.debug_line,\"\",@progbits";
127 DwarfFrameSection = "\t.section\t.debug_frame,\"\",@progbits";
128 DwarfPubNamesSection ="\t.section\t.debug_pubnames,\"\",@progbits";
129 DwarfPubTypesSection ="\t.section\t.debug_pubtypes,\"\",@progbits";
130 DwarfStrSection = "\t.section\t.debug_str,\"\",@progbits";
131 DwarfLocSection = "\t.section\t.debug_loc,\"\",@progbits";
132 DwarfARangesSection = "\t.section\t.debug_aranges,\"\",@progbits";
133 DwarfRangesSection = "\t.section\t.debug_ranges,\"\",@progbits";
134 DwarfMacInfoSection = "\t.section\t.debug_macinfo,\"\",@progbits";
136 PCSymbol = ".";
138 // Set up DWARF directives
139 HasLEB128 = true; // Target asm supports leb128 directives (little-endian)
141 // Exceptions handling
142 if (!TM.getSubtargetImpl()->isPPC64())
143 SupportsExceptionHandling = true;
144 AbsoluteEHSectionOffsets = false;
145 DwarfEHFrameSection = "\t.section\t.eh_frame,\"aw\",@progbits";
146 DwarfExceptionSection = "\t.section\t.gcc_except_table,\"a\",@progbits";
149 /// PreferredEHDataFormat - This hook allows the target to select data
150 /// format used for encoding pointers in exception handling data. Reason is
151 /// 0 for data, 1 for code labels, 2 for function pointers. Global is true
152 /// if the symbol can be relocated.
153 unsigned
154 PPCLinuxTargetAsmInfo::PreferredEHDataFormat(DwarfEncoding::Target Reason,
155 bool Global) const {
156 // We really need to write something here.
157 return TargetAsmInfo::PreferredEHDataFormat(Reason, Global);
160 // Instantiate default implementation.
161 TEMPLATE_INSTANTIATION(class PPCTargetAsmInfo<TargetAsmInfo>);