LLVM  10.0.0svn
MCSectionXCOFF.h
Go to the documentation of this file.
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"
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. 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;
36 
38  XCOFF::StorageMappingClass MappingClass;
40 
43  : MCSection(SV_XCOFF, K, Begin), Name(Section), MappingClass(SMC),
44  Type(ST) {
45  assert((ST == XCOFF::XTY_SD || ST == XCOFF::XTY_CM) &&
46  "Invalid or unhandled type for csect.");
47  }
48 
49 public:
51 
52  static bool classof(const MCSection *S) {
53  return S->getVariant() == SV_XCOFF;
54  }
55 
56  StringRef getSectionName() const { return Name; }
57  XCOFF::StorageMappingClass getMappingClass() const { return MappingClass; }
58  XCOFF::SymbolType getCSectType() const { return Type; }
59 
60  void PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
61  raw_ostream &OS,
62  const MCExpr *Subsection) const override;
63  bool UseCodeAlign() const override;
64  bool isVirtualSection() const override;
65 };
66 
67 } // end namespace llvm
68 
69 #endif
Instances of this class represent a uniqued identifier for a section in the current translation unit...
Definition: MCSection.h:38
Type
MessagePack types as defined in the standard, with the exception of Integer being divided into a sign...
Definition: MsgPackReader.h:48
This class represents lattice values for constants.
Definition: AllocatorList.h:23
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition: MCSymbol.h:41
amdgpu Simplify well known AMD library false FunctionCallee Value const Twine & Name
Base class for the full range of assembler expressions which are needed for parsing.
Definition: MCExpr.h:35
Context object for machine code objects.
Definition: MCContext.h:65
Common csect definition. For uninitialized storage.
Definition: XCOFF.h:147
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:56
static bool classof(const MCSection *S)
SectionKind - This is a simple POD value that classifies the properties of a section.
Definition: SectionKind.h:22
SectionVariant getVariant() const
Definition: MCSection.h:107
bool isVirtualSection() const override
Check whether this section is "virtual", that is has no actual object file contents.
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:43
XCOFF::SymbolType getCSectType() const
bool UseCodeAlign() const override
Return true if a .align directive should use "optimized nops" to fill instead of 0s.
void PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T, raw_ostream &OS, const MCExpr *Subsection) const override
Csect definition for initialized storage.
Definition: XCOFF.h:144
XCOFF::StorageMappingClass getMappingClass() const
StorageMappingClass
Storage Mapping Class definitions.
Definition: XCOFF.h:27
StringRef getSectionName() const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:45
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:48