]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/include/llvm/MC/MCSectionXCOFF.h
Merge ^/head r351732 through r352104.
[FreeBSD/FreeBSD.git] / contrib / llvm / include / llvm / MC / MCSectionXCOFF.h
1 //===- 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
20 namespace llvm {
21
22 class 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.
27 class 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
37 public:
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