LLVM  10.0.0svn
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 //===----------------------------------------------------------------------===//
16 #include "llvm/ADT/Twine.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;
38  XCOFF::StorageMappingClass MappingClass;
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.");
49  }
51 public:
54  static bool classof(const MCSection *S) {
55  return S->getVariant() == SV_XCOFF;
56  }
58  StringRef getSectionName() const { return Name; }
59  XCOFF::StorageMappingClass getMappingClass() const { return MappingClass; }
61  XCOFF::SymbolType getCSectType() const { return Type; }
63  void PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
64  raw_ostream &OS,
65  const MCExpr *Subsection) const override;
66  bool UseCodeAlign() const override;
67  bool isVirtualSection() const override;
68 };
70 } // end namespace llvm
72 #endif
Instances of this class represent a uniqued identifier for a section in the current translation unit...
Definition: MCSection.h:39
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
COFF::SymbolStorageClass StorageClass
Definition: COFFYAML.cpp:356
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
Definition: XCOFF.h:76
Common csect definition. For uninitialized storage.
Definition: XCOFF.h:148
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:56
Storage Mapping Class definitions.
Definition: XCOFF.h:28
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:108
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.
CHAIN = SC CHAIN, Imm128 - System call.
void PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T, raw_ostream &OS, const MCExpr *Subsection) const override
Csect definition for initialized storage.
Definition: XCOFF.h:145
XCOFF::StorageMappingClass getMappingClass() const
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
XCOFF::StorageClass getStorageClass() const