Fix for PR1095:
[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 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"
16 #include "llvm/Function.h"
17 using namespace llvm;
18
19 // ASM variant to use.
20 enum {
21   PPC_OLD_MNEMONICS = 0,
22   PPC_NEW_MNEMONICS = 1
23 };
24
25 PPCTargetAsmInfo::PPCTargetAsmInfo(const PPCTargetMachine &TM) {
26   bool isPPC64 = TM.getSubtargetImpl()->isPPC64();
27   
28   ZeroDirective = "\t.space\t";
29   SetDirective = "\t.set";
30   Data64bitsDirective = isPPC64 ? "\t.quad\t" : 0;  
31   AlignmentIsInBytes = false;
32   LCOMMDirective = "\t.lcomm\t";
33   InlineAsmStart = "# InlineAsm Start";
34   InlineAsmEnd = "# InlineAsm End";
35   AssemblerDialect = PPC_OLD_MNEMONICS;
36   
37   NeedsSet = true;
38   AddressSize = isPPC64 ? 8 : 4;
39   DwarfAbbrevSection = ".section __DWARF,__debug_abbrev,regular,debug";
40   DwarfInfoSection = ".section __DWARF,__debug_info,regular,debug";
41   DwarfLineSection = ".section __DWARF,__debug_line,regular,debug";
42   DwarfFrameSection = ".section __DWARF,__debug_frame,regular,debug";
43   DwarfPubNamesSection = ".section __DWARF,__debug_pubnames,regular,debug";
44   DwarfPubTypesSection = ".section __DWARF,__debug_pubtypes,regular,debug";
45   DwarfStrSection = ".section __DWARF,__debug_str,regular,debug";
46   DwarfLocSection = ".section __DWARF,__debug_loc,regular,debug";
47   DwarfARangesSection = ".section __DWARF,__debug_aranges,regular,debug";
48   DwarfRangesSection = ".section __DWARF,__debug_ranges,regular,debug";
49   DwarfMacInfoSection = ".section __DWARF,__debug_macinfo,regular,debug";
50 }
51
52 DarwinTargetAsmInfo::DarwinTargetAsmInfo(const PPCTargetMachine &TM)
53 : PPCTargetAsmInfo(TM)
54 {
55   CommentString = ";";
56   GlobalPrefix = "_";
57   PrivateGlobalPrefix = "L";
58   ConstantPoolSection = "\t.const\t";
59   JumpTableDataSection = ".const";
60   CStringSection = "\t.cstring";
61   StaticCtorsSection = ".mod_init_func";
62   StaticDtorsSection = ".mod_term_func";
63   UsedDirective = "\t.no_dead_strip\t";
64   WeakRefDirective = "\t.weak_reference\t";
65   HiddenDirective = "\t.private_extern\t";
66   AssemblerDialect = PPC_NEW_MNEMONICS;
67 }
68
69 LinuxTargetAsmInfo::LinuxTargetAsmInfo(const PPCTargetMachine &TM)
70 : PPCTargetAsmInfo(TM)
71 {
72   CommentString = "#";
73   GlobalPrefix = "";
74   PrivateGlobalPrefix = "";
75   ConstantPoolSection = "\t.section .rodata.cst4\t";
76   JumpTableDataSection = ".section .rodata.cst4";
77   CStringSection = "\t.section\t.rodata";
78   StaticCtorsSection = ".section\t.ctors,\"aw\",@progbits";
79   StaticDtorsSection = ".section\t.dtors,\"aw\",@progbits";
80   UsedDirective = "\t# .no_dead_strip\t";
81   WeakRefDirective = "\t.weak\t";
82 }