• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/Target/TargetLoweringObjectFile.h"
15 
16 namespace llvm {
17 class GlobalVariable;
18 class Module;
19 
20 class NVPTXTargetObjectFile : public TargetLoweringObjectFile {
21 
22 public:
NVPTXTargetObjectFile()23   NVPTXTargetObjectFile() {
24     TextSection = nullptr;
25     DataSection = nullptr;
26     BSSSection = nullptr;
27     ReadOnlySection = nullptr;
28 
29     StaticCtorSection = nullptr;
30     StaticDtorSection = nullptr;
31     LSDASection = nullptr;
32     EHFrameSection = nullptr;
33     DwarfAbbrevSection = nullptr;
34     DwarfInfoSection = nullptr;
35     DwarfLineSection = nullptr;
36     DwarfFrameSection = nullptr;
37     DwarfPubTypesSection = nullptr;
38     DwarfDebugInlineSection = nullptr;
39     DwarfStrSection = nullptr;
40     DwarfLocSection = nullptr;
41     DwarfARangesSection = nullptr;
42     DwarfRangesSection = nullptr;
43     DwarfMacinfoSection = nullptr;
44   }
45 
46   virtual ~NVPTXTargetObjectFile();
47 
Initialize(MCContext & ctx,const TargetMachine & TM)48   void Initialize(MCContext &ctx, const TargetMachine &TM) override {
49     TargetLoweringObjectFile::Initialize(ctx, TM);
50     TextSection = new NVPTXSection(MCSection::SV_ELF, SectionKind::getText());
51     DataSection = new NVPTXSection(MCSection::SV_ELF, SectionKind::getData());
52     BSSSection = new NVPTXSection(MCSection::SV_ELF, SectionKind::getBSS());
53     ReadOnlySection =
54         new NVPTXSection(MCSection::SV_ELF, SectionKind::getReadOnly());
55 
56     StaticCtorSection =
57         new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
58     StaticDtorSection =
59         new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
60     LSDASection =
61         new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
62     EHFrameSection =
63         new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
64     DwarfAbbrevSection =
65         new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
66     DwarfInfoSection =
67         new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
68     DwarfLineSection =
69         new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
70     DwarfFrameSection =
71         new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
72     DwarfPubTypesSection =
73         new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
74     DwarfDebugInlineSection =
75         new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
76     DwarfStrSection =
77         new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
78     DwarfLocSection =
79         new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
80     DwarfARangesSection =
81         new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
82     DwarfRangesSection =
83         new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
84     DwarfMacinfoSection =
85         new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
86   }
87 
getSectionForConstant(const DataLayout & DL,SectionKind Kind,const Constant * C,unsigned & Align)88   MCSection *getSectionForConstant(const DataLayout &DL, SectionKind Kind,
89                                    const Constant *C,
90                                    unsigned &Align) const override {
91     return ReadOnlySection;
92   }
93 
getExplicitSectionGlobal(const GlobalValue * GV,SectionKind Kind,Mangler & Mang,const TargetMachine & TM)94   MCSection *getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
95                                       Mangler &Mang,
96                                       const TargetMachine &TM) const override {
97     return DataSection;
98   }
99 
100   MCSection *SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
101                                     Mangler &Mang,
102                                     const TargetMachine &TM) const override;
103 };
104 
105 } // end namespace llvm
106 
107 #endif
108