2009-07-31 17:02:00 +00:00
|
|
|
//===- lib/MC/MCSection.cpp - Machine Code Section Representation ---------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "llvm/MC/MCSection.h"
|
|
|
|
#include "llvm/MC/MCContext.h"
|
2009-08-22 20:48:53 +00:00
|
|
|
#include "llvm/MC/MCAsmInfo.h"
|
2009-08-08 22:41:53 +00:00
|
|
|
#include "llvm/Support/raw_ostream.h"
|
2009-07-31 17:02:00 +00:00
|
|
|
using namespace llvm;
|
|
|
|
|
2009-08-08 22:41:53 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// MCSection
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2009-07-31 17:02:00 +00:00
|
|
|
MCSection::~MCSection() {
|
|
|
|
}
|
|
|
|
|
2009-08-08 22:41:53 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// MCSectionCOFF
|
|
|
|
//===----------------------------------------------------------------------===//
|
2009-08-08 20:50:49 +00:00
|
|
|
|
2009-08-08 20:52:13 +00:00
|
|
|
MCSectionCOFF *MCSectionCOFF::
|
2009-11-06 10:58:06 +00:00
|
|
|
Create(StringRef Name, bool IsDirective, SectionKind K, MCContext &Ctx) {
|
2009-08-13 00:37:15 +00:00
|
|
|
return new (Ctx) MCSectionCOFF(Name, IsDirective, K);
|
2009-08-08 20:50:49 +00:00
|
|
|
}
|
|
|
|
|
2009-08-22 21:43:10 +00:00
|
|
|
void MCSectionCOFF::PrintSwitchToSection(const MCAsmInfo &MAI,
|
2009-08-08 22:41:53 +00:00
|
|
|
raw_ostream &OS) const {
|
|
|
|
|
|
|
|
if (isDirective()) {
|
|
|
|
OS << getName() << '\n';
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
OS << "\t.section\t" << getName() << ",\"";
|
|
|
|
if (getKind().isText())
|
|
|
|
OS << 'x';
|
|
|
|
if (getKind().isWriteable())
|
|
|
|
OS << 'w';
|
|
|
|
OS << "\"\n";
|
|
|
|
}
|