blob: 2a3f391fd3e281585c46b964c01d5bdf884a432d [file] [log] [blame]
Andrew Walbran3d2c1972020-04-07 12:24:26 +01001//===- MCSectionXCOFF.h - XCOFF Machine Code Sections -----------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file declares the MCSectionXCOFF class.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_MC_MCSECTIONXCOFF_H
14#define LLVM_MC_MCSECTIONXCOFF_H
15
16#include "llvm/ADT/Twine.h"
17#include "llvm/BinaryFormat/XCOFF.h"
18#include "llvm/MC/MCSection.h"
19
20namespace llvm {
21
22class MCSymbol;
23
24// This class represents an XCOFF `Control Section`, more commonly referred to
25// as a csect. A csect represents the smallest possible unit of data/code which
26// will be relocated as a single block.
27class MCSectionXCOFF final : public MCSection {
28 friend class MCContext;
29
30 StringRef Name;
31 XCOFF::StorageMappingClass MappingClass;
32
33 MCSectionXCOFF(StringRef Section, XCOFF::StorageMappingClass SMC,
34 SectionKind K, MCSymbol *Begin)
35 : MCSection(SV_XCOFF, K, Begin), Name(Section), MappingClass(SMC) {}
36
37public:
38 ~MCSectionXCOFF();
39
40 static bool classof(const MCSection *S) {
41 return S->getVariant() == SV_XCOFF;
42 }
43
44 StringRef getSectionName() const { return Name; }
45 XCOFF::StorageMappingClass getMappingClass() const { return MappingClass; }
46
47 void PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
48 raw_ostream &OS,
49 const MCExpr *Subsection) const override;
50 bool UseCodeAlign() const override;
51 bool isVirtualSection() const override;
52};
53
54} // end namespace llvm
55
56#endif