move getDwarfExceptionSection from TAI to TLOF and rename it to
[oota-llvm.git] / lib / Target / PowerPC / PPCTargetAsmInfo.cpp
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.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #include "PPCTargetAsmInfo.h"
15 #include "PPCTargetMachine.h"
16 #include "llvm/Function.h"
17 #include "llvm/Support/Dwarf.h"
18
19 using namespace llvm;
20 using namespace llvm::dwarf;
21
22 PPCDarwinTargetAsmInfo::PPCDarwinTargetAsmInfo(const PPCTargetMachine &TM) :
23   PPCTargetAsmInfo<DarwinTargetAsmInfo>(TM) {
24   PCSymbol = ".";
25   CommentString = ";";
26   UsedDirective = "\t.no_dead_strip\t";
27   SupportsExceptionHandling = true;
28   
29   DwarfEHFrameSection =
30    ".section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support";
31   GlobalEHDirective = "\t.globl\t";
32   SupportsWeakOmittedEHFrame = false;
33 }
34
35 const char *PPCDarwinTargetAsmInfo::getEHGlobalPrefix() const {
36   const PPCSubtarget* Subtarget = &TM.getSubtarget<PPCSubtarget>();
37   if (Subtarget->getDarwinVers() > 9)
38     return PrivateGlobalPrefix;
39   return "";
40 }
41
42 PPCLinuxTargetAsmInfo::PPCLinuxTargetAsmInfo(const PPCTargetMachine &TM) :
43   PPCTargetAsmInfo<ELFTargetAsmInfo>(TM) {
44   CommentString = "#";
45   GlobalPrefix = "";
46   PrivateGlobalPrefix = ".L";
47   UsedDirective = "\t# .no_dead_strip\t";
48   WeakRefDirective = "\t.weak\t";
49
50   // Debug Information
51   AbsoluteDebugSectionOffsets = true;
52   SupportsDebugInformation = true;
53   DwarfAbbrevSection =  "\t.section\t.debug_abbrev,\"\",@progbits";
54   DwarfInfoSection =    "\t.section\t.debug_info,\"\",@progbits";
55   DwarfLineSection =    "\t.section\t.debug_line,\"\",@progbits";
56   DwarfFrameSection =   "\t.section\t.debug_frame,\"\",@progbits";
57   DwarfPubNamesSection ="\t.section\t.debug_pubnames,\"\",@progbits";
58   DwarfPubTypesSection ="\t.section\t.debug_pubtypes,\"\",@progbits";
59   DwarfStrSection =     "\t.section\t.debug_str,\"\",@progbits";
60   DwarfLocSection =     "\t.section\t.debug_loc,\"\",@progbits";
61   DwarfARangesSection = "\t.section\t.debug_aranges,\"\",@progbits";
62   DwarfRangesSection =  "\t.section\t.debug_ranges,\"\",@progbits";
63   DwarfMacroInfoSection = "\t.section\t.debug_macinfo,\"\",@progbits";
64
65   PCSymbol = ".";
66
67   // Set up DWARF directives
68   HasLEB128 = true;  // Target asm supports leb128 directives (little-endian)
69
70   // Exceptions handling
71   if (!TM.getSubtargetImpl()->isPPC64())
72     SupportsExceptionHandling = true;
73   AbsoluteEHSectionOffsets = false;
74   DwarfEHFrameSection = "\t.section\t.eh_frame,\"aw\",@progbits";
75 }
76
77
78 // Instantiate default implementation.
79 TEMPLATE_INSTANTIATION(class PPCTargetAsmInfo<TargetAsmInfo>);