2016-03-11 16:00:27 +08:00
|
|
|
//===-- AMDGPUMachineFunctionInfo.h -------------------------------*- C++ -*-=//
|
2013-04-02 05:47:53 +08:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2016-03-11 16:00:27 +08:00
|
|
|
#ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPUMACHINEFUNCTION_H
|
|
|
|
#define LLVM_LIB_TARGET_AMDGPU_AMDGPUMACHINEFUNCTION_H
|
2013-04-02 05:47:53 +08:00
|
|
|
|
2016-07-27 00:45:58 +08:00
|
|
|
#include "llvm/ADT/DenseMap.h"
|
2017-06-06 19:49:48 +08:00
|
|
|
#include "llvm/CodeGen/MachineFunction.h"
|
2013-04-02 05:47:53 +08:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
|
|
|
class AMDGPUMachineFunction : public MachineFunctionInfo {
|
2016-07-27 00:45:58 +08:00
|
|
|
/// A map to keep track of local memory objects and their offsets within the
|
|
|
|
/// local memory space.
|
|
|
|
SmallDenseMap<const GlobalValue *, unsigned, 4> LocalMemoryObjects;
|
|
|
|
|
2016-06-18 13:15:53 +08:00
|
|
|
uint64_t KernArgSize;
|
|
|
|
unsigned MaxKernArgAlign;
|
|
|
|
|
2016-07-27 00:45:58 +08:00
|
|
|
/// 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;
|
|
|
|
|
2017-03-31 07:58:04 +08:00
|
|
|
// Kernels + shaders. i.e. functions called by the driver and not not called
|
|
|
|
// by other functions.
|
|
|
|
bool IsEntryFunction;
|
|
|
|
|
2017-02-28 03:35:42 +08:00
|
|
|
bool NoSignedZerosFPMath;
|
2014-07-13 11:06:39 +08:00
|
|
|
|
2013-04-02 05:47:53 +08:00
|
|
|
public:
|
|
|
|
AMDGPUMachineFunction(const MachineFunction &MF);
|
2016-06-18 13:15:53 +08:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2016-07-27 00:45:58 +08:00
|
|
|
uint64_t getKernArgSize() const {
|
|
|
|
return KernArgSize;
|
|
|
|
}
|
2014-07-13 11:06:39 +08:00
|
|
|
|
2016-12-07 05:53:10 +08:00
|
|
|
unsigned getMaxKernArgAlign() const {
|
|
|
|
return MaxKernArgAlign;
|
|
|
|
}
|
|
|
|
|
2016-07-27 00:45:58 +08:00
|
|
|
void setABIArgOffset(unsigned NewOffset) {
|
|
|
|
ABIArgOffset = NewOffset;
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned getABIArgOffset() const {
|
|
|
|
return ABIArgOffset;
|
|
|
|
}
|
2014-10-15 04:05:26 +08:00
|
|
|
|
2016-07-27 00:45:58 +08:00
|
|
|
unsigned getLDSSize() const {
|
|
|
|
return LDSSize;
|
|
|
|
}
|
2015-11-06 19:45:14 +08:00
|
|
|
|
2017-03-31 07:58:04 +08:00
|
|
|
bool isEntryFunction() const {
|
|
|
|
return IsEntryFunction;
|
2016-07-27 00:45:58 +08:00
|
|
|
}
|
|
|
|
|
2017-02-28 03:35:42 +08:00
|
|
|
bool hasNoSignedZerosFPMath() const {
|
|
|
|
return NoSignedZerosFPMath;
|
|
|
|
}
|
|
|
|
|
2016-07-27 00:45:58 +08:00
|
|
|
unsigned allocateLDSGlobal(const DataLayout &DL, const GlobalValue &GV);
|
2013-04-02 05:47:53 +08:00
|
|
|
};
|
|
|
|
|
2015-06-23 17:49:53 +08:00
|
|
|
}
|
2014-08-14 00:26:38 +08:00
|
|
|
#endif
|