2006-09-07 22:05:02 +00:00
|
|
|
//===-- SparcTargetAsmInfo.cpp - Sparc asm properties -----------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 20:36:04 +00:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2006-09-07 22:05:02 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file contains the declarations of the SparcTargetAsmInfo properties.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "SparcTargetAsmInfo.h"
|
2009-07-26 07:33:58 +00:00
|
|
|
#include "llvm/ADT/SmallVector.h"
|
2006-09-07 22:05:02 +00:00
|
|
|
using namespace llvm;
|
|
|
|
|
2009-07-26 19:23:28 +00:00
|
|
|
SparcELFTargetAsmInfo::SparcELFTargetAsmInfo(const TargetMachine &TM)
|
|
|
|
: ELFTargetAsmInfo(TM) {
|
2006-09-07 22:05:02 +00:00
|
|
|
Data16bitsDirective = "\t.half\t";
|
|
|
|
Data32bitsDirective = "\t.word\t";
|
|
|
|
Data64bitsDirective = 0; // .xword is only supported by V9.
|
|
|
|
ZeroDirective = "\t.skip\t";
|
|
|
|
CommentString = "!";
|
|
|
|
ConstantPoolSection = "\t.section \".rodata\",#alloc\n";
|
2008-08-07 09:51:25 +00:00
|
|
|
COMMDirectiveTakesAlignment = true;
|
2008-08-08 18:25:29 +00:00
|
|
|
CStringSection=".rodata.str";
|
2008-08-16 12:58:12 +00:00
|
|
|
|
|
|
|
// Sparc normally uses named section for BSS.
|
2009-07-26 19:23:28 +00:00
|
|
|
BSSSection_ = getNamedSection("\t.bss",
|
|
|
|
SectionFlags::Writable | SectionFlags::BSS);
|
2008-08-07 09:51:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-07-26 07:33:58 +00:00
|
|
|
void SparcELFTargetAsmInfo::getSectionFlags(unsigned Flags,
|
|
|
|
SmallVectorImpl<char> &Str) const {
|
|
|
|
if (Flags & SectionFlags::Mergeable)
|
|
|
|
return ELFTargetAsmInfo::getSectionFlags(Flags, Str);
|
|
|
|
|
|
|
|
// FIXME: Inefficient.
|
|
|
|
std::string Res;
|
|
|
|
if (!(Flags & SectionFlags::Debug))
|
|
|
|
Res += ",#alloc";
|
|
|
|
if (Flags & SectionFlags::Code)
|
|
|
|
Res += ",#execinstr";
|
|
|
|
if (Flags & SectionFlags::Writable)
|
|
|
|
Res += ",#write";
|
|
|
|
if (Flags & SectionFlags::TLS)
|
|
|
|
Res += ",#tls";
|
2008-08-07 09:51:25 +00:00
|
|
|
|
2009-07-26 07:33:58 +00:00
|
|
|
Str.append(Res.begin(), Res.end());
|
2006-09-07 22:05:02 +00:00
|
|
|
}
|