AMDGPU/SI: Emit constant arrays in the .hsrodata_readonly_agent section
[oota-llvm.git] / lib / Target / AMDGPU / AMDGPUHSATargetObjectFile.h
1 //===-- AMDGPUHSATargetObjectFile.h - AMDGPU HSA 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 /// \file
11 /// \brief This file declares the AMDGPU-specific subclass of
12 /// TargetLoweringObjectFile use for targeting the HSA-runtime.
13 ///
14 //===----------------------------------------------------------------------===//
15
16 #ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPUHSATARGETOBJECTFILE_H
17 #define LLVM_LIB_TARGET_AMDGPU_AMDGPUHSATARGETOBJECTFILE_H
18
19 #include "llvm/CodeGen/TargetLoweringObjectFileImpl.h"
20 #include "llvm/Target/TargetMachine.h"
21
22 namespace llvm {
23
24 class AMDGPUHSATargetObjectFile final : public TargetLoweringObjectFileELF {
25 private:
26   MCSection *DataGlobalAgentSection;
27   MCSection *DataGlobalProgramSection;
28   MCSection *RodataReadonlyAgentSection;
29
30   bool isAgentAllocationSection(const char *SectionName) const;
31   bool isAgentAllocation(const GlobalValue *GV) const;
32   bool isProgramAllocation(const GlobalValue *GV) const;
33
34 public:
35   void Initialize(MCContext &Ctx, const TargetMachine &TM) override;
36
37   MCSection *SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
38                                     Mangler &Mang,
39                                     const TargetMachine &TM) const override;
40 };
41
42 } // end namespace llvm
43
44 #endif