NVPTXTargetObjectFile.h revision dce4a407a24b04eebc6a376f8e62b41aaa7b071f
10f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)//===-- NVPTXTargetObjectFile.h - NVPTX Object Info -------------*- C++ -*-===//
20f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)//
30f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)//                     The LLVM Compiler Infrastructure
40f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)//
50f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)// This file is distributed under the University of Illinois Open Source
60f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)// License. See LICENSE.TXT for details.
70f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)//
80f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)//===----------------------------------------------------------------------===//
90f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)
100f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)#ifndef LLVM_TARGET_NVPTX_TARGETOBJECTFILE_H
110f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)#define LLVM_TARGET_NVPTX_TARGETOBJECTFILE_H
12f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
130f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)#include "NVPTXSection.h"
140f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)#include "llvm/Target/TargetLoweringObjectFile.h"
150f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)#include <string>
160f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)
170f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)namespace llvm {
180f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)class GlobalVariable;
190f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)class Module;
200f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)
210f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)class NVPTXTargetObjectFile : public TargetLoweringObjectFile {
220f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)
230f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)public:
240f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)  NVPTXTargetObjectFile() {
250f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)    TextSection = nullptr;
260f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)    DataSection = nullptr;
270f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)    BSSSection = nullptr;
280f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)    ReadOnlySection = nullptr;
290f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)
300f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)    StaticCtorSection = nullptr;
310f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)    StaticDtorSection = nullptr;
320f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)    LSDASection = nullptr;
330f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)    EHFrameSection = nullptr;
340f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)    DwarfAbbrevSection = nullptr;
350f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)    DwarfInfoSection = nullptr;
360f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)    DwarfLineSection = nullptr;
370f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)    DwarfFrameSection = nullptr;
380f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)    DwarfPubTypesSection = nullptr;
390f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)    DwarfDebugInlineSection = nullptr;
400f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)    DwarfStrSection = nullptr;
410f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)    DwarfLocSection = nullptr;
420f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)    DwarfARangesSection = nullptr;
430f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)    DwarfRangesSection = nullptr;
440f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)    DwarfMacroInfoSection = nullptr;
450f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)  }
460f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)
470f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)  virtual ~NVPTXTargetObjectFile();
480f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)
490f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)  void Initialize(MCContext &ctx, const TargetMachine &TM) override {
500f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)    TargetLoweringObjectFile::Initialize(ctx, TM);
510f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)    TextSection = new NVPTXSection(MCSection::SV_ELF, SectionKind::getText());
520f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)    DataSection =
530f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)        new NVPTXSection(MCSection::SV_ELF, SectionKind::getDataRel());
540f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)    BSSSection = new NVPTXSection(MCSection::SV_ELF, SectionKind::getBSS());
550f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)    ReadOnlySection =
560f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)        new NVPTXSection(MCSection::SV_ELF, SectionKind::getReadOnly());
570f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)
580f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)    StaticCtorSection =
590f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)        new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
600f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)    StaticDtorSection =
610f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)        new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
620f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)    LSDASection =
630f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)        new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
640f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)    EHFrameSection =
650f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)        new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
660f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)    DwarfAbbrevSection =
670f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)        new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
680f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)    DwarfInfoSection =
690f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)        new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
700f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)    DwarfLineSection =
710f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)        new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
720f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)    DwarfFrameSection =
730f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)        new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
740f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)    DwarfPubTypesSection =
750f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)        new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
760f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)    DwarfDebugInlineSection =
770f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)        new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
780f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)    DwarfStrSection =
790f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)        new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
800f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)    DwarfLocSection =
810f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)        new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
820f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)    DwarfARangesSection =
830f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)        new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
840f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)    DwarfRangesSection =
850f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)        new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
860f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)    DwarfMacroInfoSection =
870f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)        new NVPTXSection(MCSection::SV_ELF, SectionKind::getMetadata());
880f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)  }
890f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)
900f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)  const MCSection *getSectionForConstant(SectionKind Kind) const override {
910f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)    return ReadOnlySection;
920f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)  }
930f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)
940f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)  const MCSection *getExplicitSectionGlobal(const GlobalValue *GV,
950f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)                                       SectionKind Kind, Mangler &Mang,
960f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)                                       const TargetMachine &TM) const override {
970f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)    return DataSection;
980f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)  }
990f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)
1000f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)};
1010f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)
1020f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)} // end namespace llvm
1030f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)
1040f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)#endif
1050f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)