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