xref: /freebsd/contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.h (revision 0b57cec536236d46e3dba9bd041533462f33dbb7)
1*0b57cec5SDimitry Andric //===-- AMDGPUMachineFunctionInfo.h -------------------------------*- C++ -*-=//
2*0b57cec5SDimitry Andric //
3*0b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*0b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5*0b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*0b57cec5SDimitry Andric //
7*0b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
8*0b57cec5SDimitry Andric 
9*0b57cec5SDimitry Andric #ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPUMACHINEFUNCTION_H
10*0b57cec5SDimitry Andric #define LLVM_LIB_TARGET_AMDGPU_AMDGPUMACHINEFUNCTION_H
11*0b57cec5SDimitry Andric 
12*0b57cec5SDimitry Andric #include "llvm/ADT/DenseMap.h"
13*0b57cec5SDimitry Andric #include "llvm/CodeGen/MachineFunction.h"
14*0b57cec5SDimitry Andric 
15*0b57cec5SDimitry Andric namespace llvm {
16*0b57cec5SDimitry Andric 
17*0b57cec5SDimitry Andric class GCNSubtarget;
18*0b57cec5SDimitry Andric 
19*0b57cec5SDimitry Andric class AMDGPUMachineFunction : public MachineFunctionInfo {
20*0b57cec5SDimitry Andric   /// A map to keep track of local memory objects and their offsets within the
21*0b57cec5SDimitry Andric   /// local memory space.
22*0b57cec5SDimitry Andric   SmallDenseMap<const GlobalValue *, unsigned, 4> LocalMemoryObjects;
23*0b57cec5SDimitry Andric 
24*0b57cec5SDimitry Andric protected:
25*0b57cec5SDimitry Andric   uint64_t ExplicitKernArgSize; // Cache for this.
26*0b57cec5SDimitry Andric   unsigned MaxKernArgAlign; // Cache for this.
27*0b57cec5SDimitry Andric 
28*0b57cec5SDimitry Andric   /// Number of bytes in the LDS that are being used.
29*0b57cec5SDimitry Andric   unsigned LDSSize;
30*0b57cec5SDimitry Andric 
31*0b57cec5SDimitry Andric   // Kernels + shaders. i.e. functions called by the driver and not called
32*0b57cec5SDimitry Andric   // by other functions.
33*0b57cec5SDimitry Andric   bool IsEntryFunction;
34*0b57cec5SDimitry Andric 
35*0b57cec5SDimitry Andric   bool NoSignedZerosFPMath;
36*0b57cec5SDimitry Andric 
37*0b57cec5SDimitry Andric   // Function may be memory bound.
38*0b57cec5SDimitry Andric   bool MemoryBound;
39*0b57cec5SDimitry Andric 
40*0b57cec5SDimitry Andric   // Kernel may need limited waves per EU for better performance.
41*0b57cec5SDimitry Andric   bool WaveLimiter;
42*0b57cec5SDimitry Andric 
43*0b57cec5SDimitry Andric public:
44*0b57cec5SDimitry Andric   AMDGPUMachineFunction(const MachineFunction &MF);
45*0b57cec5SDimitry Andric 
46*0b57cec5SDimitry Andric   uint64_t getExplicitKernArgSize() const {
47*0b57cec5SDimitry Andric     return ExplicitKernArgSize;
48*0b57cec5SDimitry Andric   }
49*0b57cec5SDimitry Andric 
50*0b57cec5SDimitry Andric   unsigned getMaxKernArgAlign() const {
51*0b57cec5SDimitry Andric     return MaxKernArgAlign;
52*0b57cec5SDimitry Andric   }
53*0b57cec5SDimitry Andric 
54*0b57cec5SDimitry Andric   unsigned getLDSSize() const {
55*0b57cec5SDimitry Andric     return LDSSize;
56*0b57cec5SDimitry Andric   }
57*0b57cec5SDimitry Andric 
58*0b57cec5SDimitry Andric   bool isEntryFunction() const {
59*0b57cec5SDimitry Andric     return IsEntryFunction;
60*0b57cec5SDimitry Andric   }
61*0b57cec5SDimitry Andric 
62*0b57cec5SDimitry Andric   bool hasNoSignedZerosFPMath() const {
63*0b57cec5SDimitry Andric     return NoSignedZerosFPMath;
64*0b57cec5SDimitry Andric   }
65*0b57cec5SDimitry Andric 
66*0b57cec5SDimitry Andric   bool isMemoryBound() const {
67*0b57cec5SDimitry Andric     return MemoryBound;
68*0b57cec5SDimitry Andric   }
69*0b57cec5SDimitry Andric 
70*0b57cec5SDimitry Andric   bool needsWaveLimiter() const {
71*0b57cec5SDimitry Andric     return WaveLimiter;
72*0b57cec5SDimitry Andric   }
73*0b57cec5SDimitry Andric 
74*0b57cec5SDimitry Andric   unsigned allocateLDSGlobal(const DataLayout &DL, const GlobalValue &GV);
75*0b57cec5SDimitry Andric };
76*0b57cec5SDimitry Andric 
77*0b57cec5SDimitry Andric }
78*0b57cec5SDimitry Andric #endif
79