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