blob: 1449f52a966c84db485cbc2f2e5e92c443bd9967 [file] [log] [blame]
Justin Holewinski49683f32012-05-04 20:18:50 +00001//===-- 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_TARGET_NVPTX_TARGETOBJECTFILE_H
11#define LLVM_TARGET_NVPTX_TARGETOBJECTFILE_H
12
13#include "NVPTXSection.h"
14#include "llvm/Target/TargetLoweringObjectFile.h"
15#include <string>
16
17namespace llvm {
18class GlobalVariable;
19class Module;
20
21class NVPTXTargetObjectFile : public TargetLoweringObjectFile {
22
23public:
NAKAMURA Takumif1505ff2013-06-24 13:19:41 +000024 NVPTXTargetObjectFile() {
25 TextSection = 0;
26 DataSection = 0;
27 BSSSection = 0;
28 ReadOnlySection = 0;
29
30 StaticCtorSection = 0;
31 StaticDtorSection = 0;
32 LSDASection = 0;
33 EHFrameSection = 0;
34 DwarfAbbrevSection = 0;
35 DwarfInfoSection = 0;
36 DwarfLineSection = 0;
37 DwarfFrameSection = 0;
38 DwarfPubTypesSection = 0;
39 DwarfDebugInlineSection = 0;
40 DwarfStrSection = 0;
41 DwarfLocSection = 0;
42 DwarfARangesSection = 0;
43 DwarfRangesSection = 0;
44 DwarfMacroInfoSection = 0;
45 }
46
Justin Holewinski49683f32012-05-04 20:18:50 +000047 ~NVPTXTargetObjectFile() {
48 delete TextSection;
49 delete DataSection;
50 delete BSSSection;
51 delete ReadOnlySection;
52
53 delete StaticCtorSection;
54 delete StaticDtorSection;
55 delete LSDASection;
56 delete EHFrameSection;
57 delete DwarfAbbrevSection;
58 delete DwarfInfoSection;
59 delete DwarfLineSection;
60 delete DwarfFrameSection;
61 delete DwarfPubTypesSection;
62 delete DwarfDebugInlineSection;
63 delete DwarfStrSection;
64 delete DwarfLocSection;
65 delete DwarfARangesSection;
66 delete DwarfRangesSection;
67 delete DwarfMacroInfoSection;
Eric Christopher22b291a2012-05-08 20:45:04 +000068 }
Justin Holewinski49683f32012-05-04 20:18:50 +000069
70 virtual void Initialize(MCContext &ctx, const TargetMachine &TM) {
Rafael Espindola93cf0932013-10-29 17:28:26 +000071 TargetLoweringObjectFile::Initialize(ctx, TM);
Justin Holewinski3639ce22013-03-30 14:29:21 +000072 TextSection = new NVPTXSection(MCSection::SV_ELF, SectionKind::getText());
73 DataSection =
74 new NVPTXSection(MCSection::SV_ELF, SectionKind::getDataRel());
75 BSSSection = new NVPTXSection(MCSection::SV_ELF, SectionKind::getBSS());
76 ReadOnlySection =
77 new NVPTXSection(MCSection::SV_ELF, SectionKind::getReadOnly());
Justin Holewinski49683f32012-05-04 20:18:50 +000078
Justin Holewinski3639ce22013-03-30 14:29:21 +000079 StaticCtorSection =
80 new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
81 StaticDtorSection =
82 new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
83 LSDASection =
84 new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
85 EHFrameSection =
86 new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
87 DwarfAbbrevSection =
88 new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
89 DwarfInfoSection =
90 new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
91 DwarfLineSection =
92 new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
93 DwarfFrameSection =
94 new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
95 DwarfPubTypesSection =
96 new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
97 DwarfDebugInlineSection =
98 new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
99 DwarfStrSection =
100 new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
101 DwarfLocSection =
102 new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
103 DwarfARangesSection =
104 new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
105 DwarfRangesSection =
106 new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
107 DwarfMacroInfoSection =
108 new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
Eric Christopher22b291a2012-05-08 20:45:04 +0000109 }
Justin Holewinski49683f32012-05-04 20:18:50 +0000110
111 virtual const MCSection *getSectionForConstant(SectionKind Kind) const {
112 return ReadOnlySection;
Eric Christopher22b291a2012-05-08 20:45:04 +0000113 }
Justin Holewinski49683f32012-05-04 20:18:50 +0000114
115 virtual const MCSection *
116 getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
Justin Holewinski3639ce22013-03-30 14:29:21 +0000117 Mangler *Mang, const TargetMachine &TM) const {
Justin Holewinski49683f32012-05-04 20:18:50 +0000118 return DataSection;
Eric Christopher22b291a2012-05-08 20:45:04 +0000119 }
Justin Holewinski49683f32012-05-04 20:18:50 +0000120
121};
122
123} // end namespace llvm
124
125#endif