blob: 69c59d0296ab042cbe969213cc846efb7a5c588b [file] [log] [blame]
Justin Holewinskiae556d32012-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
Benjamin Kramera7c40ef2014-08-13 16:26:38 +000010#ifndef LLVM_LIB_TARGET_NVPTX_NVPTXTARGETOBJECTFILE_H
11#define LLVM_LIB_TARGET_NVPTX_NVPTXTARGETOBJECTFILE_H
Justin Holewinskiae556d32012-05-04 20:18:50 +000012
13#include "NVPTXSection.h"
Eugene Zelenkoc9f1f6b2017-01-09 22:16:51 +000014#include "llvm/MC/MCSection.h"
15#include "llvm/MC/SectionKind.h"
Justin Holewinskiae556d32012-05-04 20:18:50 +000016#include "llvm/Target/TargetLoweringObjectFile.h"
Justin Holewinskiae556d32012-05-04 20:18:50 +000017
18namespace llvm {
Justin Holewinskiae556d32012-05-04 20:18:50 +000019
20class NVPTXTargetObjectFile : public TargetLoweringObjectFile {
Justin Holewinskiae556d32012-05-04 20:18:50 +000021public:
NAKAMURA Takumif7f58942013-06-24 13:19:41 +000022 NVPTXTargetObjectFile() {
Craig Toppere73658d2014-04-28 04:05:08 +000023 TextSection = nullptr;
24 DataSection = nullptr;
25 BSSSection = nullptr;
26 ReadOnlySection = nullptr;
NAKAMURA Takumif7f58942013-06-24 13:19:41 +000027
Craig Toppere73658d2014-04-28 04:05:08 +000028 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;
Amjad Aboudd7cfb482016-01-07 14:28:20 +000042 DwarfMacinfoSection = nullptr;
NAKAMURA Takumif7f58942013-06-24 13:19:41 +000043 }
44
Eugene Zelenkoc9f1f6b2017-01-09 22:16:51 +000045 ~NVPTXTargetObjectFile() override;
Justin Holewinskiae556d32012-05-04 20:18:50 +000046
Craig Topper73156022014-03-02 09:09:27 +000047 void Initialize(MCContext &ctx, const TargetMachine &TM) override {
Rafael Espindolae133ed82013-10-29 17:28:26 +000048 TargetLoweringObjectFile::Initialize(ctx, TM);
Justin Holewinski0497ab12013-03-30 14:29:21 +000049 TextSection = new NVPTXSection(MCSection::SV_ELF, SectionKind::getText());
Rafael Espindola449711c2015-11-18 06:02:15 +000050 DataSection = new NVPTXSection(MCSection::SV_ELF, SectionKind::getData());
Justin Holewinski0497ab12013-03-30 14:29:21 +000051 BSSSection = new NVPTXSection(MCSection::SV_ELF, SectionKind::getBSS());
52 ReadOnlySection =
53 new NVPTXSection(MCSection::SV_ELF, SectionKind::getReadOnly());
Justin Holewinski0497ab12013-03-30 14:29:21 +000054 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());
Amjad Aboudd7cfb482016-01-07 14:28:20 +000082 DwarfMacinfoSection =
83 new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
Eric Christopherd666bb02012-05-08 20:45:04 +000084 }
Justin Holewinskiae556d32012-05-04 20:18:50 +000085
Mehdi Amini5c0fa582015-07-16 06:04:17 +000086 MCSection *getSectionForConstant(const DataLayout &DL, SectionKind Kind,
David Majnemer78f46be2016-02-21 01:40:04 +000087 const Constant *C,
88 unsigned &Align) const override {
Justin Holewinskiae556d32012-05-04 20:18:50 +000089 return ReadOnlySection;
Eric Christopherd666bb02012-05-08 20:45:04 +000090 }
Justin Holewinskiae556d32012-05-04 20:18:50 +000091
Peter Collingbourne67335642016-10-24 19:23:39 +000092 MCSection *getExplicitSectionGlobal(const GlobalObject *GO, SectionKind Kind,
Rafael Espindola0709a7b2015-05-21 19:20:38 +000093 const TargetMachine &TM) const override {
Justin Holewinskiae556d32012-05-04 20:18:50 +000094 return DataSection;
Eric Christopherd666bb02012-05-08 20:45:04 +000095 }
Justin Holewinskiae556d32012-05-04 20:18:50 +000096
Peter Collingbourne67335642016-10-24 19:23:39 +000097 MCSection *SelectSectionForGlobal(const GlobalObject *GO, SectionKind Kind,
Rafael Espindola0709a7b2015-05-21 19:20:38 +000098 const TargetMachine &TM) const override;
Justin Holewinskiae556d32012-05-04 20:18:50 +000099};
100
101} // end namespace llvm
102
Eugene Zelenkoc9f1f6b2017-01-09 22:16:51 +0000103#endif // LLVM_LIB_TARGET_NVPTX_NVPTXTARGETOBJECTFILE_H