Justin Holewinski | ae556d3 | 2012-05-04 20:18:50 +0000 | [diff] [blame] | 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 | |
Benjamin Kramer | a7c40ef | 2014-08-13 16:26:38 +0000 | [diff] [blame] | 10 | #ifndef LLVM_LIB_TARGET_NVPTX_NVPTXTARGETOBJECTFILE_H |
| 11 | #define LLVM_LIB_TARGET_NVPTX_NVPTXTARGETOBJECTFILE_H |
Justin Holewinski | ae556d3 | 2012-05-04 20:18:50 +0000 | [diff] [blame] | 12 | |
| 13 | #include "NVPTXSection.h" |
Eugene Zelenko | c9f1f6b | 2017-01-09 22:16:51 +0000 | [diff] [blame] | 14 | #include "llvm/MC/MCSection.h" |
| 15 | #include "llvm/MC/SectionKind.h" |
Justin Holewinski | ae556d3 | 2012-05-04 20:18:50 +0000 | [diff] [blame] | 16 | #include "llvm/Target/TargetLoweringObjectFile.h" |
Justin Holewinski | ae556d3 | 2012-05-04 20:18:50 +0000 | [diff] [blame] | 17 | |
| 18 | namespace llvm { |
Justin Holewinski | ae556d3 | 2012-05-04 20:18:50 +0000 | [diff] [blame] | 19 | |
| 20 | class NVPTXTargetObjectFile : public TargetLoweringObjectFile { |
Justin Holewinski | ae556d3 | 2012-05-04 20:18:50 +0000 | [diff] [blame] | 21 | public: |
NAKAMURA Takumi | f7f5894 | 2013-06-24 13:19:41 +0000 | [diff] [blame] | 22 | NVPTXTargetObjectFile() { |
Craig Topper | e73658d | 2014-04-28 04:05:08 +0000 | [diff] [blame] | 23 | TextSection = nullptr; |
| 24 | DataSection = nullptr; |
| 25 | BSSSection = nullptr; |
| 26 | ReadOnlySection = nullptr; |
NAKAMURA Takumi | f7f5894 | 2013-06-24 13:19:41 +0000 | [diff] [blame] | 27 | |
Craig Topper | e73658d | 2014-04-28 04:05:08 +0000 | [diff] [blame] | 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; |
Amjad Aboud | d7cfb48 | 2016-01-07 14:28:20 +0000 | [diff] [blame] | 42 | DwarfMacinfoSection = nullptr; |
NAKAMURA Takumi | f7f5894 | 2013-06-24 13:19:41 +0000 | [diff] [blame] | 43 | } |
| 44 | |
Eugene Zelenko | c9f1f6b | 2017-01-09 22:16:51 +0000 | [diff] [blame] | 45 | ~NVPTXTargetObjectFile() override; |
Justin Holewinski | ae556d3 | 2012-05-04 20:18:50 +0000 | [diff] [blame] | 46 | |
Craig Topper | 7315602 | 2014-03-02 09:09:27 +0000 | [diff] [blame] | 47 | void Initialize(MCContext &ctx, const TargetMachine &TM) override { |
Rafael Espindola | e133ed8 | 2013-10-29 17:28:26 +0000 | [diff] [blame] | 48 | TargetLoweringObjectFile::Initialize(ctx, TM); |
Justin Holewinski | 0497ab1 | 2013-03-30 14:29:21 +0000 | [diff] [blame] | 49 | TextSection = new NVPTXSection(MCSection::SV_ELF, SectionKind::getText()); |
Rafael Espindola | 449711c | 2015-11-18 06:02:15 +0000 | [diff] [blame] | 50 | DataSection = new NVPTXSection(MCSection::SV_ELF, SectionKind::getData()); |
Justin Holewinski | 0497ab1 | 2013-03-30 14:29:21 +0000 | [diff] [blame] | 51 | BSSSection = new NVPTXSection(MCSection::SV_ELF, SectionKind::getBSS()); |
| 52 | ReadOnlySection = |
| 53 | new NVPTXSection(MCSection::SV_ELF, SectionKind::getReadOnly()); |
Justin Holewinski | 0497ab1 | 2013-03-30 14:29:21 +0000 | [diff] [blame] | 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()); |
Amjad Aboud | d7cfb48 | 2016-01-07 14:28:20 +0000 | [diff] [blame] | 82 | DwarfMacinfoSection = |
| 83 | new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); |
Eric Christopher | d666bb0 | 2012-05-08 20:45:04 +0000 | [diff] [blame] | 84 | } |
Justin Holewinski | ae556d3 | 2012-05-04 20:18:50 +0000 | [diff] [blame] | 85 | |
Mehdi Amini | 5c0fa58 | 2015-07-16 06:04:17 +0000 | [diff] [blame] | 86 | MCSection *getSectionForConstant(const DataLayout &DL, SectionKind Kind, |
David Majnemer | 78f46be | 2016-02-21 01:40:04 +0000 | [diff] [blame] | 87 | const Constant *C, |
| 88 | unsigned &Align) const override { |
Justin Holewinski | ae556d3 | 2012-05-04 20:18:50 +0000 | [diff] [blame] | 89 | return ReadOnlySection; |
Eric Christopher | d666bb0 | 2012-05-08 20:45:04 +0000 | [diff] [blame] | 90 | } |
Justin Holewinski | ae556d3 | 2012-05-04 20:18:50 +0000 | [diff] [blame] | 91 | |
Peter Collingbourne | 6733564 | 2016-10-24 19:23:39 +0000 | [diff] [blame] | 92 | MCSection *getExplicitSectionGlobal(const GlobalObject *GO, SectionKind Kind, |
Rafael Espindola | 0709a7b | 2015-05-21 19:20:38 +0000 | [diff] [blame] | 93 | const TargetMachine &TM) const override { |
Justin Holewinski | ae556d3 | 2012-05-04 20:18:50 +0000 | [diff] [blame] | 94 | return DataSection; |
Eric Christopher | d666bb0 | 2012-05-08 20:45:04 +0000 | [diff] [blame] | 95 | } |
Justin Holewinski | ae556d3 | 2012-05-04 20:18:50 +0000 | [diff] [blame] | 96 | |
Peter Collingbourne | 6733564 | 2016-10-24 19:23:39 +0000 | [diff] [blame] | 97 | MCSection *SelectSectionForGlobal(const GlobalObject *GO, SectionKind Kind, |
Rafael Espindola | 0709a7b | 2015-05-21 19:20:38 +0000 | [diff] [blame] | 98 | const TargetMachine &TM) const override; |
Justin Holewinski | ae556d3 | 2012-05-04 20:18:50 +0000 | [diff] [blame] | 99 | }; |
| 100 | |
| 101 | } // end namespace llvm |
| 102 | |
Eugene Zelenko | c9f1f6b | 2017-01-09 22:16:51 +0000 | [diff] [blame] | 103 | #endif // LLVM_LIB_TARGET_NVPTX_NVPTXTARGETOBJECTFILE_H |