xref: /freebsd/contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.h (revision 8bcb0991864975618c09697b1aca10683346d9f0)
10b57cec5SDimitry Andric //===-- AMDGPUMachineFunctionInfo.h -------------------------------*- C++ -*-=//
20b57cec5SDimitry Andric //
30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric //
70b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric 
90b57cec5SDimitry Andric #ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPUMACHINEFUNCTION_H
100b57cec5SDimitry Andric #define LLVM_LIB_TARGET_AMDGPU_AMDGPUMACHINEFUNCTION_H
110b57cec5SDimitry Andric 
120b57cec5SDimitry Andric #include "llvm/ADT/DenseMap.h"
130b57cec5SDimitry Andric #include "llvm/CodeGen/MachineFunction.h"
140b57cec5SDimitry Andric 
150b57cec5SDimitry Andric namespace llvm {
160b57cec5SDimitry Andric 
170b57cec5SDimitry Andric class GCNSubtarget;
180b57cec5SDimitry Andric 
190b57cec5SDimitry Andric class AMDGPUMachineFunction : public MachineFunctionInfo {
200b57cec5SDimitry Andric   /// A map to keep track of local memory objects and their offsets within the
210b57cec5SDimitry Andric   /// local memory space.
220b57cec5SDimitry Andric   SmallDenseMap<const GlobalValue *, unsigned, 4> LocalMemoryObjects;
230b57cec5SDimitry Andric 
240b57cec5SDimitry Andric protected:
250b57cec5SDimitry Andric   uint64_t ExplicitKernArgSize; // Cache for this.
26*8bcb0991SDimitry Andric   Align MaxKernArgAlign;        // Cache for this.
270b57cec5SDimitry Andric 
280b57cec5SDimitry Andric   /// Number of bytes in the LDS that are being used.
290b57cec5SDimitry Andric   unsigned LDSSize;
300b57cec5SDimitry Andric 
310b57cec5SDimitry Andric   // Kernels + shaders. i.e. functions called by the driver and not called
320b57cec5SDimitry Andric   // by other functions.
330b57cec5SDimitry Andric   bool IsEntryFunction;
340b57cec5SDimitry Andric 
350b57cec5SDimitry Andric   bool NoSignedZerosFPMath;
360b57cec5SDimitry Andric 
370b57cec5SDimitry Andric   // Function may be memory bound.
380b57cec5SDimitry Andric   bool MemoryBound;
390b57cec5SDimitry Andric 
400b57cec5SDimitry Andric   // Kernel may need limited waves per EU for better performance.
410b57cec5SDimitry Andric   bool WaveLimiter;
420b57cec5SDimitry Andric 
430b57cec5SDimitry Andric public:
440b57cec5SDimitry Andric   AMDGPUMachineFunction(const MachineFunction &MF);
450b57cec5SDimitry Andric 
460b57cec5SDimitry Andric   uint64_t getExplicitKernArgSize() const {
470b57cec5SDimitry Andric     return ExplicitKernArgSize;
480b57cec5SDimitry Andric   }
490b57cec5SDimitry Andric 
50*8bcb0991SDimitry Andric   unsigned getMaxKernArgAlign() const { return MaxKernArgAlign.value(); }
510b57cec5SDimitry Andric 
520b57cec5SDimitry Andric   unsigned getLDSSize() const {
530b57cec5SDimitry Andric     return LDSSize;
540b57cec5SDimitry Andric   }
550b57cec5SDimitry Andric 
560b57cec5SDimitry Andric   bool isEntryFunction() const {
570b57cec5SDimitry Andric     return IsEntryFunction;
580b57cec5SDimitry Andric   }
590b57cec5SDimitry Andric 
600b57cec5SDimitry Andric   bool hasNoSignedZerosFPMath() const {
610b57cec5SDimitry Andric     return NoSignedZerosFPMath;
620b57cec5SDimitry Andric   }
630b57cec5SDimitry Andric 
640b57cec5SDimitry Andric   bool isMemoryBound() const {
650b57cec5SDimitry Andric     return MemoryBound;
660b57cec5SDimitry Andric   }
670b57cec5SDimitry Andric 
680b57cec5SDimitry Andric   bool needsWaveLimiter() const {
690b57cec5SDimitry Andric     return WaveLimiter;
700b57cec5SDimitry Andric   }
710b57cec5SDimitry Andric 
720b57cec5SDimitry Andric   unsigned allocateLDSGlobal(const DataLayout &DL, const GlobalValue &GV);
730b57cec5SDimitry Andric };
740b57cec5SDimitry Andric 
750b57cec5SDimitry Andric }
760b57cec5SDimitry Andric #endif
77