1 //===-- AMDGPUMachineFunctionInfo.h -------------------------------*- C++ -*-=// 2 // 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 //===----------------------------------------------------------------------===// 9 10 #ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPUMACHINEFUNCTION_H 11 #define LLVM_LIB_TARGET_AMDGPU_AMDGPUMACHINEFUNCTION_H 12 13 #include "llvm/CodeGen/MachineFunction.h" 14 #include "llvm/ADT/DenseMap.h" 15 16 namespace llvm { 17 18 class AMDGPUMachineFunction : public MachineFunctionInfo { 19 /// A map to keep track of local memory objects and their offsets within the 20 /// local memory space. 21 SmallDenseMap<const GlobalValue *, unsigned, 4> LocalMemoryObjects; 22 23 uint64_t KernArgSize; 24 unsigned MaxKernArgAlign; 25 26 /// Number of bytes in the LDS that are being used. 27 unsigned LDSSize; 28 29 // FIXME: This should probably be removed. 30 /// Start of implicit kernel args 31 unsigned ABIArgOffset; 32 33 bool IsKernel; 34 bool NoSignedZerosFPMath; 35 36 public: 37 AMDGPUMachineFunction(const MachineFunction &MF); 38 39 uint64_t allocateKernArg(uint64_t Size, unsigned Align) { 40 assert(isPowerOf2_32(Align)); 41 KernArgSize = alignTo(KernArgSize, Align); 42 43 uint64_t Result = KernArgSize; 44 KernArgSize += Size; 45 46 MaxKernArgAlign = std::max(Align, MaxKernArgAlign); 47 return Result; 48 } 49 50 uint64_t getKernArgSize() const { 51 return KernArgSize; 52 } 53 54 unsigned getMaxKernArgAlign() const { 55 return MaxKernArgAlign; 56 } 57 58 void setABIArgOffset(unsigned NewOffset) { 59 ABIArgOffset = NewOffset; 60 } 61 62 unsigned getABIArgOffset() const { 63 return ABIArgOffset; 64 } 65 66 unsigned getLDSSize() const { 67 return LDSSize; 68 } 69 70 bool isKernel() const { 71 return IsKernel; 72 } 73 74 bool hasNoSignedZerosFPMath() const { 75 return NoSignedZerosFPMath; 76 } 77 78 unsigned allocateLDSGlobal(const DataLayout &DL, const GlobalValue &GV); 79 }; 80 81 } 82 #endif 83