A few more isAsCheapAsAMove.
[oota-llvm.git] / lib / Target / Sparc / SparcTargetAsmInfo.cpp
index 01f7f11ebbaa0f409de2ba14f6e010193172f2cb..c13d45ceec7cf9ad209dc450cfe69b6f898388fb 100644 (file)
@@ -2,8 +2,8 @@
 //
 //                     The LLVM Compiler Infrastructure
 //
-// This file was developed by James M. Laskey and is distributed under the
-// University of Illinois Open Source License. See LICENSE.TXT for details.
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
 //
 
 using namespace llvm;
 
-SparcTargetAsmInfo::SparcTargetAsmInfo(const SparcTargetMachine &TM) {
+SparcELFTargetAsmInfo::SparcELFTargetAsmInfo(const TargetMachine &TM):
+  ELFTargetAsmInfo(TM) {
   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";
+  COMMDirectiveTakesAlignment = true;
+  CStringSection=".rodata.str";
+
+  // Sparc normally uses named section for BSS.
+  BSSSection_  = getNamedSection("\t.bss",
+                                 SectionFlags::Writeable | SectionFlags::BSS,
+                                 /* Override */ true);
+}
+
+std::string SparcELFTargetAsmInfo::printSectionFlags(unsigned flags) const {
+  if (flags & SectionFlags::Mergeable)
+    return ELFTargetAsmInfo::printSectionFlags(flags);
+
+  std::string Flags;
+  if (!(flags & SectionFlags::Debug))
+    Flags += ",#alloc";
+  if (flags & SectionFlags::Code)
+    Flags += ",#execinstr";
+  if (flags & SectionFlags::Writeable)
+    Flags += ",#write";
+  if (flags & SectionFlags::TLS)
+    Flags += ",#tls";
+
+  return Flags;
 }