AMDGPU: Rename isKernel

What we really want to do is distinguish functions that may
be called by other functions, and graphics shaders are not
called kernels.

llvm-svn: 299140
This commit is contained in:
Matt Arsenault 2017-03-30 23:58:04 +00:00
parent 38daca6300
commit 1074cb5420
3 changed files with 22 additions and 6 deletions

View File

@ -164,7 +164,7 @@ void AMDGPUAsmPrinter::EmitFunctionBodyStart() {
void AMDGPUAsmPrinter::EmitFunctionEntryLabel() {
const SIMachineFunctionInfo *MFI = MF->getInfo<SIMachineFunctionInfo>();
const AMDGPUSubtarget &STM = MF->getSubtarget<AMDGPUSubtarget>();
if (MFI->isKernel() && STM.isAmdCodeObjectV2(*MF)) {
if (MFI->isEntryFunction() && STM.isAmdCodeObjectV2(*MF)) {
SmallString<128> SymbolName;
getNameWithPrefix(SymbolName, MF->getFunction()),
getTargetStreamer().EmitAMDGPUSymbolType(

View File

@ -12,6 +12,20 @@
using namespace llvm;
static bool isEntryFunctionCC(CallingConv::ID CC) {
switch (CC) {
case CallingConv::AMDGPU_KERNEL:
case CallingConv::SPIR_KERNEL:
case CallingConv::AMDGPU_VS:
case CallingConv::AMDGPU_GS:
case CallingConv::AMDGPU_PS:
case CallingConv::AMDGPU_CS:
return true;
default:
return false;
}
}
AMDGPUMachineFunction::AMDGPUMachineFunction(const MachineFunction &MF) :
MachineFunctionInfo(),
LocalMemoryObjects(),
@ -19,8 +33,7 @@ AMDGPUMachineFunction::AMDGPUMachineFunction(const MachineFunction &MF) :
MaxKernArgAlign(0),
LDSSize(0),
ABIArgOffset(0),
IsKernel(MF.getFunction()->getCallingConv() == CallingConv::AMDGPU_KERNEL ||
MF.getFunction()->getCallingConv() == CallingConv::SPIR_KERNEL),
IsEntryFunction(isEntryFunctionCC(MF.getFunction()->getCallingConv())),
NoSignedZerosFPMath(MF.getTarget().Options.NoSignedZerosFPMath) {
// FIXME: Should initialize KernArgSize based on ExplicitKernelArgOffset,
// except reserved size is not correctly aligned.

View File

@ -30,7 +30,10 @@ class AMDGPUMachineFunction : public MachineFunctionInfo {
/// Start of implicit kernel args
unsigned ABIArgOffset;
bool IsKernel;
// Kernels + shaders. i.e. functions called by the driver and not not called
// by other functions.
bool IsEntryFunction;
bool NoSignedZerosFPMath;
public:
@ -67,8 +70,8 @@ public:
return LDSSize;
}
bool isKernel() const {
return IsKernel;
bool isEntryFunction() const {
return IsEntryFunction;
}
bool hasNoSignedZerosFPMath() const {