blob: 8d6b871bc03ea444d6a8f5a44dece3659f2cb5a8 [file] [log] [blame]
Matt Arsenault6b6a2c32016-03-11 08:00:27 +00001//===-- AMDGPUMachineFunctionInfo.h -------------------------------*- C++ -*-=//
Vincent Lejeuneace6f732013-04-01 21:47:53 +00002//
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//===----------------------------------------------------------------------===//
Vincent Lejeuneace6f732013-04-01 21:47:53 +00009
Matt Arsenault6b6a2c32016-03-11 08:00:27 +000010#ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPUMACHINEFUNCTION_H
11#define LLVM_LIB_TARGET_AMDGPU_AMDGPUMACHINEFUNCTION_H
Vincent Lejeuneace6f732013-04-01 21:47:53 +000012
Matt Arsenault52ef4012016-07-26 16:45:58 +000013#include "llvm/ADT/DenseMap.h"
Chandler Carruth6bda14b2017-06-06 11:49:48 +000014#include "llvm/CodeGen/MachineFunction.h"
Vincent Lejeuneace6f732013-04-01 21:47:53 +000015
16namespace llvm {
17
Tom Stellard5bfbae52018-07-11 20:59:01 +000018class GCNSubtarget;
Matt Arsenault75e71922018-06-28 10:18:55 +000019
Vincent Lejeuneace6f732013-04-01 21:47:53 +000020class AMDGPUMachineFunction : public MachineFunctionInfo {
Matt Arsenault52ef4012016-07-26 16:45:58 +000021 /// A map to keep track of local memory objects and their offsets within the
22 /// local memory space.
23 SmallDenseMap<const GlobalValue *, unsigned, 4> LocalMemoryObjects;
24
Matt Arsenault1ea04022018-05-29 19:35:00 +000025protected:
Matt Arsenault4bec7d42018-07-20 09:05:08 +000026 uint64_t ExplicitKernArgSize; // Cache for this.
27 unsigned MaxKernArgAlign; // Cache for this.
Matt Arsenaulte935f052016-06-18 05:15:53 +000028
Matt Arsenault52ef4012016-07-26 16:45:58 +000029 /// Number of bytes in the LDS that are being used.
30 unsigned LDSSize;
31
Hiroshi Inoueae179002018-04-14 08:59:00 +000032 // Kernels + shaders. i.e. functions called by the driver and not called
Matt Arsenault1074cb52017-03-30 23:58:04 +000033 // by other functions.
34 bool IsEntryFunction;
35
Matt Arsenault3cb39042017-02-27 19:35:42 +000036 bool NoSignedZerosFPMath;
Matt Arsenault762af962014-07-13 03:06:39 +000037
Stanislav Mekhanoshin1c538422018-05-25 17:25:12 +000038 // Function may be memory bound.
39 bool MemoryBound;
40
41 // Kernel may need limited waves per EU for better performance.
42 bool WaveLimiter;
43
Vincent Lejeuneace6f732013-04-01 21:47:53 +000044public:
45 AMDGPUMachineFunction(const MachineFunction &MF);
Matt Arsenaulte935f052016-06-18 05:15:53 +000046
Matt Arsenault75e71922018-06-28 10:18:55 +000047 uint64_t getExplicitKernArgSize() const {
48 return ExplicitKernArgSize;
Matt Arsenault52ef4012016-07-26 16:45:58 +000049 }
Matt Arsenault762af962014-07-13 03:06:39 +000050
Tom Stellard175959e2016-12-06 21:53:10 +000051 unsigned getMaxKernArgAlign() const {
52 return MaxKernArgAlign;
53 }
54
Matt Arsenault52ef4012016-07-26 16:45:58 +000055 unsigned getLDSSize() const {
56 return LDSSize;
57 }
58
Matt Arsenault1074cb52017-03-30 23:58:04 +000059 bool isEntryFunction() const {
60 return IsEntryFunction;
Matt Arsenault52ef4012016-07-26 16:45:58 +000061 }
62
Matt Arsenault3cb39042017-02-27 19:35:42 +000063 bool hasNoSignedZerosFPMath() const {
64 return NoSignedZerosFPMath;
65 }
66
Stanislav Mekhanoshin1c538422018-05-25 17:25:12 +000067 bool isMemoryBound() const {
68 return MemoryBound;
69 }
70
71 bool needsWaveLimiter() const {
72 return WaveLimiter;
73 }
74
Matt Arsenault52ef4012016-07-26 16:45:58 +000075 unsigned allocateLDSGlobal(const DataLayout &DL, const GlobalValue &GV);
Vincent Lejeuneace6f732013-04-01 21:47:53 +000076};
77
Alexander Kornienkof00654e2015-06-23 09:49:53 +000078}
Benjamin Kramera7c40ef2014-08-13 16:26:38 +000079#endif