llvm/lib/Target/AMDGPU/AMDGPUMachineFunction.h
Matt Arsenault d506595769 AMDGPU: Make AMDGPUMachineFunction fields private
ABIArgOffset is a problem because properly fsetting the
KernArgSize requires that the reserved area before the
real kernel arguments be correctly aligned, which requires
fixing clover.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276766 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-26 16:45:58 +00:00

74 lines
1.7 KiB
C++

//===-- AMDGPUMachineFunctionInfo.h -------------------------------*- C++ -*-=//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPUMACHINEFUNCTION_H
#define LLVM_LIB_TARGET_AMDGPU_AMDGPUMACHINEFUNCTION_H
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/ADT/DenseMap.h"
namespace llvm {
class AMDGPUMachineFunction : public MachineFunctionInfo {
/// A map to keep track of local memory objects and their offsets within the
/// local memory space.
SmallDenseMap<const GlobalValue *, unsigned, 4> LocalMemoryObjects;
uint64_t KernArgSize;
unsigned MaxKernArgAlign;
/// Number of bytes in the LDS that are being used.
unsigned LDSSize;
// FIXME: This should probably be removed.
/// Start of implicit kernel args
unsigned ABIArgOffset;
bool IsKernel;
public:
AMDGPUMachineFunction(const MachineFunction &MF);
uint64_t allocateKernArg(uint64_t Size, unsigned Align) {
assert(isPowerOf2_32(Align));
KernArgSize = alignTo(KernArgSize, Align);
uint64_t Result = KernArgSize;
KernArgSize += Size;
MaxKernArgAlign = std::max(Align, MaxKernArgAlign);
return Result;
}
uint64_t getKernArgSize() const {
return KernArgSize;
}
void setABIArgOffset(unsigned NewOffset) {
ABIArgOffset = NewOffset;
}
unsigned getABIArgOffset() const {
return ABIArgOffset;
}
unsigned getLDSSize() const {
return LDSSize;
}
bool isKernel() const {
return IsKernel;
}
unsigned allocateLDSGlobal(const DataLayout &DL, const GlobalValue &GV);
};
}
#endif