[Alignment][NFC] Use Align with TargetLowering::setMinFunctionAlignment
[llvm-core.git] / include / llvm / MC / MCSectionXCOFF.h
blob9e6a5196c9cad167c8d9327a29a8e409c1e121e9
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.
11 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_MC_MCSECTIONXCOFF_H
14 #define LLVM_MC_MCSECTIONXCOFF_H
16 #include "llvm/ADT/Twine.h"
17 #include "llvm/BinaryFormat/XCOFF.h"
18 #include "llvm/MC/MCSection.h"
20 namespace llvm {
22 class MCSymbol;
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. A csect can either be:
27 // 1) Initialized: The Type will be XTY_SD, and the symbols inside the csect
28 // will have a label definition representing their offset within the csect.
29 // 2) Uninitialized: The Type will be XTY_CM, it will contain a single symbol,
30 // and may not contain label definitions.
31 // 3) An external reference providing a symbol table entry for a symbol
32 // contained in another XCOFF object file. External reference csects are not
33 // implemented yet.
34 class MCSectionXCOFF final : public MCSection {
35 friend class MCContext;
37 StringRef Name;
38 XCOFF::StorageMappingClass MappingClass;
39 XCOFF::SymbolType Type;
40 XCOFF::StorageClass StorageClass;
42 MCSectionXCOFF(StringRef Section, XCOFF::StorageMappingClass SMC,
43 XCOFF::SymbolType ST, XCOFF::StorageClass SC, SectionKind K,
44 MCSymbol *Begin)
45 : MCSection(SV_XCOFF, K, Begin), Name(Section), MappingClass(SMC),
46 Type(ST), StorageClass(SC) {
47 assert((ST == XCOFF::XTY_SD || ST == XCOFF::XTY_CM) &&
48 "Invalid or unhandled type for csect.");
51 public:
52 ~MCSectionXCOFF();
54 static bool classof(const MCSection *S) {
55 return S->getVariant() == SV_XCOFF;
58 StringRef getSectionName() const { return Name; }
59 XCOFF::StorageMappingClass getMappingClass() const { return MappingClass; }
60 XCOFF::SymbolType getCSectType() const { return Type; }
62 void PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
63 raw_ostream &OS,
64 const MCExpr *Subsection) const override;
65 bool UseCodeAlign() const override;
66 bool isVirtualSection() const override;
69 } // end namespace llvm
71 #endif