blob: 4feb57c9e34e696ff2ccc54445bb66638a576110 [file] [log] [blame]
Tom Stellard347ac792015-06-26 21:15:07 +00001//===-- AMDGPUBaseInfo.h - Top level definitions for AMDGPU -----*- 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#ifndef LLVM_LIB_TARGET_AMDGPU_UTILS_AMDGPUBASEINFO_H
11#define LLVM_LIB_TARGET_AMDGPU_UTILS_AMDGPUBASEINFO_H
12
13#include "AMDKernelCodeT.h"
Nicolai Haehnledf3a20c2016-04-06 19:40:20 +000014#include "llvm/IR/CallingConv.h"
Tom Stellard347ac792015-06-26 21:15:07 +000015
16namespace llvm {
17
18class FeatureBitset;
Tom Stellardac00eb52015-12-15 16:26:16 +000019class Function;
Tom Stellarde3b5aea2015-12-02 17:00:42 +000020class GlobalValue;
Tom Stellarde135ffd2015-09-25 21:41:28 +000021class MCContext;
22class MCSection;
Tom Stellard2b65ed32015-12-21 18:44:27 +000023class MCSubtargetInfo;
Tom Stellard347ac792015-06-26 21:15:07 +000024
25namespace AMDGPU {
26
27struct IsaVersion {
28 unsigned Major;
29 unsigned Minor;
30 unsigned Stepping;
31};
32
33IsaVersion getIsaVersion(const FeatureBitset &Features);
Tom Stellardff7416b2015-06-26 21:58:31 +000034void initDefaultAMDKernelCodeT(amd_kernel_code_t &Header,
35 const FeatureBitset &Features);
Tom Stellarde135ffd2015-09-25 21:41:28 +000036MCSection *getHSATextSection(MCContext &Ctx);
Tom Stellard347ac792015-06-26 21:15:07 +000037
Tom Stellard00f2f912015-12-02 19:47:57 +000038MCSection *getHSADataGlobalAgentSection(MCContext &Ctx);
39
40MCSection *getHSADataGlobalProgramSection(MCContext &Ctx);
41
Tom Stellard9760f032015-12-03 03:34:32 +000042MCSection *getHSARodataReadonlyAgentSection(MCContext &Ctx);
43
Tom Stellarde3b5aea2015-12-02 17:00:42 +000044bool isGroupSegment(const GlobalValue *GV);
Tom Stellard00f2f912015-12-02 19:47:57 +000045bool isGlobalSegment(const GlobalValue *GV);
46bool isReadOnlySegment(const GlobalValue *GV);
Tom Stellarde3b5aea2015-12-02 17:00:42 +000047
Tom Stellard79a1fd72016-04-14 16:27:07 +000048unsigned getMaximumWorkGroupSize(const Function &F);
Marek Olsakfccabaf2016-01-13 11:45:36 +000049unsigned getInitialPSInputAddr(const Function &F);
50
Nicolai Haehnledf3a20c2016-04-06 19:40:20 +000051bool isShader(CallingConv::ID cc);
52bool isCompute(CallingConv::ID cc);
Tom Stellardac00eb52015-12-15 16:26:16 +000053
Tom Stellard2b65ed32015-12-21 18:44:27 +000054bool isSI(const MCSubtargetInfo &STI);
55bool isCI(const MCSubtargetInfo &STI);
56bool isVI(const MCSubtargetInfo &STI);
57
58/// If \p Reg is a pseudo reg, return the correct hardware register given
59/// \p STI otherwise return \p Reg.
60unsigned getMCReg(unsigned Reg, const MCSubtargetInfo &STI);
61
Tom Stellard347ac792015-06-26 21:15:07 +000062} // end namespace AMDGPU
63} // end namespace llvm
64
65#endif