blob: 52987e2fa4111c30934e4748f84449b248cea664 [file] [log] [blame]
Matt Arsenault6b6a2c32016-03-11 08:00:27 +00001//===-- AMDGPUMachineFunctionInfo.h -------------------------------*- C++ -*-=//
Vincent Lejeuneace6f732013-04-01 21:47:53 +00002//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Vincent Lejeuneace6f732013-04-01 21:47:53 +00006//
7//===----------------------------------------------------------------------===//
Vincent Lejeuneace6f732013-04-01 21:47:53 +00008
Matt Arsenault6b6a2c32016-03-11 08:00:27 +00009#ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPUMACHINEFUNCTION_H
10#define LLVM_LIB_TARGET_AMDGPU_AMDGPUMACHINEFUNCTION_H
Vincent Lejeuneace6f732013-04-01 21:47:53 +000011
Matt Arsenault52ef4012016-07-26 16:45:58 +000012#include "llvm/ADT/DenseMap.h"
Chandler Carruth6bda14b2017-06-06 11:49:48 +000013#include "llvm/CodeGen/MachineFunction.h"
Vincent Lejeuneace6f732013-04-01 21:47:53 +000014
15namespace llvm {
16
Tom Stellard5bfbae52018-07-11 20:59:01 +000017class GCNSubtarget;
Matt Arsenault75e71922018-06-28 10:18:55 +000018
Vincent Lejeuneace6f732013-04-01 21:47:53 +000019class AMDGPUMachineFunction : public MachineFunctionInfo {
Matt Arsenault52ef4012016-07-26 16:45:58 +000020 /// A map to keep track of local memory objects and their offsets within the
21 /// local memory space.
22 SmallDenseMap<const GlobalValue *, unsigned, 4> LocalMemoryObjects;
23
Matt Arsenault1ea04022018-05-29 19:35:00 +000024protected:
Matt Arsenault4bec7d42018-07-20 09:05:08 +000025 uint64_t ExplicitKernArgSize; // Cache for this.
26 unsigned MaxKernArgAlign; // Cache for this.
Matt Arsenaulte935f052016-06-18 05:15:53 +000027
Matt Arsenault52ef4012016-07-26 16:45:58 +000028 /// Number of bytes in the LDS that are being used.
29 unsigned LDSSize;
30
Hiroshi Inoueae179002018-04-14 08:59:00 +000031 // Kernels + shaders. i.e. functions called by the driver and not called
Matt Arsenault1074cb52017-03-30 23:58:04 +000032 // by other functions.
33 bool IsEntryFunction;
34
Matt Arsenault3cb39042017-02-27 19:35:42 +000035 bool NoSignedZerosFPMath;
Matt Arsenault762af962014-07-13 03:06:39 +000036
Stanislav Mekhanoshin1c538422018-05-25 17:25:12 +000037 // Function may be memory bound.
38 bool MemoryBound;
39
40 // Kernel may need limited waves per EU for better performance.
41 bool WaveLimiter;
42
Vincent Lejeuneace6f732013-04-01 21:47:53 +000043public:
44 AMDGPUMachineFunction(const MachineFunction &MF);
Matt Arsenaulte935f052016-06-18 05:15:53 +000045
Matt Arsenault75e71922018-06-28 10:18:55 +000046 uint64_t getExplicitKernArgSize() const {
47 return ExplicitKernArgSize;
Matt Arsenault52ef4012016-07-26 16:45:58 +000048 }
Matt Arsenault762af962014-07-13 03:06:39 +000049
Tom Stellard175959e2016-12-06 21:53:10 +000050 unsigned getMaxKernArgAlign() const {
51 return MaxKernArgAlign;
52 }
53
Matt Arsenault52ef4012016-07-26 16:45:58 +000054 unsigned getLDSSize() const {
55 return LDSSize;
56 }
57
Matt Arsenault1074cb52017-03-30 23:58:04 +000058 bool isEntryFunction() const {
59 return IsEntryFunction;
Matt Arsenault52ef4012016-07-26 16:45:58 +000060 }
61
Matt Arsenault3cb39042017-02-27 19:35:42 +000062 bool hasNoSignedZerosFPMath() const {
63 return NoSignedZerosFPMath;
64 }
65
Stanislav Mekhanoshin1c538422018-05-25 17:25:12 +000066 bool isMemoryBound() const {
67 return MemoryBound;
68 }
69
70 bool needsWaveLimiter() const {
71 return WaveLimiter;
72 }
73
Matt Arsenault52ef4012016-07-26 16:45:58 +000074 unsigned allocateLDSGlobal(const DataLayout &DL, const GlobalValue &GV);
Vincent Lejeuneace6f732013-04-01 21:47:53 +000075};
76
Alexander Kornienkof00654e2015-06-23 09:49:53 +000077}
Benjamin Kramera7c40ef2014-08-13 16:26:38 +000078#endif