Jim Laskey | 8e8de8f | 2006-09-07 22:05:02 +0000 | [diff] [blame] | 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" |
Chris Lattner | b56dcc4 | 2006-10-05 00:35:50 +0000 | [diff] [blame] | 16 | #include "llvm/Function.h" |
Jim Laskey | 8e8de8f | 2006-09-07 22:05:02 +0000 | [diff] [blame] | 17 | using namespace llvm; |
| 18 | |
Jim Laskey | bf11182 | 2006-12-21 20:26:09 +0000 | [diff] [blame] | 19 | PPCTargetAsmInfo::PPCTargetAsmInfo(const PPCTargetMachine &TM) { |
Jim Laskey | 8e8de8f | 2006-09-07 22:05:02 +0000 | [diff] [blame] | 20 | bool isPPC64 = TM.getSubtargetImpl()->isPPC64(); |
Jim Laskey | bf11182 | 2006-12-21 20:26:09 +0000 | [diff] [blame] | 21 | |
Jim Laskey | 8e8de8f | 2006-09-07 22:05:02 +0000 | [diff] [blame] | 22 | ZeroDirective = "\t.space\t"; |
| 23 | SetDirective = "\t.set"; |
Jim Laskey | f45c25f | 2006-09-08 13:06:56 +0000 | [diff] [blame] | 24 | Data64bitsDirective = isPPC64 ? "\t.quad\t" : 0; |
Jim Laskey | 8e8de8f | 2006-09-07 22:05:02 +0000 | [diff] [blame] | 25 | AlignmentIsInBytes = false; |
Jim Laskey | 8e8de8f | 2006-09-07 22:05:02 +0000 | [diff] [blame] | 26 | LCOMMDirective = "\t.lcomm\t"; |
Jim Laskey | 8e8de8f | 2006-09-07 22:05:02 +0000 | [diff] [blame] | 27 | InlineAsmStart = "# InlineAsm Start"; |
| 28 | InlineAsmEnd = "# InlineAsm End"; |
Bill Wendling | cb90099 | 2007-01-16 09:29:17 +0000 | [diff] [blame] | 29 | AssemblerDialect = TM.getSubtargetImpl()->getAsmFlavor(); |
Jim Laskey | 8e8de8f | 2006-09-07 22:05:02 +0000 | [diff] [blame] | 30 | |
| 31 | NeedsSet = true; |
| 32 | AddressSize = isPPC64 ? 8 : 4; |
Jim Laskey | b82313f | 2007-02-01 16:31:34 +0000 | [diff] [blame] | 33 | DwarfEHFrameSection = |
| 34 | ".section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support"; |
Jim Laskey | a15be8c | 2007-02-21 22:43:40 +0000 | [diff] [blame] | 35 | DwarfExceptionSection = ".section __DATA,__gcc_except_tab"; |
Jim Laskey | 8e8de8f | 2006-09-07 22:05:02 +0000 | [diff] [blame] | 36 | } |
Chris Lattner | b56dcc4 | 2006-10-05 00:35:50 +0000 | [diff] [blame] | 37 | |
Jim Laskey | bf11182 | 2006-12-21 20:26:09 +0000 | [diff] [blame] | 38 | DarwinTargetAsmInfo::DarwinTargetAsmInfo(const PPCTargetMachine &TM) |
| 39 | : PPCTargetAsmInfo(TM) |
| 40 | { |
Jim Laskey | b82313f | 2007-02-01 16:31:34 +0000 | [diff] [blame] | 41 | PCSymbol = "."; |
Jim Laskey | bf11182 | 2006-12-21 20:26:09 +0000 | [diff] [blame] | 42 | CommentString = ";"; |
| 43 | GlobalPrefix = "_"; |
| 44 | PrivateGlobalPrefix = "L"; |
| 45 | ConstantPoolSection = "\t.const\t"; |
| 46 | JumpTableDataSection = ".const"; |
Jim Laskey | 072200c | 2007-01-29 18:51:14 +0000 | [diff] [blame] | 47 | GlobalDirective = "\t.globl\t"; |
Jim Laskey | bf11182 | 2006-12-21 20:26:09 +0000 | [diff] [blame] | 48 | CStringSection = "\t.cstring"; |
Evan Cheng | 98ded76 | 2007-03-08 01:25:25 +0000 | [diff] [blame] | 49 | FourByteConstantSection = "\t.literal4\n"; |
| 50 | EightByteConstantSection = "\t.literal8\n"; |
| 51 | ReadOnlySection = "\t.const\n"; |
Evan Cheng | b267ca1 | 2007-01-30 08:04:53 +0000 | [diff] [blame] | 52 | if (TM.getRelocationModel() == Reloc::Static) { |
| 53 | StaticCtorsSection = ".constructor"; |
| 54 | StaticDtorsSection = ".destructor"; |
| 55 | } else { |
| 56 | StaticCtorsSection = ".mod_init_func"; |
| 57 | StaticDtorsSection = ".mod_term_func"; |
| 58 | } |
Jim Laskey | bf11182 | 2006-12-21 20:26:09 +0000 | [diff] [blame] | 59 | UsedDirective = "\t.no_dead_strip\t"; |
| 60 | WeakRefDirective = "\t.weak_reference\t"; |
Chris Lattner | 70d4107 | 2007-01-14 06:37:54 +0000 | [diff] [blame] | 61 | HiddenDirective = "\t.private_extern\t"; |
Chris Lattner | 90e167a | 2007-08-24 16:00:15 +0000 | [diff] [blame] | 62 | SupportsExceptionHandling = false; |
Bill Wendling | fe4afb1 | 2007-09-11 23:55:40 +0000 | [diff] [blame^] | 63 | NeedsIndirectEncoding = true; |
Nick Lewycky | e2b9052 | 2007-07-25 03:48:45 +0000 | [diff] [blame] | 64 | |
| 65 | DwarfAbbrevSection = ".section __DWARF,__debug_abbrev,regular,debug"; |
| 66 | DwarfInfoSection = ".section __DWARF,__debug_info,regular,debug"; |
| 67 | DwarfLineSection = ".section __DWARF,__debug_line,regular,debug"; |
| 68 | DwarfFrameSection = ".section __DWARF,__debug_frame,regular,debug"; |
| 69 | DwarfPubNamesSection = ".section __DWARF,__debug_pubnames,regular,debug"; |
| 70 | DwarfPubTypesSection = ".section __DWARF,__debug_pubtypes,regular,debug"; |
| 71 | DwarfStrSection = ".section __DWARF,__debug_str,regular,debug"; |
| 72 | DwarfLocSection = ".section __DWARF,__debug_loc,regular,debug"; |
| 73 | DwarfARangesSection = ".section __DWARF,__debug_aranges,regular,debug"; |
| 74 | DwarfRangesSection = ".section __DWARF,__debug_ranges,regular,debug"; |
| 75 | DwarfMacInfoSection = ".section __DWARF,__debug_macinfo,regular,debug"; |
Chris Lattner | b266ccd | 2007-01-18 01:15:58 +0000 | [diff] [blame] | 76 | |
| 77 | // In non-PIC modes, emit a special label before jump tables so that the |
| 78 | // linker can perform more accurate dead code stripping. |
| 79 | if (TM.getRelocationModel() != Reloc::PIC_) { |
| 80 | // Emit a local label that is preserved until the linker runs. |
| 81 | JumpTableSpecialLabelPrefix = "l"; |
| 82 | } |
Jim Laskey | bf11182 | 2006-12-21 20:26:09 +0000 | [diff] [blame] | 83 | } |
| 84 | |
| 85 | LinuxTargetAsmInfo::LinuxTargetAsmInfo(const PPCTargetMachine &TM) |
| 86 | : PPCTargetAsmInfo(TM) |
| 87 | { |
| 88 | CommentString = "#"; |
| 89 | GlobalPrefix = ""; |
| 90 | PrivateGlobalPrefix = ""; |
| 91 | ConstantPoolSection = "\t.section .rodata.cst4\t"; |
| 92 | JumpTableDataSection = ".section .rodata.cst4"; |
| 93 | CStringSection = "\t.section\t.rodata"; |
| 94 | StaticCtorsSection = ".section\t.ctors,\"aw\",@progbits"; |
| 95 | StaticDtorsSection = ".section\t.dtors,\"aw\",@progbits"; |
| 96 | UsedDirective = "\t# .no_dead_strip\t"; |
| 97 | WeakRefDirective = "\t.weak\t"; |
Nick Lewycky | e2b9052 | 2007-07-25 03:48:45 +0000 | [diff] [blame] | 98 | |
| 99 | DwarfAbbrevSection = "\t.section\t.debug_abbrev,\"\",@progbits"; |
| 100 | DwarfInfoSection = "\t.section\t.debug_info,\"\",@progbits"; |
| 101 | DwarfLineSection = "\t.section\t.debug_line,\"\",@progbits"; |
| 102 | DwarfFrameSection = "\t.section\t.debug_frame,\"\",@progbits"; |
| 103 | DwarfPubNamesSection ="\t.section\t.debug_pubnames,\"\",@progbits"; |
| 104 | DwarfPubTypesSection ="\t.section\t.debug_pubtypes,\"\",@progbits"; |
| 105 | DwarfStrSection = "\t.section\t.debug_str,\"\",@progbits"; |
| 106 | DwarfLocSection = "\t.section\t.debug_loc,\"\",@progbits"; |
| 107 | DwarfARangesSection = "\t.section\t.debug_aranges,\"\",@progbits"; |
| 108 | DwarfRangesSection = "\t.section\t.debug_ranges,\"\",@progbits"; |
| 109 | DwarfMacInfoSection = "\t.section\t.debug_macinfo,\"\",@progbits"; |
Jim Laskey | bf11182 | 2006-12-21 20:26:09 +0000 | [diff] [blame] | 110 | } |