Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/include/llvm/MC/MCSectionXCOFF.h
Line
Count
Source
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"
17
#include "llvm/BinaryFormat/XCOFF.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
class MCSectionXCOFF final : public MCSection {
32
  friend class MCContext;
33
34
  StringRef Name;
35
  XCOFF::StorageMappingClass MappingClass;
36
  XCOFF::SymbolType Type;
37
38
  MCSectionXCOFF(StringRef Section, XCOFF::StorageMappingClass SMC,
39
                 XCOFF::SymbolType ST, SectionKind K, MCSymbol *Begin)
40
      : MCSection(SV_XCOFF, K, Begin), Name(Section), MappingClass(SMC),
41
17
        Type(ST) {
42
17
    assert((ST == XCOFF::XTY_SD || ST == XCOFF::XTY_CM) &&
43
17
           "Unexpected type for csect.");
44
17
  }
45
46
public:
47
  ~MCSectionXCOFF();
48
49
8
  static bool classof(const MCSection *S) {
50
8
    return S->getVariant() == SV_XCOFF;
51
8
  }
52
53
3
  StringRef getSectionName() const { return Name; }
54
11
  XCOFF::StorageMappingClass getMappingClass() const { return MappingClass; }
55
8
  XCOFF::SymbolType getCSectType() const { return Type; }
56
57
  void PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
58
                            raw_ostream &OS,
59
                            const MCExpr *Subsection) const override;
60
  bool UseCodeAlign() const override;
61
  bool isVirtualSection() const override;
62
};
63
64
} // end namespace llvm
65
66
#endif