LLVM API Documentation

NVPTXTargetObjectFile.h
Go to the documentation of this file.
00001 //===-- NVPTXTargetObjectFile.h - NVPTX Object Info -------------*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 
00010 #ifndef LLVM_LIB_TARGET_NVPTX_NVPTXTARGETOBJECTFILE_H
00011 #define LLVM_LIB_TARGET_NVPTX_NVPTXTARGETOBJECTFILE_H
00012 
00013 #include "NVPTXSection.h"
00014 #include "llvm/Target/TargetLoweringObjectFile.h"
00015 #include <string>
00016 
00017 namespace llvm {
00018 class GlobalVariable;
00019 class Module;
00020 
00021 class NVPTXTargetObjectFile : public TargetLoweringObjectFile {
00022 
00023 public:
00024   NVPTXTargetObjectFile() {
00025     TextSection = nullptr;
00026     DataSection = nullptr;
00027     BSSSection = nullptr;
00028     ReadOnlySection = nullptr;
00029 
00030     StaticCtorSection = nullptr;
00031     StaticDtorSection = nullptr;
00032     LSDASection = nullptr;
00033     EHFrameSection = nullptr;
00034     DwarfAbbrevSection = nullptr;
00035     DwarfInfoSection = nullptr;
00036     DwarfLineSection = nullptr;
00037     DwarfFrameSection = nullptr;
00038     DwarfPubTypesSection = nullptr;
00039     DwarfDebugInlineSection = nullptr;
00040     DwarfStrSection = nullptr;
00041     DwarfLocSection = nullptr;
00042     DwarfARangesSection = nullptr;
00043     DwarfRangesSection = nullptr;
00044     DwarfMacroInfoSection = nullptr;
00045   }
00046 
00047   virtual ~NVPTXTargetObjectFile();
00048 
00049   void Initialize(MCContext &ctx, const TargetMachine &TM) override {
00050     TargetLoweringObjectFile::Initialize(ctx, TM);
00051     TextSection = new NVPTXSection(MCSection::SV_ELF, SectionKind::getText());
00052     DataSection =
00053         new NVPTXSection(MCSection::SV_ELF, SectionKind::getDataRel());
00054     BSSSection = new NVPTXSection(MCSection::SV_ELF, SectionKind::getBSS());
00055     ReadOnlySection =
00056         new NVPTXSection(MCSection::SV_ELF, SectionKind::getReadOnly());
00057 
00058     StaticCtorSection =
00059         new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
00060     StaticDtorSection =
00061         new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
00062     LSDASection =
00063         new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
00064     EHFrameSection =
00065         new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
00066     DwarfAbbrevSection =
00067         new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
00068     DwarfInfoSection =
00069         new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
00070     DwarfLineSection =
00071         new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
00072     DwarfFrameSection =
00073         new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
00074     DwarfPubTypesSection =
00075         new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
00076     DwarfDebugInlineSection =
00077         new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
00078     DwarfStrSection =
00079         new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
00080     DwarfLocSection =
00081         new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
00082     DwarfARangesSection =
00083         new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
00084     DwarfRangesSection =
00085         new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
00086     DwarfMacroInfoSection =
00087         new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
00088   }
00089 
00090   const MCSection *getSectionForConstant(SectionKind Kind,
00091                                          const Constant *C) const override {
00092     return ReadOnlySection;
00093   }
00094 
00095   const MCSection *getExplicitSectionGlobal(const GlobalValue *GV,
00096                                        SectionKind Kind, Mangler &Mang,
00097                                        const TargetMachine &TM) const override {
00098     return DataSection;
00099   }
00100 
00101 };
00102 
00103 } // end namespace llvm
00104 
00105 #endif