bde8f90dbd2d71406fb98d352e113f0e847ecd94
[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   DwarfExceptionSection = ".section __DATA,__gcc_except_tab";
32   GlobalEHDirective = "\t.globl\t";
33   SupportsWeakOmittedEHFrame = false;
34 }
35
36 const char *PPCDarwinTargetAsmInfo::getEHGlobalPrefix() const {
37   const PPCSubtarget* Subtarget = &TM.getSubtarget<PPCSubtarget>();
38   if (Subtarget->getDarwinVers() > 9)
39     return PrivateGlobalPrefix;
40   return "";
41 }
42
43 PPCLinuxTargetAsmInfo::PPCLinuxTargetAsmInfo(const PPCTargetMachine &TM) :
44   PPCTargetAsmInfo<ELFTargetAsmInfo>(TM) {
45   CommentString = "#";
46   GlobalPrefix = "";
47   PrivateGlobalPrefix = ".L";
48   StaticCtorsSection = ".section\t.ctors,\"aw\",@progbits";
49   StaticDtorsSection = ".section\t.dtors,\"aw\",@progbits";
50   UsedDirective = "\t# .no_dead_strip\t";
51   WeakRefDirective = "\t.weak\t";
52
53   // Debug Information
54   AbsoluteDebugSectionOffsets = true;
55   SupportsDebugInformation = true;
56   DwarfAbbrevSection =  "\t.section\t.debug_abbrev,\"\",@progbits";
57   DwarfInfoSection =    "\t.section\t.debug_info,\"\",@progbits";
58   DwarfLineSection =    "\t.section\t.debug_line,\"\",@progbits";
59   DwarfFrameSection =   "\t.section\t.debug_frame,\"\",@progbits";
60   DwarfPubNamesSection ="\t.section\t.debug_pubnames,\"\",@progbits";
61   DwarfPubTypesSection ="\t.section\t.debug_pubtypes,\"\",@progbits";
62   DwarfStrSection =     "\t.section\t.debug_str,\"\",@progbits";
63   DwarfLocSection =     "\t.section\t.debug_loc,\"\",@progbits";
64   DwarfARangesSection = "\t.section\t.debug_aranges,\"\",@progbits";
65   DwarfRangesSection =  "\t.section\t.debug_ranges,\"\",@progbits";
66   DwarfMacroInfoSection = "\t.section\t.debug_macinfo,\"\",@progbits";
67
68   PCSymbol = ".";
69
70   // Set up DWARF directives
71   HasLEB128 = true;  // Target asm supports leb128 directives (little-endian)
72
73   // Exceptions handling
74   if (!TM.getSubtargetImpl()->isPPC64())
75     SupportsExceptionHandling = true;
76   AbsoluteEHSectionOffsets = false;
77   DwarfEHFrameSection = "\t.section\t.eh_frame,\"aw\",@progbits";
78   DwarfExceptionSection = "\t.section\t.gcc_except_table,\"a\",@progbits";
79 }
80
81
82 // Instantiate default implementation.
83 TEMPLATE_INSTANTIATION(class PPCTargetAsmInfo<TargetAsmInfo>);