]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/lib/Target/NVPTX/NVPTXTargetObjectFile.h
MFV r322229: 7600 zfs rollback should pass target snapshot to kernel
[FreeBSD/FreeBSD.git] / contrib / llvm / lib / Target / NVPTX / NVPTXTargetObjectFile.h
1 //===-- NVPTXTargetObjectFile.h - NVPTX Object Info -------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef LLVM_LIB_TARGET_NVPTX_NVPTXTARGETOBJECTFILE_H
11 #define LLVM_LIB_TARGET_NVPTX_NVPTXTARGETOBJECTFILE_H
12
13 #include "NVPTXSection.h"
14 #include "llvm/MC/MCSection.h"
15 #include "llvm/MC/SectionKind.h"
16 #include "llvm/Target/TargetLoweringObjectFile.h"
17
18 namespace llvm {
19
20 class NVPTXTargetObjectFile : public TargetLoweringObjectFile {
21 public:
22   NVPTXTargetObjectFile() {
23     TextSection = nullptr;
24     DataSection = nullptr;
25     BSSSection = nullptr;
26     ReadOnlySection = nullptr;
27
28     StaticCtorSection = nullptr;
29     StaticDtorSection = nullptr;
30     LSDASection = nullptr;
31     EHFrameSection = nullptr;
32     DwarfAbbrevSection = nullptr;
33     DwarfInfoSection = nullptr;
34     DwarfLineSection = nullptr;
35     DwarfFrameSection = nullptr;
36     DwarfPubTypesSection = nullptr;
37     DwarfDebugInlineSection = nullptr;
38     DwarfStrSection = nullptr;
39     DwarfLocSection = nullptr;
40     DwarfARangesSection = nullptr;
41     DwarfRangesSection = nullptr;
42     DwarfMacinfoSection = nullptr;
43   }
44
45   ~NVPTXTargetObjectFile() override;
46
47   void Initialize(MCContext &ctx, const TargetMachine &TM) override {
48     TargetLoweringObjectFile::Initialize(ctx, TM);
49     TextSection = new NVPTXSection(MCSection::SV_ELF, SectionKind::getText());
50     DataSection = new NVPTXSection(MCSection::SV_ELF, SectionKind::getData());
51     BSSSection = new NVPTXSection(MCSection::SV_ELF, SectionKind::getBSS());
52     ReadOnlySection =
53         new NVPTXSection(MCSection::SV_ELF, SectionKind::getReadOnly());
54     StaticCtorSection =
55         new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
56     StaticDtorSection =
57         new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
58     LSDASection =
59         new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
60     EHFrameSection =
61         new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
62     DwarfAbbrevSection =
63         new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
64     DwarfInfoSection =
65         new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
66     DwarfLineSection =
67         new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
68     DwarfFrameSection =
69         new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
70     DwarfPubTypesSection =
71         new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
72     DwarfDebugInlineSection =
73         new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
74     DwarfStrSection =
75         new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
76     DwarfLocSection =
77         new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
78     DwarfARangesSection =
79         new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
80     DwarfRangesSection =
81         new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
82     DwarfMacinfoSection =
83         new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
84   }
85
86   MCSection *getSectionForConstant(const DataLayout &DL, SectionKind Kind,
87                                    const Constant *C,
88                                    unsigned &Align) const override {
89     return ReadOnlySection;
90   }
91
92   MCSection *getExplicitSectionGlobal(const GlobalObject *GO, SectionKind Kind,
93                                       const TargetMachine &TM) const override {
94     return DataSection;
95   }
96
97   MCSection *SelectSectionForGlobal(const GlobalObject *GO, SectionKind Kind,
98                                     const TargetMachine &TM) const override;
99 };
100
101 } // end namespace llvm
102
103 #endif // LLVM_LIB_TARGET_NVPTX_NVPTXTARGETOBJECTFILE_H