1 | //===-- llvm/MC/MCSectionGOFF.h - GOFF 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 | /// \file |
10 | /// This file declares the MCSectionGOFF class, which contains all of the |
11 | /// necessary machine code sections for the GOFF file format. |
12 | /// |
13 | //===----------------------------------------------------------------------===// |
14 | |
15 | #ifndef LLVM_MC_MCSECTIONGOFF_H |
16 | #define LLVM_MC_MCSECTIONGOFF_H |
17 | |
18 | #include "llvm/BinaryFormat/GOFF.h" |
19 | #include "llvm/MC/MCSection.h" |
20 | #include "llvm/Support/raw_ostream.h" |
21 | |
22 | namespace llvm { |
23 | |
24 | class MCExpr; |
25 | |
26 | class MCSectionGOFF final : public MCSection { |
27 | private: |
28 | MCSection *Parent; |
29 | const MCExpr *SubsectionId; |
30 | |
31 | friend class MCContext; |
32 | MCSectionGOFF(StringRef Name, SectionKind K, MCSection *P, const MCExpr *Sub) |
33 | : MCSection(SV_GOFF, Name, K, nullptr), Parent(P), SubsectionId(Sub) {} |
34 | |
35 | public: |
36 | void printSwitchToSection(const MCAsmInfo &MAI, const Triple &T, |
37 | raw_ostream &OS, |
38 | const MCExpr *Subsection) const override { |
39 | OS << "\t.section\t\"" << getName() << "\"\n" ; |
40 | } |
41 | |
42 | bool useCodeAlign() const override { return false; } |
43 | |
44 | bool isVirtualSection() const override { return false; } |
45 | |
46 | MCSection *getParent() const { return Parent; } |
47 | const MCExpr *getSubsectionId() const { return SubsectionId; } |
48 | |
49 | static bool classof(const MCSection *S) { return S->getVariant() == SV_GOFF; } |
50 | }; |
51 | } // end namespace llvm |
52 | |
53 | #endif |
54 | |