blob: 6b31f63e1a9d50221e8744f8280913379c0d4c00 [file] [log] [blame]
Matt Arsenault6b6a2c32016-03-11 08:00:27 +00001//===-- AMDGPUMachineFunctionInfo.h -------------------------------*- C++ -*-=//
Vincent Lejeuneace6f732013-04-01 21:47:53 +00002//
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 Lejeuneace6f732013-04-01 21:47:53 +00009
Matt Arsenault6b6a2c32016-03-11 08:00:27 +000010#ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPUMACHINEFUNCTION_H
11#define LLVM_LIB_TARGET_AMDGPU_AMDGPUMACHINEFUNCTION_H
Vincent Lejeuneace6f732013-04-01 21:47:53 +000012
13#include "llvm/CodeGen/MachineFunction.h"
Tom Stellardde60e252013-09-05 18:37:57 +000014#include <map>
Vincent Lejeuneace6f732013-04-01 21:47:53 +000015
16namespace llvm {
17
18class AMDGPUMachineFunction : public MachineFunctionInfo {
Matt Arsenaulte935f052016-06-18 05:15:53 +000019 uint64_t KernArgSize;
20 unsigned MaxKernArgAlign;
21
Juergen Ributzkad12ccbd2013-11-19 00:57:56 +000022 virtual void anchor();
Matt Arsenault762af962014-07-13 03:06:39 +000023
Vincent Lejeuneace6f732013-04-01 21:47:53 +000024public:
25 AMDGPUMachineFunction(const MachineFunction &MF);
Matt Arsenaulte935f052016-06-18 05:15:53 +000026
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 Stellardde60e252013-09-05 18:37:57 +000038 /// 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 Stellardc026e8b2013-06-28 15:47:08 +000041 /// Number of bytes in the LDS that are being used.
42 unsigned LDSSize;
Matt Arsenault762af962014-07-13 03:06:39 +000043
Jan Veselye5121f32014-10-14 20:05:26 +000044 /// Start of implicit kernel args
45 unsigned ABIArgOffset;
46
Nikolay Haustovbeb24f52016-07-01 10:00:58 +000047 bool isKernel() const;
Tom Stellard1e1b05d2015-11-06 11:45:14 +000048
Matt Arsenault3f981402014-09-15 15:41:53 +000049 unsigned ScratchSize;
50 bool IsKernel;
Vincent Lejeuneace6f732013-04-01 21:47:53 +000051};
52
Alexander Kornienkof00654e2015-06-23 09:49:53 +000053}
Benjamin Kramera7c40ef2014-08-13 16:26:38 +000054#endif