blob: 6ab0e08ad091506536c4786591ecc1c05858dcd1 [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:
Eric Christopher22b291a2012-05-08 20:45:04 +000024 NVPTXTargetObjectFile() {}
Justin Holewinski49683f32012-05-04 20:18:50 +000025 ~NVPTXTargetObjectFile() {
26 delete TextSection;
27 delete DataSection;
28 delete BSSSection;
29 delete ReadOnlySection;
30
31 delete StaticCtorSection;
32 delete StaticDtorSection;
33 delete LSDASection;
34 delete EHFrameSection;
35 delete DwarfAbbrevSection;
36 delete DwarfInfoSection;
37 delete DwarfLineSection;
38 delete DwarfFrameSection;
39 delete DwarfPubTypesSection;
40 delete DwarfDebugInlineSection;
41 delete DwarfStrSection;
42 delete DwarfLocSection;
43 delete DwarfARangesSection;
44 delete DwarfRangesSection;
45 delete DwarfMacroInfoSection;
Eric Christopher22b291a2012-05-08 20:45:04 +000046 }
Justin Holewinski49683f32012-05-04 20:18:50 +000047
48 virtual void Initialize(MCContext &ctx, const TargetMachine &TM) {
Justin Holewinski3639ce22013-03-30 14:29:21 +000049 TextSection = new NVPTXSection(MCSection::SV_ELF, SectionKind::getText());
50 DataSection =
51 new NVPTXSection(MCSection::SV_ELF, SectionKind::getDataRel());
52 BSSSection = new NVPTXSection(MCSection::SV_ELF, SectionKind::getBSS());
53 ReadOnlySection =
54 new NVPTXSection(MCSection::SV_ELF, SectionKind::getReadOnly());
Justin Holewinski49683f32012-05-04 20:18:50 +000055
Justin Holewinski3639ce22013-03-30 14:29:21 +000056 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 DwarfMacroInfoSection =
85 new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
Eric Christopher22b291a2012-05-08 20:45:04 +000086 }
Justin Holewinski49683f32012-05-04 20:18:50 +000087
88 virtual const MCSection *getSectionForConstant(SectionKind Kind) const {
89 return ReadOnlySection;
Eric Christopher22b291a2012-05-08 20:45:04 +000090 }
Justin Holewinski49683f32012-05-04 20:18:50 +000091
92 virtual const MCSection *
93 getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
Justin Holewinski3639ce22013-03-30 14:29:21 +000094 Mangler *Mang, const TargetMachine &TM) const {
Justin Holewinski49683f32012-05-04 20:18:50 +000095 return DataSection;
Eric Christopher22b291a2012-05-08 20:45:04 +000096 }
Justin Holewinski49683f32012-05-04 20:18:50 +000097
98};
99
100} // end namespace llvm
101
102#endif