1 //===-- AMDGPUMachineFunctionInfo.h -------------------------------*- C++ -*-=//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPUMACHINEFUNCTION_H
11 #define LLVM_LIB_TARGET_AMDGPU_AMDGPUMACHINEFUNCTION_H
13 #include "llvm/ADT/DenseMap.h"
14 #include "llvm/CodeGen/MachineFunction.h"
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;
24 unsigned MaxKernArgAlign;
26 /// Number of bytes in the LDS that are being used.
29 // FIXME: This should probably be removed.
30 /// Start of implicit kernel args
31 unsigned ABIArgOffset;
33 // Kernels + shaders. i.e. functions called by the driver and not not called
34 // by other functions.
37 bool NoSignedZerosFPMath;
40 AMDGPUMachineFunction(const MachineFunction &MF);
42 uint64_t allocateKernArg(uint64_t Size, unsigned Align) {
43 assert(isPowerOf2_32(Align));
44 KernArgSize = alignTo(KernArgSize, Align);
46 uint64_t Result = KernArgSize;
49 MaxKernArgAlign = std::max(Align, MaxKernArgAlign);
53 uint64_t getKernArgSize() const {
57 unsigned getMaxKernArgAlign() const {
58 return MaxKernArgAlign;
61 void setABIArgOffset(unsigned NewOffset) {
62 ABIArgOffset = NewOffset;
65 unsigned getABIArgOffset() const {
69 unsigned getLDSSize() const {
73 bool isEntryFunction() const {
74 return IsEntryFunction;
77 bool hasNoSignedZerosFPMath() const {
78 return NoSignedZerosFPMath;
81 unsigned allocateLDSGlobal(const DataLayout &DL, const GlobalValue &GV);