NVPTXTargetObjectFile.h revision 93cf0939f95b3d580d9c05375a7c84164e1ba72e
149683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski//===-- NVPTXTargetObjectFile.h - NVPTX Object Info -------------*- C++ -*-===// 249683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski// 349683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski// The LLVM Compiler Infrastructure 449683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski// 549683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski// This file is distributed under the University of Illinois Open Source 649683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski// License. See LICENSE.TXT for details. 749683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski// 849683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski//===----------------------------------------------------------------------===// 949683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski 1049683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski#ifndef LLVM_TARGET_NVPTX_TARGETOBJECTFILE_H 1149683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski#define LLVM_TARGET_NVPTX_TARGETOBJECTFILE_H 1249683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski 1349683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski#include "NVPTXSection.h" 1449683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski#include "llvm/Target/TargetLoweringObjectFile.h" 1549683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski#include <string> 1649683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski 1749683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinskinamespace llvm { 1849683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinskiclass GlobalVariable; 1949683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinskiclass Module; 2049683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski 2149683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinskiclass NVPTXTargetObjectFile : public TargetLoweringObjectFile { 2249683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski 2349683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinskipublic: 24f1505ff35bf76cb044c261b4cc97773d47658805NAKAMURA Takumi NVPTXTargetObjectFile() { 25f1505ff35bf76cb044c261b4cc97773d47658805NAKAMURA Takumi TextSection = 0; 26f1505ff35bf76cb044c261b4cc97773d47658805NAKAMURA Takumi DataSection = 0; 27f1505ff35bf76cb044c261b4cc97773d47658805NAKAMURA Takumi BSSSection = 0; 28f1505ff35bf76cb044c261b4cc97773d47658805NAKAMURA Takumi ReadOnlySection = 0; 29f1505ff35bf76cb044c261b4cc97773d47658805NAKAMURA Takumi 30f1505ff35bf76cb044c261b4cc97773d47658805NAKAMURA Takumi StaticCtorSection = 0; 31f1505ff35bf76cb044c261b4cc97773d47658805NAKAMURA Takumi StaticDtorSection = 0; 32f1505ff35bf76cb044c261b4cc97773d47658805NAKAMURA Takumi LSDASection = 0; 33f1505ff35bf76cb044c261b4cc97773d47658805NAKAMURA Takumi EHFrameSection = 0; 34f1505ff35bf76cb044c261b4cc97773d47658805NAKAMURA Takumi DwarfAbbrevSection = 0; 35f1505ff35bf76cb044c261b4cc97773d47658805NAKAMURA Takumi DwarfInfoSection = 0; 36f1505ff35bf76cb044c261b4cc97773d47658805NAKAMURA Takumi DwarfLineSection = 0; 37f1505ff35bf76cb044c261b4cc97773d47658805NAKAMURA Takumi DwarfFrameSection = 0; 38f1505ff35bf76cb044c261b4cc97773d47658805NAKAMURA Takumi DwarfPubTypesSection = 0; 39f1505ff35bf76cb044c261b4cc97773d47658805NAKAMURA Takumi DwarfDebugInlineSection = 0; 40f1505ff35bf76cb044c261b4cc97773d47658805NAKAMURA Takumi DwarfStrSection = 0; 41f1505ff35bf76cb044c261b4cc97773d47658805NAKAMURA Takumi DwarfLocSection = 0; 42f1505ff35bf76cb044c261b4cc97773d47658805NAKAMURA Takumi DwarfARangesSection = 0; 43f1505ff35bf76cb044c261b4cc97773d47658805NAKAMURA Takumi DwarfRangesSection = 0; 44f1505ff35bf76cb044c261b4cc97773d47658805NAKAMURA Takumi DwarfMacroInfoSection = 0; 45f1505ff35bf76cb044c261b4cc97773d47658805NAKAMURA Takumi } 46f1505ff35bf76cb044c261b4cc97773d47658805NAKAMURA Takumi 4749683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski ~NVPTXTargetObjectFile() { 4849683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski delete TextSection; 4949683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski delete DataSection; 5049683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski delete BSSSection; 5149683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski delete ReadOnlySection; 5249683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski 5349683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski delete StaticCtorSection; 5449683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski delete StaticDtorSection; 5549683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski delete LSDASection; 5649683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski delete EHFrameSection; 5749683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski delete DwarfAbbrevSection; 5849683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski delete DwarfInfoSection; 5949683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski delete DwarfLineSection; 6049683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski delete DwarfFrameSection; 6149683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski delete DwarfPubTypesSection; 6249683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski delete DwarfDebugInlineSection; 6349683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski delete DwarfStrSection; 6449683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski delete DwarfLocSection; 6549683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski delete DwarfARangesSection; 6649683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski delete DwarfRangesSection; 6749683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski delete DwarfMacroInfoSection; 6822b291abd855ccf013381a9d6939d918181b0e0eEric Christopher } 6949683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski 7049683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski virtual void Initialize(MCContext &ctx, const TargetMachine &TM) { 7193cf0939f95b3d580d9c05375a7c84164e1ba72eRafael Espindola TargetLoweringObjectFile::Initialize(ctx, TM); 723639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski TextSection = new NVPTXSection(MCSection::SV_ELF, SectionKind::getText()); 733639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski DataSection = 743639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski new NVPTXSection(MCSection::SV_ELF, SectionKind::getDataRel()); 753639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski BSSSection = new NVPTXSection(MCSection::SV_ELF, SectionKind::getBSS()); 763639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski ReadOnlySection = 773639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski new NVPTXSection(MCSection::SV_ELF, SectionKind::getReadOnly()); 7849683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski 793639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski StaticCtorSection = 803639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); 813639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski StaticDtorSection = 823639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); 833639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski LSDASection = 843639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); 853639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski EHFrameSection = 863639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); 873639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski DwarfAbbrevSection = 883639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); 893639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski DwarfInfoSection = 903639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); 913639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski DwarfLineSection = 923639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); 933639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski DwarfFrameSection = 943639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); 953639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski DwarfPubTypesSection = 963639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); 973639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski DwarfDebugInlineSection = 983639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); 993639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski DwarfStrSection = 1003639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); 1013639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski DwarfLocSection = 1023639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); 1033639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski DwarfARangesSection = 1043639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); 1053639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski DwarfRangesSection = 1063639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); 1073639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski DwarfMacroInfoSection = 1083639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata()); 10922b291abd855ccf013381a9d6939d918181b0e0eEric Christopher } 11049683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski 11149683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski virtual const MCSection *getSectionForConstant(SectionKind Kind) const { 11249683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski return ReadOnlySection; 11322b291abd855ccf013381a9d6939d918181b0e0eEric Christopher } 11449683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski 11549683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski virtual const MCSection * 11649683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind, 1173639ce2575660a0e6938d2e84e8bd9a738fd7051Justin Holewinski Mangler *Mang, const TargetMachine &TM) const { 11849683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski return DataSection; 11922b291abd855ccf013381a9d6939d918181b0e0eEric Christopher } 12049683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski 12149683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski}; 12249683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski 12349683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski} // end namespace llvm 12449683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski 12549683f3c961379fbc088871a5d6304950f1f1cbcJustin Holewinski#endif 126