blob: 7b9f449436e620c93b5fd3d450a1e85fc0879307 [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"
Chris Lattnerf40761d2009-07-26 07:33:58 +000015#include "llvm/ADT/SmallVector.h"
Jim Laskey8e8de8f2006-09-07 22:05:02 +000016using 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 Korobeynikov5b794b92008-08-07 09:51:25 +000035
Chris Lattnerf40761d2009-07-26 07:33:58 +000036void SparcELFTargetAsmInfo::getSectionFlags(unsigned Flags,
37 SmallVectorImpl<char> &Str) const {
38 if (Flags & SectionFlags::Mergeable)
39 return ELFTargetAsmInfo::getSectionFlags(Flags, Str);
Anton Korobeynikov5b794b92008-08-07 09:51:25 +000040
Chris Lattnerf40761d2009-07-26 07:33:58 +000041 // FIXME: Inefficient.
42 std::string Res;
43 if (!(Flags & SectionFlags::Debug))
44 Res += ",#alloc";
45 if (Flags & SectionFlags::Code)
46 Res += ",#execinstr";
47 if (Flags & SectionFlags::Writable)
48 Res += ",#write";
49 if (Flags & SectionFlags::TLS)
50 Res += ",#tls";
51
52 Str.append(Res.begin(), Res.end());
Jim Laskey8e8de8f2006-09-07 22:05:02 +000053}