2009-07-31 19:02:00 +02: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 22:48:53 +02:00
|
|
|
#include "llvm/MC/MCAsmInfo.h"
|
2009-08-09 00:41:53 +02:00
|
|
|
#include "llvm/Support/raw_ostream.h"
|
2009-07-31 19:02:00 +02:00
|
|
|
using namespace llvm;
|
|
|
|
|
2009-08-09 00:41:53 +02:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// MCSection
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2009-07-31 19:02:00 +02:00
|
|
|
MCSection::~MCSection() {
|
|
|
|
}
|
|
|
|
|
2009-08-09 00:41:53 +02:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// MCSectionCOFF
|
|
|
|
//===----------------------------------------------------------------------===//
|
2009-08-08 22:50:49 +02:00
|
|
|
|
2009-08-08 22:52:13 +02:00
|
|
|
MCSectionCOFF *MCSectionCOFF::
|
2009-11-06 11:58:06 +01:00
|
|
|
Create(StringRef Name, bool IsDirective, SectionKind K, MCContext &Ctx) {
|
2009-08-13 02:37:15 +02:00
|
|
|
return new (Ctx) MCSectionCOFF(Name, IsDirective, K);
|
2009-08-08 22:50:49 +02:00
|
|
|
}
|
|
|
|
|
2009-08-22 23:43:10 +02:00
|
|
|
void MCSectionCOFF::PrintSwitchToSection(const MCAsmInfo &MAI,
|
2009-08-09 00:41:53 +02: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";
|
|
|
|
}
|