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