LLVM API Documentation

MCSection.cpp

Go to the documentation of this file.
00001 //===- lib/MC/MCSection.cpp - Machine Code Section Representation ---------===//
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 #include "llvm/MC/MCSection.h"
00011 #include "llvm/MC/MCContext.h"
00012 #include "llvm/Target/TargetAsmInfo.h"
00013 #include "llvm/Support/raw_ostream.h"
00014 using namespace llvm;
00015 
00016 //===----------------------------------------------------------------------===//
00017 // MCSection
00018 //===----------------------------------------------------------------------===//
00019 
00020 MCSection::~MCSection() {
00021 }
00022 
00023 //===----------------------------------------------------------------------===//
00024 // MCSectionCOFF
00025 //===----------------------------------------------------------------------===//
00026 
00027 MCSectionCOFF *MCSectionCOFF::
00028 Create(const StringRef &Name, bool IsDirective, SectionKind K, MCContext &Ctx) {
00029   return new (Ctx) MCSectionCOFF(Name, IsDirective, K);
00030 }
00031 
00032 void MCSectionCOFF::PrintSwitchToSection(const TargetAsmInfo &TAI,
00033                                          raw_ostream &OS) const {
00034   
00035   if (isDirective()) {
00036     OS << getName() << '\n';
00037     return;
00038   }
00039   OS << "\t.section\t" << getName() << ",\"";
00040   if (getKind().isText())
00041     OS << 'x';
00042   if (getKind().isWriteable())
00043     OS << 'w';
00044   OS << "\"\n";
00045 }