blob: 7912f705738aa2b205d40933d7cc67aa76a14fea [file] [log] [blame]
Jim Laskey8e8de8f2006-09-07 22:05:02 +00001//===-- 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 Lattnerb56dcc42006-10-05 00:35:50 +000016#include "llvm/Function.h"
Jim Laskey8e8de8f2006-09-07 22:05:02 +000017using namespace llvm;
18
Bill Wendlingeb9a42c2007-01-16 03:42:04 +000019// ASM variant to use.
20enum {
21 PPC_OLD_MNEMONICS = 0,
22 PPC_NEW_MNEMONICS = 1
23};
24
Jim Laskeybf111822006-12-21 20:26:09 +000025PPCTargetAsmInfo::PPCTargetAsmInfo(const PPCTargetMachine &TM) {
Jim Laskey8e8de8f2006-09-07 22:05:02 +000026 bool isPPC64 = TM.getSubtargetImpl()->isPPC64();
Jim Laskeybf111822006-12-21 20:26:09 +000027
Jim Laskey8e8de8f2006-09-07 22:05:02 +000028 ZeroDirective = "\t.space\t";
29 SetDirective = "\t.set";
Jim Laskeyf45c25f2006-09-08 13:06:56 +000030 Data64bitsDirective = isPPC64 ? "\t.quad\t" : 0;
Jim Laskey8e8de8f2006-09-07 22:05:02 +000031 AlignmentIsInBytes = false;
Jim Laskey8e8de8f2006-09-07 22:05:02 +000032 LCOMMDirective = "\t.lcomm\t";
Jim Laskey8e8de8f2006-09-07 22:05:02 +000033 InlineAsmStart = "# InlineAsm Start";
34 InlineAsmEnd = "# InlineAsm End";
Bill Wendlingeb9a42c2007-01-16 03:42:04 +000035 AssemblerDialect = PPC_OLD_MNEMONICS;
Jim Laskey8e8de8f2006-09-07 22:05:02 +000036
37 NeedsSet = true;
38 AddressSize = isPPC64 ? 8 : 4;
Jim Laskey5059dda2006-10-17 11:30:57 +000039 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";
Jim Laskey8e8de8f2006-09-07 22:05:02 +000050}
Chris Lattnerb56dcc42006-10-05 00:35:50 +000051
Jim Laskeybf111822006-12-21 20:26:09 +000052DarwinTargetAsmInfo::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";
Chris Lattner70d41072007-01-14 06:37:54 +000065 HiddenDirective = "\t.private_extern\t";
Bill Wendlingeb9a42c2007-01-16 03:42:04 +000066 AssemblerDialect = PPC_NEW_MNEMONICS;
Jim Laskeybf111822006-12-21 20:26:09 +000067}
68
69LinuxTargetAsmInfo::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}