LLVM  4.0.0
AMDGPUMachineFunction.h
Go to the documentation of this file.
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 
14 #include "llvm/ADT/DenseMap.h"
15 
16 namespace llvm {
17 
19  /// A map to keep track of local memory objects and their offsets within the
20  /// local memory space.
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 
35 public:
37 
38  uint64_t allocateKernArg(uint64_t Size, unsigned Align) {
39  assert(isPowerOf2_32(Align));
40  KernArgSize = alignTo(KernArgSize, Align);
41 
42  uint64_t Result = KernArgSize;
43  KernArgSize += Size;
44 
45  MaxKernArgAlign = std::max(Align, MaxKernArgAlign);
46  return Result;
47  }
48 
49  uint64_t getKernArgSize() const {
50  return KernArgSize;
51  }
52 
53  unsigned getMaxKernArgAlign() const {
54  return MaxKernArgAlign;
55  }
56 
57  void setABIArgOffset(unsigned NewOffset) {
58  ABIArgOffset = NewOffset;
59  }
60 
61  unsigned getABIArgOffset() const {
62  return ABIArgOffset;
63  }
64 
65  unsigned getLDSSize() const {
66  return LDSSize;
67  }
68 
69  bool isKernel() const {
70  return IsKernel;
71  }
72 
73  unsigned allocateLDSGlobal(const DataLayout &DL, const GlobalValue &GV);
74 };
75 
76 }
77 #endif
A parsed version of the target data layout string in and methods for querying it. ...
Definition: DataLayout.h:102
unsigned allocateLDSGlobal(const DataLayout &DL, const GlobalValue &GV)
AMDGPUMachineFunction(const MachineFunction &MF)
uint64_t alignTo(uint64_t Value, uint64_t Align, uint64_t Skew=0)
Returns the next integer (mod 2**64) that is greater than or equal to Value and is a multiple of Alig...
Definition: MathExtras.h:664
MachineFunctionInfo - This class can be derived from and used by targets to hold private target-speci...
uint64_t allocateKernArg(uint64_t Size, unsigned Align)
constexpr bool isPowerOf2_32(uint32_t Value)
isPowerOf2_32 - This function returns true if the argument is a power of two > 0. ...
Definition: MathExtras.h:399
void setABIArgOffset(unsigned NewOffset)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())