blob: a117df90adc3dd854329d15da33cc7df46c23e2f [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001//===-- PPCTargetAsmInfo.cpp - PPC asm properties ---------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner081ce942007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007//
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"
Anton Korobeynikov0aeac602008-02-27 23:49:15 +000017#include "llvm/Support/Dwarf.h"
18
Dan Gohmanf17a25c2007-07-18 16:29:46 +000019using namespace llvm;
Anton Korobeynikov0aeac602008-02-27 23:49:15 +000020using namespace llvm::dwarf;
Dan Gohmanf17a25c2007-07-18 16:29:46 +000021
Chris Lattnerca072172009-06-19 00:08:39 +000022PPCDarwinTargetAsmInfo::PPCDarwinTargetAsmInfo(const PPCTargetMachine &TM) :
Anton Korobeynikov3829e8a2008-09-25 21:00:33 +000023 PPCTargetAsmInfo<DarwinTargetAsmInfo>(TM) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +000024 PCSymbol = ".";
25 CommentString = ";";
Dan Gohmanf17a25c2007-07-18 16:29:46 +000026 ConstantPoolSection = "\t.const\t";
Dan Gohmanf17a25c2007-07-18 16:29:46 +000027 UsedDirective = "\t.no_dead_strip\t";
Dale Johannesen15e8f532007-12-19 21:54:36 +000028 SupportsExceptionHandling = true;
Nicolas Geoffray61864762007-12-21 12:19:44 +000029
30 DwarfEHFrameSection =
Chris Lattnerca072172009-06-19 00:08:39 +000031 ".section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support";
Nicolas Geoffray61864762007-12-21 12:19:44 +000032 DwarfExceptionSection = ".section __DATA,__gcc_except_tab";
Dale Johannesenf09b5992008-01-10 02:03:30 +000033 GlobalEHDirective = "\t.globl\t";
34 SupportsWeakOmittedEHFrame = false;
Dan Gohmanf17a25c2007-07-18 16:29:46 +000035}
36
Chris Lattnerd8310522009-07-27 05:32:16 +000037const char *PPCDarwinTargetAsmInfo::getEHGlobalPrefix() const {
Rafael Espindola1a931842008-12-19 10:55:56 +000038 const PPCSubtarget* Subtarget = &TM.getSubtarget<PPCSubtarget>();
39 if (Subtarget->getDarwinVers() > 9)
40 return PrivateGlobalPrefix;
Chris Lattnerc51585b2009-07-26 19:23:28 +000041 return "";
Rafael Espindola1a931842008-12-19 10:55:56 +000042}
Anton Korobeynikov0aeac602008-02-27 23:49:15 +000043
Anton Korobeynikov894be4b2008-08-08 18:23:49 +000044PPCLinuxTargetAsmInfo::PPCLinuxTargetAsmInfo(const PPCTargetMachine &TM) :
Anton Korobeynikov3829e8a2008-09-25 21:00:33 +000045 PPCTargetAsmInfo<ELFTargetAsmInfo>(TM) {
Dan Gohmanf17a25c2007-07-18 16:29:46 +000046 CommentString = "#";
47 GlobalPrefix = "";
Rafael Espindola1a931842008-12-19 10:55:56 +000048 PrivateGlobalPrefix = ".L";
Evan Chengbde1bfc2008-02-12 19:25:12 +000049 ConstantPoolSection = "\t.section .rodata.cst4\t";
50 JumpTableDataSection = ".section .rodata.cst4";
asl7e07ea52008-08-16 12:58:46 +000051 CStringSection = ".rodata.str";
Dan Gohmanf17a25c2007-07-18 16:29:46 +000052 StaticCtorsSection = ".section\t.ctors,\"aw\",@progbits";
53 StaticDtorsSection = ".section\t.dtors,\"aw\",@progbits";
54 UsedDirective = "\t# .no_dead_strip\t";
55 WeakRefDirective = "\t.weak\t";
Nick Lewyckyc6583752007-11-04 17:32:10 +000056 BSSSection = "\t.section\t\".sbss\",\"aw\",@nobits";
Nick Lewycky3246a9c2007-07-25 03:48:45 +000057
Nicolas Geoffray61864762007-12-21 12:19:44 +000058 // Debug Information
59 AbsoluteDebugSectionOffsets = true;
60 SupportsDebugInformation = true;
Nick Lewycky3246a9c2007-07-25 03:48:45 +000061 DwarfAbbrevSection = "\t.section\t.debug_abbrev,\"\",@progbits";
62 DwarfInfoSection = "\t.section\t.debug_info,\"\",@progbits";
63 DwarfLineSection = "\t.section\t.debug_line,\"\",@progbits";
64 DwarfFrameSection = "\t.section\t.debug_frame,\"\",@progbits";
65 DwarfPubNamesSection ="\t.section\t.debug_pubnames,\"\",@progbits";
66 DwarfPubTypesSection ="\t.section\t.debug_pubtypes,\"\",@progbits";
67 DwarfStrSection = "\t.section\t.debug_str,\"\",@progbits";
68 DwarfLocSection = "\t.section\t.debug_loc,\"\",@progbits";
69 DwarfARangesSection = "\t.section\t.debug_aranges,\"\",@progbits";
70 DwarfRangesSection = "\t.section\t.debug_ranges,\"\",@progbits";
Chris Lattnerecbf73b2009-06-18 23:31:37 +000071 DwarfMacroInfoSection = "\t.section\t.debug_macinfo,\"\",@progbits";
Nicolas Geoffray61864762007-12-21 12:19:44 +000072
Nicolas Geoffray61864762007-12-21 12:19:44 +000073 PCSymbol = ".";
74
75 // Set up DWARF directives
76 HasLEB128 = true; // Target asm supports leb128 directives (little-endian)
77
78 // Exceptions handling
79 if (!TM.getSubtargetImpl()->isPPC64())
80 SupportsExceptionHandling = true;
81 AbsoluteEHSectionOffsets = false;
82 DwarfEHFrameSection = "\t.section\t.eh_frame,\"aw\",@progbits";
83 DwarfExceptionSection = "\t.section\t.gcc_except_table,\"a\",@progbits";
Dan Gohmanf17a25c2007-07-18 16:29:46 +000084}
Anton Korobeynikov0aeac602008-02-27 23:49:15 +000085
Anton Korobeynikov45d1b622008-10-05 08:53:29 +000086
87// Instantiate default implementation.
88TEMPLATE_INSTANTIATION(class PPCTargetAsmInfo<TargetAsmInfo>);