1 //===-- AMDGPUMachineFunctionInfo.h -------------------------------*- C++ -*-=//
3 // 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
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPUMACHINEFUNCTION_H
10 #define LLVM_LIB_TARGET_AMDGPU_AMDGPUMACHINEFUNCTION_H
12 #include "llvm/ADT/DenseMap.h"
13 #include "llvm/CodeGen/MachineFunction.h"
14 #include "Utils/AMDGPUBaseInfo.h"
20 class AMDGPUMachineFunction : public MachineFunctionInfo {
21 /// 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;
26 uint64_t ExplicitKernArgSize; // Cache for this.
27 Align MaxKernArgAlign; // Cache for this.
29 /// Number of bytes in the LDS that are being used.
32 // State of MODE register, assumed FP mode.
33 AMDGPU::SIModeRegisterDefaults Mode;
35 // Kernels + shaders. i.e. functions called by the driver and not called
36 // by other functions.
39 bool NoSignedZerosFPMath;
41 // Function may be memory bound.
44 // Kernel may need limited waves per EU for better performance.
48 AMDGPUMachineFunction(const MachineFunction &MF);
50 uint64_t getExplicitKernArgSize() const {
51 return ExplicitKernArgSize;
54 unsigned getMaxKernArgAlign() const { return MaxKernArgAlign.value(); }
56 unsigned getLDSSize() const {
60 AMDGPU::SIModeRegisterDefaults getMode() const {
64 bool isEntryFunction() const {
65 return IsEntryFunction;
68 bool hasNoSignedZerosFPMath() const {
69 return NoSignedZerosFPMath;
72 bool isMemoryBound() const {
76 bool needsWaveLimiter() const {
80 unsigned allocateLDSGlobal(const DataLayout &DL, const GlobalValue &GV);