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 10 #ifndef LLVM_LIB_TARGET_NVPTX_NVPTXTARGETOBJECTFILE_H 11 #define LLVM_LIB_TARGET_NVPTX_NVPTXTARGETOBJECTFILE_H 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: 24 NVPTXTargetObjectFile() { 25 TextSection = nullptr; 26 DataSection = nullptr; 27 BSSSection = nullptr; 28 ReadOnlySection = nullptr; 29 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 DwarfMacinfoSection = nullptr; 45 } 46 47 virtual ~NVPTXTargetObjectFile(); 48 49 void Initialize(MCContext &ctx, const TargetMachine &TM) override { 50 TargetLoweringObjectFile::Initialize(ctx, TM); 51 TextSection = new NVPTXSection(MCSection::SV_ELF, SectionKind::getText()); 52 DataSection = new NVPTXSection(MCSection::SV_ELF, SectionKind::getData()); 53 BSSSection = new NVPTXSection(MCSection::SV_ELF, SectionKind::getBSS()); 54 ReadOnlySection = 55 new NVPTXSection(MCSection::SV_ELF, SectionKind::getReadOnly()); 56 57 StaticCtorSection = 58 new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); 59 StaticDtorSection = 60 new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); 61 LSDASection = 62 new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); 63 EHFrameSection = 64 new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); 65 DwarfAbbrevSection = 66 new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); 67 DwarfInfoSection = 68 new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); 69 DwarfLineSection = 70 new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); 71 DwarfFrameSection = 72 new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); 73 DwarfPubTypesSection = 74 new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); 75 DwarfDebugInlineSection = 76 new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); 77 DwarfStrSection = 78 new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); 79 DwarfLocSection = 80 new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); 81 DwarfARangesSection = 82 new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); 83 DwarfRangesSection = 84 new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); 85 DwarfMacinfoSection = 86 new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); 87 } 88 89 MCSection *getSectionForConstant(const DataLayout &DL, SectionKind Kind, 90 const Constant *C) const override { 91 return ReadOnlySection; 92 } 93 94 MCSection *getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind, 95 Mangler &Mang, 96 const TargetMachine &TM) const override { 97 return DataSection; 98 } 99 100 MCSection *SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, 101 Mangler &Mang, 102 const TargetMachine &TM) const override; 103 }; 104 105 } // end namespace llvm 106 107 #endif 108