From 839e869207cbced2b4805b5852f41c2982dda892 Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Thu, 30 Mar 2017 23:58:04 +0000 Subject: [PATCH] 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299140 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp | 2 +- lib/Target/AMDGPU/AMDGPUMachineFunction.cpp | 17 +++++++++++++++-- lib/Target/AMDGPU/AMDGPUMachineFunction.h | 9 ++++++--- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp b/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp index 4f2a0ca2cd0..6abf64236f8 100644 --- a/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp +++ b/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp @@ -164,7 +164,7 @@ void AMDGPUAsmPrinter::EmitFunctionBodyStart() { void AMDGPUAsmPrinter::EmitFunctionEntryLabel() { const SIMachineFunctionInfo *MFI = MF->getInfo(); const AMDGPUSubtarget &STM = MF->getSubtarget(); - if (MFI->isKernel() && STM.isAmdCodeObjectV2(*MF)) { + if (MFI->isEntryFunction() && STM.isAmdCodeObjectV2(*MF)) { SmallString<128> SymbolName; getNameWithPrefix(SymbolName, MF->getFunction()), getTargetStreamer().EmitAMDGPUSymbolType( diff --git a/lib/Target/AMDGPU/AMDGPUMachineFunction.cpp b/lib/Target/AMDGPU/AMDGPUMachineFunction.cpp index 0f43e62fe47..27fe639e3d4 100644 --- a/lib/Target/AMDGPU/AMDGPUMachineFunction.cpp +++ b/lib/Target/AMDGPU/AMDGPUMachineFunction.cpp @@ -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. diff --git a/lib/Target/AMDGPU/AMDGPUMachineFunction.h b/lib/Target/AMDGPU/AMDGPUMachineFunction.h index b7637f5bb97..8bfeb67ad4e 100644 --- a/lib/Target/AMDGPU/AMDGPUMachineFunction.h +++ b/lib/Target/AMDGPU/AMDGPUMachineFunction.h @@ -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 { -- 2.40.0