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 | 5059dda | 2006-10-17 11:30:57 +0000 | [diff] [blame] | 33 | DwarfAbbrevSection = ".section __DWARF,__debug_abbrev,regular,debug"; |
| 34 | DwarfInfoSection = ".section __DWARF,__debug_info,regular,debug"; |
| 35 | DwarfLineSection = ".section __DWARF,__debug_line,regular,debug"; |
| 36 | DwarfFrameSection = ".section __DWARF,__debug_frame,regular,debug"; |
| 37 | DwarfPubNamesSection = ".section __DWARF,__debug_pubnames,regular,debug"; |
| 38 | DwarfPubTypesSection = ".section __DWARF,__debug_pubtypes,regular,debug"; |
| 39 | DwarfStrSection = ".section __DWARF,__debug_str,regular,debug"; |
| 40 | DwarfLocSection = ".section __DWARF,__debug_loc,regular,debug"; |
| 41 | DwarfARangesSection = ".section __DWARF,__debug_aranges,regular,debug"; |
| 42 | DwarfRangesSection = ".section __DWARF,__debug_ranges,regular,debug"; |
| 43 | DwarfMacInfoSection = ".section __DWARF,__debug_macinfo,regular,debug"; |
Jim Laskey | 8e8de8f | 2006-09-07 22:05:02 +0000 | [diff] [blame] | 44 | } |
Chris Lattner | b56dcc4 | 2006-10-05 00:35:50 +0000 | [diff] [blame] | 45 | |
Jim Laskey | bf11182 | 2006-12-21 20:26:09 +0000 | [diff] [blame] | 46 | DarwinTargetAsmInfo::DarwinTargetAsmInfo(const PPCTargetMachine &TM) |
| 47 | : PPCTargetAsmInfo(TM) |
| 48 | { |
| 49 | CommentString = ";"; |
| 50 | GlobalPrefix = "_"; |
| 51 | PrivateGlobalPrefix = "L"; |
| 52 | ConstantPoolSection = "\t.const\t"; |
| 53 | JumpTableDataSection = ".const"; |
Jim Laskey | 072200c | 2007-01-29 18:51:14 +0000 | [diff] [blame] | 54 | GlobalDirective = "\t.globl\t"; |
Jim Laskey | bf11182 | 2006-12-21 20:26:09 +0000 | [diff] [blame] | 55 | CStringSection = "\t.cstring"; |
Evan Cheng | b267ca1 | 2007-01-30 08:04:53 +0000 | [diff] [blame^] | 56 | if (TM.getRelocationModel() == Reloc::Static) { |
| 57 | StaticCtorsSection = ".constructor"; |
| 58 | StaticDtorsSection = ".destructor"; |
| 59 | } else { |
| 60 | StaticCtorsSection = ".mod_init_func"; |
| 61 | StaticDtorsSection = ".mod_term_func"; |
| 62 | } |
Jim Laskey | bf11182 | 2006-12-21 20:26:09 +0000 | [diff] [blame] | 63 | UsedDirective = "\t.no_dead_strip\t"; |
| 64 | WeakRefDirective = "\t.weak_reference\t"; |
Chris Lattner | 70d4107 | 2007-01-14 06:37:54 +0000 | [diff] [blame] | 65 | HiddenDirective = "\t.private_extern\t"; |
Jim Laskey | 072200c | 2007-01-29 18:51:14 +0000 | [diff] [blame] | 66 | SupportsExceptionHandling = true; |
Chris Lattner | b266ccd | 2007-01-18 01:15:58 +0000 | [diff] [blame] | 67 | |
| 68 | // In non-PIC modes, emit a special label before jump tables so that the |
| 69 | // linker can perform more accurate dead code stripping. |
| 70 | if (TM.getRelocationModel() != Reloc::PIC_) { |
| 71 | // Emit a local label that is preserved until the linker runs. |
| 72 | JumpTableSpecialLabelPrefix = "l"; |
| 73 | } |
Jim Laskey | bf11182 | 2006-12-21 20:26:09 +0000 | [diff] [blame] | 74 | } |
| 75 | |
| 76 | LinuxTargetAsmInfo::LinuxTargetAsmInfo(const PPCTargetMachine &TM) |
| 77 | : PPCTargetAsmInfo(TM) |
| 78 | { |
| 79 | CommentString = "#"; |
| 80 | GlobalPrefix = ""; |
| 81 | PrivateGlobalPrefix = ""; |
| 82 | ConstantPoolSection = "\t.section .rodata.cst4\t"; |
| 83 | JumpTableDataSection = ".section .rodata.cst4"; |
| 84 | CStringSection = "\t.section\t.rodata"; |
| 85 | StaticCtorsSection = ".section\t.ctors,\"aw\",@progbits"; |
| 86 | StaticDtorsSection = ".section\t.dtors,\"aw\",@progbits"; |
| 87 | UsedDirective = "\t# .no_dead_strip\t"; |
| 88 | WeakRefDirective = "\t.weak\t"; |
| 89 | } |