afa5327d952572be2cdf2dad7d2aaa2765bbeae7
[oota-llvm.git] / lib / Target / Sparc / SparcTargetAsmInfo.cpp
1 //===-- SparcTargetAsmInfo.cpp - Sparc asm properties -----------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file contains the declarations of the SparcTargetAsmInfo properties.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #include "SparcTargetAsmInfo.h"
15
16 using namespace llvm;
17
18 SparcELFTargetAsmInfo::SparcELFTargetAsmInfo(const TargetMachine &TM):
19   ELFTargetAsmInfo(TM) {
20   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";
26   COMMDirectiveTakesAlignment = true;
27   CStringSection=".rodata.str";
28 }
29
30 std::string SparcELFTargetAsmInfo::printSectionFlags(unsigned flags) const {
31   if (flags & SectionFlags::Mergeable)
32     return ELFTargetAsmInfo::printSectionFlags(flags);
33
34   std::string Flags;
35   if (!(flags & SectionFlags::Debug))
36     Flags += ",#alloc";
37   if (flags & SectionFlags::Code)
38     Flags += ",#execinstr";
39   if (flags & SectionFlags::Writeable)
40     Flags += ",#write";
41   if (flags & SectionFlags::TLS)
42     Flags += ",#tls";
43
44   return Flags;
45 }