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 | // |
Chris Lattner | 4ee451d | 2007-12-29 20:36:04 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Jim Laskey | 8e8de8f | 2006-09-07 22:05:02 +0000 | [diff] [blame] | 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 | |
Jim Laskey | 8e8de8f | 2006-09-07 22:05:02 +0000 | [diff] [blame] | 31 | } |
Chris Lattner | b56dcc4 | 2006-10-05 00:35:50 +0000 | [diff] [blame] | 32 | |
Jim Laskey | bf11182 | 2006-12-21 20:26:09 +0000 | [diff] [blame] | 33 | DarwinTargetAsmInfo::DarwinTargetAsmInfo(const PPCTargetMachine &TM) |
| 34 | : PPCTargetAsmInfo(TM) |
| 35 | { |
Jim Laskey | b82313f | 2007-02-01 16:31:34 +0000 | [diff] [blame] | 36 | PCSymbol = "."; |
Jim Laskey | bf11182 | 2006-12-21 20:26:09 +0000 | [diff] [blame] | 37 | CommentString = ";"; |
| 38 | GlobalPrefix = "_"; |
| 39 | PrivateGlobalPrefix = "L"; |
| 40 | ConstantPoolSection = "\t.const\t"; |
| 41 | JumpTableDataSection = ".const"; |
| 42 | CStringSection = "\t.cstring"; |
Evan Cheng | 98ded76 | 2007-03-08 01:25:25 +0000 | [diff] [blame] | 43 | FourByteConstantSection = "\t.literal4\n"; |
| 44 | EightByteConstantSection = "\t.literal8\n"; |
| 45 | ReadOnlySection = "\t.const\n"; |
Evan Cheng | b267ca1 | 2007-01-30 08:04:53 +0000 | [diff] [blame] | 46 | if (TM.getRelocationModel() == Reloc::Static) { |
| 47 | StaticCtorsSection = ".constructor"; |
| 48 | StaticDtorsSection = ".destructor"; |
| 49 | } else { |
| 50 | StaticCtorsSection = ".mod_init_func"; |
| 51 | StaticDtorsSection = ".mod_term_func"; |
| 52 | } |
Jim Laskey | bf11182 | 2006-12-21 20:26:09 +0000 | [diff] [blame] | 53 | UsedDirective = "\t.no_dead_strip\t"; |
Dale Johannesen | 038129d | 2008-01-10 02:03:30 +0000 | [diff] [blame] | 54 | WeakDefDirective = "\t.weak_definition "; |
| 55 | WeakRefDirective = "\t.weak_reference "; |
Dale Johannesen | c7406ae | 2008-01-11 00:54:37 +0000 | [diff] [blame^] | 56 | HiddenDirective = "\t.private_extern "; |
Dale Johannesen | 696f768 | 2007-12-19 21:54:36 +0000 | [diff] [blame] | 57 | SupportsExceptionHandling = true; |
Bill Wendling | fe4afb1 | 2007-09-11 23:55:40 +0000 | [diff] [blame] | 58 | NeedsIndirectEncoding = true; |
Nicolas Geoffray | 616585b | 2007-12-21 12:19:44 +0000 | [diff] [blame] | 59 | NeedsSet = true; |
Nick Lewycky | f4c164c | 2007-11-04 17:32:10 +0000 | [diff] [blame] | 60 | BSSSection = 0; |
Nicolas Geoffray | 616585b | 2007-12-21 12:19:44 +0000 | [diff] [blame] | 61 | |
| 62 | DwarfEHFrameSection = |
| 63 | ".section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support"; |
| 64 | DwarfExceptionSection = ".section __DATA,__gcc_except_tab"; |
Dale Johannesen | 038129d | 2008-01-10 02:03:30 +0000 | [diff] [blame] | 65 | GlobalEHDirective = "\t.globl\t"; |
| 66 | SupportsWeakOmittedEHFrame = false; |
Nick Lewycky | e2b9052 | 2007-07-25 03:48:45 +0000 | [diff] [blame] | 67 | |
| 68 | DwarfAbbrevSection = ".section __DWARF,__debug_abbrev,regular,debug"; |
| 69 | DwarfInfoSection = ".section __DWARF,__debug_info,regular,debug"; |
| 70 | DwarfLineSection = ".section __DWARF,__debug_line,regular,debug"; |
| 71 | DwarfFrameSection = ".section __DWARF,__debug_frame,regular,debug"; |
| 72 | DwarfPubNamesSection = ".section __DWARF,__debug_pubnames,regular,debug"; |
| 73 | DwarfPubTypesSection = ".section __DWARF,__debug_pubtypes,regular,debug"; |
| 74 | DwarfStrSection = ".section __DWARF,__debug_str,regular,debug"; |
| 75 | DwarfLocSection = ".section __DWARF,__debug_loc,regular,debug"; |
| 76 | DwarfARangesSection = ".section __DWARF,__debug_aranges,regular,debug"; |
| 77 | DwarfRangesSection = ".section __DWARF,__debug_ranges,regular,debug"; |
| 78 | DwarfMacInfoSection = ".section __DWARF,__debug_macinfo,regular,debug"; |
Chris Lattner | b266ccd | 2007-01-18 01:15:58 +0000 | [diff] [blame] | 79 | |
| 80 | // In non-PIC modes, emit a special label before jump tables so that the |
| 81 | // linker can perform more accurate dead code stripping. |
| 82 | if (TM.getRelocationModel() != Reloc::PIC_) { |
| 83 | // Emit a local label that is preserved until the linker runs. |
| 84 | JumpTableSpecialLabelPrefix = "l"; |
| 85 | } |
Jim Laskey | bf11182 | 2006-12-21 20:26:09 +0000 | [diff] [blame] | 86 | } |
| 87 | |
| 88 | LinuxTargetAsmInfo::LinuxTargetAsmInfo(const PPCTargetMachine &TM) |
| 89 | : PPCTargetAsmInfo(TM) |
| 90 | { |
| 91 | CommentString = "#"; |
| 92 | GlobalPrefix = ""; |
| 93 | PrivateGlobalPrefix = ""; |
| 94 | ConstantPoolSection = "\t.section .rodata.cst4\t"; |
| 95 | JumpTableDataSection = ".section .rodata.cst4"; |
| 96 | CStringSection = "\t.section\t.rodata"; |
| 97 | StaticCtorsSection = ".section\t.ctors,\"aw\",@progbits"; |
| 98 | StaticDtorsSection = ".section\t.dtors,\"aw\",@progbits"; |
| 99 | UsedDirective = "\t# .no_dead_strip\t"; |
| 100 | WeakRefDirective = "\t.weak\t"; |
Nick Lewycky | f4c164c | 2007-11-04 17:32:10 +0000 | [diff] [blame] | 101 | BSSSection = "\t.section\t\".sbss\",\"aw\",@nobits"; |
Nick Lewycky | e2b9052 | 2007-07-25 03:48:45 +0000 | [diff] [blame] | 102 | |
Nicolas Geoffray | 616585b | 2007-12-21 12:19:44 +0000 | [diff] [blame] | 103 | // Debug Information |
| 104 | AbsoluteDebugSectionOffsets = true; |
| 105 | SupportsDebugInformation = true; |
Nick Lewycky | e2b9052 | 2007-07-25 03:48:45 +0000 | [diff] [blame] | 106 | DwarfAbbrevSection = "\t.section\t.debug_abbrev,\"\",@progbits"; |
| 107 | DwarfInfoSection = "\t.section\t.debug_info,\"\",@progbits"; |
| 108 | DwarfLineSection = "\t.section\t.debug_line,\"\",@progbits"; |
| 109 | DwarfFrameSection = "\t.section\t.debug_frame,\"\",@progbits"; |
| 110 | DwarfPubNamesSection ="\t.section\t.debug_pubnames,\"\",@progbits"; |
| 111 | DwarfPubTypesSection ="\t.section\t.debug_pubtypes,\"\",@progbits"; |
| 112 | DwarfStrSection = "\t.section\t.debug_str,\"\",@progbits"; |
| 113 | DwarfLocSection = "\t.section\t.debug_loc,\"\",@progbits"; |
| 114 | DwarfARangesSection = "\t.section\t.debug_aranges,\"\",@progbits"; |
| 115 | DwarfRangesSection = "\t.section\t.debug_ranges,\"\",@progbits"; |
| 116 | DwarfMacInfoSection = "\t.section\t.debug_macinfo,\"\",@progbits"; |
Nicolas Geoffray | 616585b | 2007-12-21 12:19:44 +0000 | [diff] [blame] | 117 | |
| 118 | ReadOnlySection = "\t.section\t.rodata"; |
| 119 | FourByteConstantSection = "\t.section\t.rodata.cst4,\"aM\",@progbits,4"; |
| 120 | EightByteConstantSection = "\t.section\t.rodata.cst8,\"aM\",@progbits,8"; |
| 121 | SixteenByteConstantSection = "\t.section\t.rodata.cst16,\"aM\",@progbits,16"; |
| 122 | PCSymbol = "."; |
| 123 | |
| 124 | // Set up DWARF directives |
| 125 | HasLEB128 = true; // Target asm supports leb128 directives (little-endian) |
| 126 | |
| 127 | // Exceptions handling |
| 128 | if (!TM.getSubtargetImpl()->isPPC64()) |
| 129 | SupportsExceptionHandling = true; |
| 130 | AbsoluteEHSectionOffsets = false; |
| 131 | DwarfEHFrameSection = "\t.section\t.eh_frame,\"aw\",@progbits"; |
| 132 | DwarfExceptionSection = "\t.section\t.gcc_except_table,\"a\",@progbits"; |
Jim Laskey | bf11182 | 2006-12-21 20:26:09 +0000 | [diff] [blame] | 133 | } |