Matt Arsenault | 6b6a2c3 | 2016-03-11 08:00:27 +0000 | [diff] [blame] | 1 | //===-- AMDGPUMachineFunctionInfo.h -------------------------------*- C++ -*-=// |
Vincent Lejeune | ace6f73 | 2013-04-01 21:47:53 +0000 | [diff] [blame] | 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 | //===----------------------------------------------------------------------===// |
Vincent Lejeune | ace6f73 | 2013-04-01 21:47:53 +0000 | [diff] [blame] | 9 | |
Matt Arsenault | 6b6a2c3 | 2016-03-11 08:00:27 +0000 | [diff] [blame] | 10 | #ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPUMACHINEFUNCTION_H |
| 11 | #define LLVM_LIB_TARGET_AMDGPU_AMDGPUMACHINEFUNCTION_H |
Vincent Lejeune | ace6f73 | 2013-04-01 21:47:53 +0000 | [diff] [blame] | 12 | |
| 13 | #include "llvm/CodeGen/MachineFunction.h" |
Tom Stellard | de60e25 | 2013-09-05 18:37:57 +0000 | [diff] [blame] | 14 | #include <map> |
Vincent Lejeune | ace6f73 | 2013-04-01 21:47:53 +0000 | [diff] [blame] | 15 | |
| 16 | namespace llvm { |
| 17 | |
| 18 | class AMDGPUMachineFunction : public MachineFunctionInfo { |
Matt Arsenault | e935f05 | 2016-06-18 05:15:53 +0000 | [diff] [blame] | 19 | uint64_t KernArgSize; |
| 20 | unsigned MaxKernArgAlign; |
| 21 | |
Juergen Ributzka | d12ccbd | 2013-11-19 00:57:56 +0000 | [diff] [blame] | 22 | virtual void anchor(); |
Matt Arsenault | 762af96 | 2014-07-13 03:06:39 +0000 | [diff] [blame] | 23 | |
Vincent Lejeune | ace6f73 | 2013-04-01 21:47:53 +0000 | [diff] [blame] | 24 | public: |
| 25 | AMDGPUMachineFunction(const MachineFunction &MF); |
Matt Arsenault | e935f05 | 2016-06-18 05:15:53 +0000 | [diff] [blame] | 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 | |
Tom Stellard | de60e25 | 2013-09-05 18:37:57 +0000 | [diff] [blame] | 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; |
Tom Stellard | c026e8b | 2013-06-28 15:47:08 +0000 | [diff] [blame] | 41 | /// Number of bytes in the LDS that are being used. |
| 42 | unsigned LDSSize; |
Matt Arsenault | 762af96 | 2014-07-13 03:06:39 +0000 | [diff] [blame] | 43 | |
Jan Vesely | e5121f3 | 2014-10-14 20:05:26 +0000 | [diff] [blame] | 44 | /// Start of implicit kernel args |
| 45 | unsigned ABIArgOffset; |
| 46 | |
Nikolay Haustov | beb24f5 | 2016-07-01 10:00:58 +0000 | [diff] [blame^] | 47 | bool isKernel() const; |
Tom Stellard | 1e1b05d | 2015-11-06 11:45:14 +0000 | [diff] [blame] | 48 | |
Matt Arsenault | 3f98140 | 2014-09-15 15:41:53 +0000 | [diff] [blame] | 49 | unsigned ScratchSize; |
| 50 | bool IsKernel; |
Vincent Lejeune | ace6f73 | 2013-04-01 21:47:53 +0000 | [diff] [blame] | 51 | }; |
| 52 | |
Alexander Kornienko | f00654e | 2015-06-23 09:49:53 +0000 | [diff] [blame] | 53 | } |
Benjamin Kramer | a7c40ef | 2014-08-13 16:26:38 +0000 | [diff] [blame] | 54 | #endif |