blob: 0087c262fbd8668f3182e81a794c1d406b6df942 [file] [log] [blame]
Jim Laskey8e8de8f2006-09-07 22:05:02 +00001//===-- SparcTargetAsmInfo.cpp - Sparc asm properties -----------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner4ee451d2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Jim Laskey8e8de8f2006-09-07 22:05:02 +00007//
8//===----------------------------------------------------------------------===//
9//
10// This file contains the declarations of the SparcTargetAsmInfo properties.
11//
12//===----------------------------------------------------------------------===//
13
14#include "SparcTargetAsmInfo.h"
15
16using namespace llvm;
17
Anton Korobeynikov5b794b92008-08-07 09:51:25 +000018SparcELFTargetAsmInfo::SparcELFTargetAsmInfo(const TargetMachine &TM):
19 ELFTargetAsmInfo(TM) {
Jim Laskey8e8de8f2006-09-07 22:05:02 +000020 Data16bitsDirective = "\t.half\t";
21 Data32bitsDirective = "\t.word\t";
22 Data64bitsDirective = 0; // .xword is only supported by V9.
23 ZeroDirective = "\t.skip\t";
24 CommentString = "!";
25 ConstantPoolSection = "\t.section \".rodata\",#alloc\n";
Anton Korobeynikov5b794b92008-08-07 09:51:25 +000026 COMMDirectiveTakesAlignment = true;
Anton Korobeynikov25c6a082008-08-08 18:25:29 +000027 CStringSection=".rodata.str";
Anton Korobeynikov328da652008-08-16 12:58:12 +000028
29 // Sparc normally uses named section for BSS.
30 BSSSection_ = getNamedSection("\t.bss",
Chris Lattnerb4fc4192009-07-25 18:57:34 +000031 SectionFlags::Writable | SectionFlags::BSS,
Anton Korobeynikov328da652008-08-16 12:58:12 +000032 /* Override */ true);
Anton Korobeynikov5b794b92008-08-07 09:51:25 +000033}
34
Anton Korobeynikovd0c1e292008-08-16 12:57:07 +000035std::string SparcELFTargetAsmInfo::printSectionFlags(unsigned flags) const {
Anton Korobeynikov5b794b92008-08-07 09:51:25 +000036 if (flags & SectionFlags::Mergeable)
Anton Korobeynikovd0c1e292008-08-16 12:57:07 +000037 return ELFTargetAsmInfo::printSectionFlags(flags);
Anton Korobeynikov5b794b92008-08-07 09:51:25 +000038
Anton Korobeynikovcbdf30a2008-08-08 18:26:10 +000039 std::string Flags;
Anton Korobeynikov5b794b92008-08-07 09:51:25 +000040 if (!(flags & SectionFlags::Debug))
Anton Korobeynikovcbdf30a2008-08-08 18:26:10 +000041 Flags += ",#alloc";
Anton Korobeynikov5b794b92008-08-07 09:51:25 +000042 if (flags & SectionFlags::Code)
Anton Korobeynikovcbdf30a2008-08-08 18:26:10 +000043 Flags += ",#execinstr";
Chris Lattnerb4fc4192009-07-25 18:57:34 +000044 if (flags & SectionFlags::Writable)
Anton Korobeynikovcbdf30a2008-08-08 18:26:10 +000045 Flags += ",#write";
Anton Korobeynikov5b794b92008-08-07 09:51:25 +000046 if (flags & SectionFlags::TLS)
Anton Korobeynikovcbdf30a2008-08-08 18:26:10 +000047 Flags += ",#tls";
Anton Korobeynikov5b794b92008-08-07 09:51:25 +000048
49 return Flags;
Jim Laskey8e8de8f2006-09-07 22:05:02 +000050}