blob: 995a9041fb3626d967a7a1c1a434ca07e0bde0a5 [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
Matt Arsenault83002722016-05-12 02:45:18 +000048int getIntegerAttribute(const Function &F, StringRef Name, int Default);
49
Tom Stellard79a1fd72016-04-14 16:27:07 +000050unsigned getMaximumWorkGroupSize(const Function &F);
Marek Olsakfccabaf2016-01-13 11:45:36 +000051unsigned getInitialPSInputAddr(const Function &F);
52
Nicolai Haehnledf3a20c2016-04-06 19:40:20 +000053bool isShader(CallingConv::ID cc);
54bool isCompute(CallingConv::ID cc);
Tom Stellardac00eb52015-12-15 16:26:16 +000055
Tom Stellard2b65ed32015-12-21 18:44:27 +000056bool isSI(const MCSubtargetInfo &STI);
57bool isCI(const MCSubtargetInfo &STI);
58bool isVI(const MCSubtargetInfo &STI);
59
60/// If \p Reg is a pseudo reg, return the correct hardware register given
61/// \p STI otherwise return \p Reg.
62unsigned getMCReg(unsigned Reg, const MCSubtargetInfo &STI);
63
Tom Stellard347ac792015-06-26 21:15:07 +000064} // end namespace AMDGPU
65} // end namespace llvm
66
67#endif