blob: 3e837635f22d3775703904f3c1384e2b8e3a1b29 [file] [log] [blame]
Chris Lattner3ab1fdf2009-07-31 17:02:00 +00001//===- lib/MC/MCSection.cpp - Machine Code Section Representation ---------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#include "llvm/MC/MCSection.h"
11#include "llvm/MC/MCContext.h"
Chris Lattnerd0d09fc2009-08-08 22:41:53 +000012#include "llvm/Target/TargetAsmInfo.h"
13#include "llvm/Support/raw_ostream.h"
Chris Lattner3ab1fdf2009-07-31 17:02:00 +000014using namespace llvm;
15
Chris Lattnerd0d09fc2009-08-08 22:41:53 +000016//===----------------------------------------------------------------------===//
17// MCSection
18//===----------------------------------------------------------------------===//
19
Chris Lattner3ab1fdf2009-07-31 17:02:00 +000020MCSection::~MCSection() {
21}
22
Chris Lattnerd0d09fc2009-08-08 22:41:53 +000023//===----------------------------------------------------------------------===//
24// MCSectionCOFF
25//===----------------------------------------------------------------------===//
Chris Lattnerb059d5d2009-08-08 20:50:49 +000026
Chris Lattnera551f8a2009-08-08 20:52:13 +000027MCSectionCOFF *MCSectionCOFF::
Chris Lattnerb059d5d2009-08-08 20:50:49 +000028Create(const StringRef &Name, bool IsDirective, SectionKind K, MCContext &Ctx) {
Chris Lattnera93ce3b2009-08-13 00:37:15 +000029 return new (Ctx) MCSectionCOFF(Name, IsDirective, K);
Chris Lattnerb059d5d2009-08-08 20:50:49 +000030}
31
Chris Lattnerd0d09fc2009-08-08 22:41:53 +000032void MCSectionCOFF::PrintSwitchToSection(const TargetAsmInfo &TAI,
33 raw_ostream &OS) const {
34
35 if (isDirective()) {
36 OS << getName() << '\n';
37 return;
38 }
39 OS << "\t.section\t" << getName() << ",\"";
40 if (getKind().isText())
41 OS << 'x';
42 if (getKind().isWriteable())
43 OS << 'w';
44 OS << "\"\n";
45}