xref: /aosp_15_r20/external/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker //===-- AMDGPUBaseInfo.h - Top level definitions for AMDGPU -----*- C++ -*-===//
2*9880d681SAndroid Build Coastguard Worker //
3*9880d681SAndroid Build Coastguard Worker //                     The LLVM Compiler Infrastructure
4*9880d681SAndroid Build Coastguard Worker //
5*9880d681SAndroid Build Coastguard Worker // This file is distributed under the University of Illinois Open Source
6*9880d681SAndroid Build Coastguard Worker // License. See LICENSE.TXT for details.
7*9880d681SAndroid Build Coastguard Worker //
8*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===//
9*9880d681SAndroid Build Coastguard Worker 
10*9880d681SAndroid Build Coastguard Worker #ifndef LLVM_LIB_TARGET_AMDGPU_UTILS_AMDGPUBASEINFO_H
11*9880d681SAndroid Build Coastguard Worker #define LLVM_LIB_TARGET_AMDGPU_UTILS_AMDGPUBASEINFO_H
12*9880d681SAndroid Build Coastguard Worker 
13*9880d681SAndroid Build Coastguard Worker #include "AMDKernelCodeT.h"
14*9880d681SAndroid Build Coastguard Worker #include "llvm/IR/CallingConv.h"
15*9880d681SAndroid Build Coastguard Worker 
16*9880d681SAndroid Build Coastguard Worker namespace llvm {
17*9880d681SAndroid Build Coastguard Worker 
18*9880d681SAndroid Build Coastguard Worker class FeatureBitset;
19*9880d681SAndroid Build Coastguard Worker class Function;
20*9880d681SAndroid Build Coastguard Worker class GlobalValue;
21*9880d681SAndroid Build Coastguard Worker class MCContext;
22*9880d681SAndroid Build Coastguard Worker class MCSection;
23*9880d681SAndroid Build Coastguard Worker class MCSubtargetInfo;
24*9880d681SAndroid Build Coastguard Worker 
25*9880d681SAndroid Build Coastguard Worker namespace AMDGPU {
26*9880d681SAndroid Build Coastguard Worker 
27*9880d681SAndroid Build Coastguard Worker struct IsaVersion {
28*9880d681SAndroid Build Coastguard Worker   unsigned Major;
29*9880d681SAndroid Build Coastguard Worker   unsigned Minor;
30*9880d681SAndroid Build Coastguard Worker   unsigned Stepping;
31*9880d681SAndroid Build Coastguard Worker };
32*9880d681SAndroid Build Coastguard Worker 
33*9880d681SAndroid Build Coastguard Worker IsaVersion getIsaVersion(const FeatureBitset &Features);
34*9880d681SAndroid Build Coastguard Worker void initDefaultAMDKernelCodeT(amd_kernel_code_t &Header,
35*9880d681SAndroid Build Coastguard Worker                                const FeatureBitset &Features);
36*9880d681SAndroid Build Coastguard Worker MCSection *getHSATextSection(MCContext &Ctx);
37*9880d681SAndroid Build Coastguard Worker 
38*9880d681SAndroid Build Coastguard Worker MCSection *getHSADataGlobalAgentSection(MCContext &Ctx);
39*9880d681SAndroid Build Coastguard Worker 
40*9880d681SAndroid Build Coastguard Worker MCSection *getHSADataGlobalProgramSection(MCContext &Ctx);
41*9880d681SAndroid Build Coastguard Worker 
42*9880d681SAndroid Build Coastguard Worker MCSection *getHSARodataReadonlyAgentSection(MCContext &Ctx);
43*9880d681SAndroid Build Coastguard Worker 
44*9880d681SAndroid Build Coastguard Worker bool isGroupSegment(const GlobalValue *GV);
45*9880d681SAndroid Build Coastguard Worker bool isGlobalSegment(const GlobalValue *GV);
46*9880d681SAndroid Build Coastguard Worker bool isReadOnlySegment(const GlobalValue *GV);
47*9880d681SAndroid Build Coastguard Worker 
48*9880d681SAndroid Build Coastguard Worker int getIntegerAttribute(const Function &F, StringRef Name, int Default);
49*9880d681SAndroid Build Coastguard Worker 
50*9880d681SAndroid Build Coastguard Worker unsigned getMaximumWorkGroupSize(const Function &F);
51*9880d681SAndroid Build Coastguard Worker unsigned getInitialPSInputAddr(const Function &F);
52*9880d681SAndroid Build Coastguard Worker 
53*9880d681SAndroid Build Coastguard Worker bool isShader(CallingConv::ID cc);
54*9880d681SAndroid Build Coastguard Worker bool isCompute(CallingConv::ID cc);
55*9880d681SAndroid Build Coastguard Worker 
56*9880d681SAndroid Build Coastguard Worker bool isSI(const MCSubtargetInfo &STI);
57*9880d681SAndroid Build Coastguard Worker bool isCI(const MCSubtargetInfo &STI);
58*9880d681SAndroid Build Coastguard Worker bool isVI(const MCSubtargetInfo &STI);
59*9880d681SAndroid Build Coastguard Worker 
60*9880d681SAndroid Build Coastguard Worker /// If \p Reg is a pseudo reg, return the correct hardware register given
61*9880d681SAndroid Build Coastguard Worker /// \p STI otherwise return \p Reg.
62*9880d681SAndroid Build Coastguard Worker unsigned getMCReg(unsigned Reg, const MCSubtargetInfo &STI);
63*9880d681SAndroid Build Coastguard Worker 
64*9880d681SAndroid Build Coastguard Worker } // end namespace AMDGPU
65*9880d681SAndroid Build Coastguard Worker } // end namespace llvm
66*9880d681SAndroid Build Coastguard Worker 
67*9880d681SAndroid Build Coastguard Worker #endif
68