LLVM  10.0.0
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 #include "llvm/MC/MCSymbolXCOFF.h"
20 
21 namespace llvm {
22 
23 // This class represents an XCOFF `Control Section`, more commonly referred to
24 // as a csect. A csect represents the smallest possible unit of data/code which
25 // will be relocated as a single block. A csect can either be:
26 // 1) Initialized: The Type will be XTY_SD, and the symbols inside the csect
27 // will have a label definition representing their offset within the csect.
28 // 2) Uninitialized: The Type will be XTY_CM, it will contain a single symbol,
29 // and may not contain label definitions.
30 // 3) An external reference providing a symbol table entry for a symbol
31 // contained in another XCOFF object file. External reference csects are not
32 // implemented yet.
33 class MCSectionXCOFF final : public MCSection {
34  friend class MCContext;
35 
37  XCOFF::StorageMappingClass MappingClass;
40  MCSymbolXCOFF *const QualName;
41 
44  MCSymbolXCOFF *QualName, MCSymbol *Begin)
45  : MCSection(SV_XCOFF, K, Begin), Name(Section), MappingClass(SMC),
46  Type(ST), StorageClass(SC), QualName(QualName) {
47  assert((ST == XCOFF::XTY_SD || ST == XCOFF::XTY_CM || ST == XCOFF::XTY_ER) &&
48  "Invalid or unhandled type for csect.");
49  assert(QualName != nullptr && "QualName is needed.");
50  QualName->setStorageClass(SC);
51  QualName->setContainingCsect(this);
52  }
53 
54 public:
56 
57  static bool classof(const MCSection *S) {
58  return S->getVariant() == SV_XCOFF;
59  }
60 
61  StringRef getSectionName() const { return Name; }
62  XCOFF::StorageMappingClass getMappingClass() const { return MappingClass; }
64  XCOFF::SymbolType getCSectType() const { return Type; }
65  MCSymbolXCOFF *getQualNameSymbol() const { return QualName; }
66 
67  void PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
68  raw_ostream &OS,
69  const MCExpr *Subsection) const override;
70  bool UseCodeAlign() const override;
71  bool isVirtualSection() const override;
72 };
73 
74 } // end namespace llvm
75 
76 #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
MCSymbolXCOFF * getQualNameSymbol() const
Context object for machine code objects.
Definition: MCContext.h:65
StorageClass
Definition: XCOFF.h:77
Common csect definition. For uninitialized storage.
Definition: XCOFF.h:149
This class is intended to be used as a base class for asm properties and features specific to the tar...
Definition: MCAsmInfo.h:56
External reference.
Definition: XCOFF.h:145
StorageMappingClass
Storage Mapping Class definitions.
Definition: XCOFF.h:29
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:113
bool isVirtualSection() const override
Check whether this section is "virtual", that is has no actual object file contents.
void setStorageClass(XCOFF::StorageClass SC)
Definition: MCSymbolXCOFF.h:27
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:146
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:46
void setContainingCsect(MCSectionXCOFF *C)
Definition: MCSymbolXCOFF.h:39
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:54
XCOFF::StorageClass getStorageClass() const