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" |
| 14 | #include "llvm/Target/TargetLoweringObjectFile.h" |
| 15 | #include <string> |
| 16 | |
| 17 | namespace llvm { |
| 18 | class GlobalVariable; |
| 19 | class Module; |
| 20 | |
| 21 | class NVPTXTargetObjectFile : public TargetLoweringObjectFile { |
| 22 | |
| 23 | public: |
NAKAMURA Takumi | f7f5894 | 2013-06-24 13:19:41 +0000 | [diff] [blame] | 24 | NVPTXTargetObjectFile() { |
Craig Topper | e73658d | 2014-04-28 04:05:08 +0000 | [diff] [blame] | 25 | TextSection = nullptr; |
| 26 | DataSection = nullptr; |
| 27 | BSSSection = nullptr; |
| 28 | ReadOnlySection = nullptr; |
NAKAMURA Takumi | f7f5894 | 2013-06-24 13:19:41 +0000 | [diff] [blame] | 29 | |
Craig Topper | e73658d | 2014-04-28 04:05:08 +0000 | [diff] [blame] | 30 | StaticCtorSection = nullptr; |
| 31 | StaticDtorSection = nullptr; |
| 32 | LSDASection = nullptr; |
| 33 | EHFrameSection = nullptr; |
| 34 | DwarfAbbrevSection = nullptr; |
| 35 | DwarfInfoSection = nullptr; |
| 36 | DwarfLineSection = nullptr; |
| 37 | DwarfFrameSection = nullptr; |
| 38 | DwarfPubTypesSection = nullptr; |
| 39 | DwarfDebugInlineSection = nullptr; |
| 40 | DwarfStrSection = nullptr; |
| 41 | DwarfLocSection = nullptr; |
| 42 | DwarfARangesSection = nullptr; |
| 43 | DwarfRangesSection = nullptr; |
| 44 | DwarfMacroInfoSection = nullptr; |
NAKAMURA Takumi | f7f5894 | 2013-06-24 13:19:41 +0000 | [diff] [blame] | 45 | } |
| 46 | |
Juergen Ributzka | d12ccbd | 2013-11-19 00:57:56 +0000 | [diff] [blame] | 47 | virtual ~NVPTXTargetObjectFile(); |
Justin Holewinski | ae556d3 | 2012-05-04 20:18:50 +0000 | [diff] [blame] | 48 | |
Craig Topper | 7315602 | 2014-03-02 09:09:27 +0000 | [diff] [blame] | 49 | void Initialize(MCContext &ctx, const TargetMachine &TM) override { |
Rafael Espindola | e133ed8 | 2013-10-29 17:28:26 +0000 | [diff] [blame] | 50 | TargetLoweringObjectFile::Initialize(ctx, TM); |
Justin Holewinski | 0497ab1 | 2013-03-30 14:29:21 +0000 | [diff] [blame] | 51 | TextSection = new NVPTXSection(MCSection::SV_ELF, SectionKind::getText()); |
| 52 | DataSection = |
| 53 | new NVPTXSection(MCSection::SV_ELF, SectionKind::getDataRel()); |
| 54 | BSSSection = new NVPTXSection(MCSection::SV_ELF, SectionKind::getBSS()); |
| 55 | ReadOnlySection = |
| 56 | new NVPTXSection(MCSection::SV_ELF, SectionKind::getReadOnly()); |
Justin Holewinski | ae556d3 | 2012-05-04 20:18:50 +0000 | [diff] [blame] | 57 | |
Justin Holewinski | 0497ab1 | 2013-03-30 14:29:21 +0000 | [diff] [blame] | 58 | StaticCtorSection = |
| 59 | new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); |
| 60 | StaticDtorSection = |
| 61 | new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); |
| 62 | LSDASection = |
| 63 | new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); |
| 64 | EHFrameSection = |
| 65 | new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); |
| 66 | DwarfAbbrevSection = |
| 67 | new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); |
| 68 | DwarfInfoSection = |
| 69 | new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); |
| 70 | DwarfLineSection = |
| 71 | new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); |
| 72 | DwarfFrameSection = |
| 73 | new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); |
| 74 | DwarfPubTypesSection = |
| 75 | new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); |
| 76 | DwarfDebugInlineSection = |
| 77 | new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); |
| 78 | DwarfStrSection = |
| 79 | new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); |
| 80 | DwarfLocSection = |
| 81 | new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); |
| 82 | DwarfARangesSection = |
| 83 | new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); |
| 84 | DwarfRangesSection = |
| 85 | new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); |
| 86 | DwarfMacroInfoSection = |
| 87 | new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); |
Eric Christopher | d666bb0 | 2012-05-08 20:45:04 +0000 | [diff] [blame] | 88 | } |
Justin Holewinski | ae556d3 | 2012-05-04 20:18:50 +0000 | [diff] [blame] | 89 | |
David Majnemer | 8bce66b | 2014-07-14 22:57:27 +0000 | [diff] [blame] | 90 | const MCSection *getSectionForConstant(SectionKind Kind, |
| 91 | const Constant *C) const override { |
Justin Holewinski | ae556d3 | 2012-05-04 20:18:50 +0000 | [diff] [blame] | 92 | return ReadOnlySection; |
Eric Christopher | d666bb0 | 2012-05-08 20:45:04 +0000 | [diff] [blame] | 93 | } |
Justin Holewinski | ae556d3 | 2012-05-04 20:18:50 +0000 | [diff] [blame] | 94 | |
Rafael Espindola | 1070501 | 2014-02-08 06:07:27 +0000 | [diff] [blame] | 95 | const MCSection *getExplicitSectionGlobal(const GlobalValue *GV, |
Craig Topper | 7315602 | 2014-03-02 09:09:27 +0000 | [diff] [blame] | 96 | SectionKind Kind, Mangler &Mang, |
| 97 | const TargetMachine &TM) const override { |
Justin Holewinski | ae556d3 | 2012-05-04 20:18:50 +0000 | [diff] [blame] | 98 | return DataSection; |
Eric Christopher | d666bb0 | 2012-05-08 20:45:04 +0000 | [diff] [blame] | 99 | } |
Justin Holewinski | ae556d3 | 2012-05-04 20:18:50 +0000 | [diff] [blame] | 100 | |
| 101 | }; |
| 102 | |
| 103 | } // end namespace llvm |
| 104 | |
| 105 | #endif |