2016-07-23 16:41:05 -04:00
|
|
|
//===-- AMDGPUMachineFunctionInfo.h -------------------------------*- C++ -*-=//
|
2013-04-08 14:41:23 -04:00
|
|
|
//
|
2019-08-20 16:50:12 -04:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2013-04-08 14:41:23 -04:00
|
|
|
//
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
2016-07-23 16:41:05 -04:00
|
|
|
#ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPUMACHINEFUNCTION_H
|
|
|
|
|
#define LLVM_LIB_TARGET_AMDGPU_AMDGPUMACHINEFUNCTION_H
|
2013-04-08 14:41:23 -04:00
|
|
|
|
2017-01-02 14:17:04 -05:00
|
|
|
#include "llvm/ADT/DenseMap.h"
|
2017-06-10 09:44:06 -04:00
|
|
|
#include "llvm/CodeGen/MachineFunction.h"
|
2020-01-17 15:45:01 -05:00
|
|
|
#include "Utils/AMDGPUBaseInfo.h"
|
2013-04-08 14:41:23 -04:00
|
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
|
2018-07-28 06:51:19 -04:00
|
|
|
class GCNSubtarget;
|
|
|
|
|
|
2013-04-08 14:41:23 -04:00
|
|
|
class AMDGPUMachineFunction : public MachineFunctionInfo {
|
2017-01-02 14:17:04 -05:00
|
|
|
/// A map to keep track of local memory objects and their offsets within the
|
|
|
|
|
/// local memory space.
|
|
|
|
|
SmallDenseMap<const GlobalValue *, unsigned, 4> LocalMemoryObjects;
|
|
|
|
|
|
2018-07-28 06:51:19 -04:00
|
|
|
protected:
|
2020-07-26 15:36:28 -04:00
|
|
|
uint64_t ExplicitKernArgSize = 0; // Cache for this.
|
2019-10-23 13:51:42 -04:00
|
|
|
Align MaxKernArgAlign; // Cache for this.
|
2016-07-23 16:41:05 -04:00
|
|
|
|
2017-01-02 14:17:04 -05:00
|
|
|
/// Number of bytes in the LDS that are being used.
|
2020-07-26 15:36:28 -04:00
|
|
|
unsigned LDSSize = 0;
|
2017-01-02 14:17:04 -05:00
|
|
|
|
2020-01-17 15:45:01 -05:00
|
|
|
// State of MODE register, assumed FP mode.
|
|
|
|
|
AMDGPU::SIModeRegisterDefaults Mode;
|
|
|
|
|
|
2018-07-28 06:51:19 -04:00
|
|
|
// Kernels + shaders. i.e. functions called by the driver and not called
|
2017-04-16 12:01:22 -04:00
|
|
|
// by other functions.
|
2020-07-26 15:36:28 -04:00
|
|
|
bool IsEntryFunction = false;
|
2017-04-16 12:01:22 -04:00
|
|
|
|
2020-07-26 15:36:28 -04:00
|
|
|
bool NoSignedZerosFPMath = false;
|
2014-11-24 04:08:18 -05:00
|
|
|
|
2018-07-28 06:51:19 -04:00
|
|
|
// Function may be memory bound.
|
2020-07-26 15:36:28 -04:00
|
|
|
bool MemoryBound = false;
|
2016-07-23 16:41:05 -04:00
|
|
|
|
2018-07-28 06:51:19 -04:00
|
|
|
// Kernel may need limited waves per EU for better performance.
|
2020-07-26 15:36:28 -04:00
|
|
|
bool WaveLimiter = false;
|
2016-07-23 16:41:05 -04:00
|
|
|
|
2018-07-28 06:51:19 -04:00
|
|
|
public:
|
|
|
|
|
AMDGPUMachineFunction(const MachineFunction &MF);
|
2016-07-23 16:41:05 -04:00
|
|
|
|
2018-07-28 06:51:19 -04:00
|
|
|
uint64_t getExplicitKernArgSize() const {
|
|
|
|
|
return ExplicitKernArgSize;
|
2017-01-02 14:17:04 -05:00
|
|
|
}
|
2014-11-24 04:08:18 -05:00
|
|
|
|
2019-10-23 13:51:42 -04:00
|
|
|
unsigned getMaxKernArgAlign() const { return MaxKernArgAlign.value(); }
|
2015-01-18 11:17:27 -05:00
|
|
|
|
2017-01-02 14:17:04 -05:00
|
|
|
unsigned getLDSSize() const {
|
|
|
|
|
return LDSSize;
|
|
|
|
|
}
|
|
|
|
|
|
2020-01-17 15:45:01 -05:00
|
|
|
AMDGPU::SIModeRegisterDefaults getMode() const {
|
|
|
|
|
return Mode;
|
|
|
|
|
}
|
|
|
|
|
|
2017-04-16 12:01:22 -04:00
|
|
|
bool isEntryFunction() const {
|
|
|
|
|
return IsEntryFunction;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool hasNoSignedZerosFPMath() const {
|
|
|
|
|
return NoSignedZerosFPMath;
|
2017-01-02 14:17:04 -05:00
|
|
|
}
|
|
|
|
|
|
2018-07-28 06:51:19 -04:00
|
|
|
bool isMemoryBound() const {
|
|
|
|
|
return MemoryBound;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool needsWaveLimiter() const {
|
|
|
|
|
return WaveLimiter;
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-26 15:36:28 -04:00
|
|
|
unsigned allocateLDSGlobal(const DataLayout &DL, const GlobalVariable &GV);
|
2013-04-08 14:41:23 -04:00
|
|
|
};
|
|
|
|
|
|
2015-07-05 10:21:36 -04:00
|
|
|
}
|
2015-01-18 11:17:27 -05:00
|
|
|
#endif
|