LLVM API Documentation

SparcTargetAsmInfo.cpp

Go to the documentation of this file.
00001 //===-- SparcTargetAsmInfo.cpp - Sparc asm properties -----------*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This file contains the declarations of the SparcTargetAsmInfo properties.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #include "SparcTargetAsmInfo.h"
00015 
00016 using namespace llvm;
00017 
00018 SparcELFTargetAsmInfo::SparcELFTargetAsmInfo(const TargetMachine &TM):
00019   ELFTargetAsmInfo(TM) {
00020   Data16bitsDirective = "\t.half\t";
00021   Data32bitsDirective = "\t.word\t";
00022   Data64bitsDirective = 0;  // .xword is only supported by V9.
00023   ZeroDirective = "\t.skip\t";
00024   CommentString = "!";
00025   ConstantPoolSection = "\t.section \".rodata\",#alloc\n";
00026   COMMDirectiveTakesAlignment = true;
00027   CStringSection=".rodata.str";
00028 
00029   // Sparc normally uses named section for BSS.
00030   BSSSection_  = getNamedSection("\t.bss",
00031                                  SectionFlags::Writeable | SectionFlags::BSS,
00032                                  /* Override */ true);
00033 }
00034 
00035 std::string SparcELFTargetAsmInfo::printSectionFlags(unsigned flags) const {
00036   if (flags & SectionFlags::Mergeable)
00037     return ELFTargetAsmInfo::printSectionFlags(flags);
00038 
00039   std::string Flags;
00040   if (!(flags & SectionFlags::Debug))
00041     Flags += ",#alloc";
00042   if (flags & SectionFlags::Code)
00043     Flags += ",#execinstr";
00044   if (flags & SectionFlags::Writeable)
00045     Flags += ",#write";
00046   if (flags & SectionFlags::TLS)
00047     Flags += ",#tls";
00048 
00049   return Flags;
00050 }