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: NVPTXTargetObjectFile()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 } 45 46 virtual ~NVPTXTargetObjectFile(); 47 Initialize(MCContext & ctx,const TargetMachine & TM)48 void Initialize(MCContext &ctx, const TargetMachine &TM) override { 49 TargetLoweringObjectFile::Initialize(ctx, TM); 50 TextSection = new NVPTXSection(MCSection::SV_ELF, SectionKind::getText()); 51 DataSection = 52 new NVPTXSection(MCSection::SV_ELF, SectionKind::getDataRel()); 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 } 86 getSectionForConstant(SectionKind Kind,const Constant * C)87 const MCSection *getSectionForConstant(SectionKind Kind, 88 const Constant *C) const override { 89 return ReadOnlySection; 90 } 91 getExplicitSectionGlobal(const GlobalValue * GV,SectionKind Kind,Mangler & Mang,const TargetMachine & TM)92 const MCSection *getExplicitSectionGlobal(const GlobalValue *GV, 93 SectionKind Kind, Mangler &Mang, 94 const TargetMachine &TM) const override { 95 return DataSection; 96 } 97 98 const MCSection * 99 SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, Mangler &Mang, 100 const TargetMachine &TM) const override; 101 }; 102 103 } // end namespace llvm 104 105 #endif 106