]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.h
MFV r309403:
[FreeBSD/FreeBSD.git] / contrib / llvm / lib / Target / AMDGPU / AMDGPUMachineFunction.h
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 <map>
15
16 namespace llvm {
17
18 class AMDGPUMachineFunction : public MachineFunctionInfo {
19   uint64_t KernArgSize;
20   unsigned MaxKernArgAlign;
21
22   virtual void anchor();
23
24 public:
25   AMDGPUMachineFunction(const MachineFunction &MF);
26
27   uint64_t allocateKernArg(uint64_t Size, unsigned Align) {
28     assert(isPowerOf2_32(Align));
29     KernArgSize = alignTo(KernArgSize, Align);
30
31     uint64_t Result = KernArgSize;
32     KernArgSize += Size;
33
34     MaxKernArgAlign = std::max(Align, MaxKernArgAlign);
35     return Result;
36   }
37
38   /// A map to keep track of local memory objects and their offsets within
39   /// the local memory space.
40   std::map<const GlobalValue *, unsigned> LocalMemoryObjects;
41   /// Number of bytes in the LDS that are being used.
42   unsigned LDSSize;
43
44   /// Start of implicit kernel args
45   unsigned ABIArgOffset;
46
47   bool isKernel() const;
48
49   unsigned ScratchSize;
50   bool IsKernel;
51 };
52
53 }
54 #endif