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_TARGET_NVPTX_TARGETOBJECTFILE_H 11 #define LLVM_TARGET_NVPTX_TARGETOBJECTFILE_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 = 0; 26 DataSection = 0; 27 BSSSection = 0; 28 ReadOnlySection = 0; 29 30 StaticCtorSection = 0; 31 StaticDtorSection = 0; 32 LSDASection = 0; 33 EHFrameSection = 0; 34 DwarfAbbrevSection = 0; 35 DwarfInfoSection = 0; 36 DwarfLineSection = 0; 37 DwarfFrameSection = 0; 38 DwarfPubTypesSection = 0; 39 DwarfDebugInlineSection = 0; 40 DwarfStrSection = 0; 41 DwarfLocSection = 0; 42 DwarfARangesSection = 0; 43 DwarfRangesSection = 0; 44 DwarfMacroInfoSection = 0; 45 } 46 47 ~NVPTXTargetObjectFile() { 48 delete TextSection; 49 delete DataSection; 50 delete BSSSection; 51 delete ReadOnlySection; 52 53 delete StaticCtorSection; 54 delete StaticDtorSection; 55 delete LSDASection; 56 delete EHFrameSection; 57 delete DwarfAbbrevSection; 58 delete DwarfInfoSection; 59 delete DwarfLineSection; 60 delete DwarfFrameSection; 61 delete DwarfPubTypesSection; 62 delete DwarfDebugInlineSection; 63 delete DwarfStrSection; 64 delete DwarfLocSection; 65 delete DwarfARangesSection; 66 delete DwarfRangesSection; 67 delete DwarfMacroInfoSection; 68 } 69 70 virtual void Initialize(MCContext &ctx, const TargetMachine &TM) { 71 TextSection = new NVPTXSection(MCSection::SV_ELF, SectionKind::getText()); 72 DataSection = 73 new NVPTXSection(MCSection::SV_ELF, SectionKind::getDataRel()); 74 BSSSection = new NVPTXSection(MCSection::SV_ELF, SectionKind::getBSS()); 75 ReadOnlySection = 76 new NVPTXSection(MCSection::SV_ELF, SectionKind::getReadOnly()); 77 78 StaticCtorSection = 79 new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); 80 StaticDtorSection = 81 new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); 82 LSDASection = 83 new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); 84 EHFrameSection = 85 new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); 86 DwarfAbbrevSection = 87 new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); 88 DwarfInfoSection = 89 new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); 90 DwarfLineSection = 91 new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); 92 DwarfFrameSection = 93 new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); 94 DwarfPubTypesSection = 95 new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); 96 DwarfDebugInlineSection = 97 new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); 98 DwarfStrSection = 99 new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); 100 DwarfLocSection = 101 new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); 102 DwarfARangesSection = 103 new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); 104 DwarfRangesSection = 105 new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); 106 DwarfMacroInfoSection = 107 new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); 108 } 109 110 virtual const MCSection *getSectionForConstant(SectionKind Kind) const { 111 return ReadOnlySection; 112 } 113 114 virtual const MCSection * 115 getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind, 116 Mangler *Mang, const TargetMachine &TM) const { 117 return DataSection; 118 } 119 120 }; 121 122 } // end namespace llvm 123 124 #endif 125