1*81ad6265SDimitry Andric //===-- SPIRVTargetObjectFile.h - SPIRV Object Info -------------*- C++ -*-===// 2*81ad6265SDimitry Andric // 3*81ad6265SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*81ad6265SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 5*81ad6265SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*81ad6265SDimitry Andric // 7*81ad6265SDimitry Andric //===----------------------------------------------------------------------===// 8*81ad6265SDimitry Andric 9*81ad6265SDimitry Andric #ifndef LLVM_LIB_TARGET_SPIRV_SPIRVTARGETOBJECTFILE_H 10*81ad6265SDimitry Andric #define LLVM_LIB_TARGET_SPIRV_SPIRVTARGETOBJECTFILE_H 11*81ad6265SDimitry Andric 12*81ad6265SDimitry Andric #include "llvm/MC/MCSection.h" 13*81ad6265SDimitry Andric #include "llvm/MC/SectionKind.h" 14*81ad6265SDimitry Andric #include "llvm/Target/TargetLoweringObjectFile.h" 15*81ad6265SDimitry Andric 16*81ad6265SDimitry Andric namespace llvm { 17*81ad6265SDimitry Andric 18*81ad6265SDimitry Andric class SPIRVTargetObjectFile : public TargetLoweringObjectFile { 19*81ad6265SDimitry Andric public: 20*81ad6265SDimitry Andric ~SPIRVTargetObjectFile() override; 21*81ad6265SDimitry Andric Initialize(MCContext & ctx,const TargetMachine & TM)22*81ad6265SDimitry Andric void Initialize(MCContext &ctx, const TargetMachine &TM) override { 23*81ad6265SDimitry Andric TargetLoweringObjectFile::Initialize(ctx, TM); 24*81ad6265SDimitry Andric } 25*81ad6265SDimitry Andric // All words in a SPIR-V module (excepting the first 5 ones) are a linear 26*81ad6265SDimitry Andric // sequence of instructions in a specific order. We put all the instructions 27*81ad6265SDimitry Andric // in the single text section. getSectionForConstant(const DataLayout & DL,SectionKind Kind,const Constant * C,Align & Alignment)28*81ad6265SDimitry Andric MCSection *getSectionForConstant(const DataLayout &DL, SectionKind Kind, 29*81ad6265SDimitry Andric const Constant *C, 30*81ad6265SDimitry Andric Align &Alignment) const override { 31*81ad6265SDimitry Andric return TextSection; 32*81ad6265SDimitry Andric } getExplicitSectionGlobal(const GlobalObject * GO,SectionKind Kind,const TargetMachine & TM)33*81ad6265SDimitry Andric MCSection *getExplicitSectionGlobal(const GlobalObject *GO, SectionKind Kind, 34*81ad6265SDimitry Andric const TargetMachine &TM) const override { 35*81ad6265SDimitry Andric return TextSection; 36*81ad6265SDimitry Andric } SelectSectionForGlobal(const GlobalObject * GO,SectionKind Kind,const TargetMachine & TM)37*81ad6265SDimitry Andric MCSection *SelectSectionForGlobal(const GlobalObject *GO, SectionKind Kind, 38*81ad6265SDimitry Andric const TargetMachine &TM) const override { 39*81ad6265SDimitry Andric return TextSection; 40*81ad6265SDimitry Andric } 41*81ad6265SDimitry Andric }; 42*81ad6265SDimitry Andric 43*81ad6265SDimitry Andric } // end namespace llvm 44*81ad6265SDimitry Andric 45*81ad6265SDimitry Andric #endif // LLVM_LIB_TARGET_SPIRV_SPIRVTARGETOBJECTFILE_H 46