[PATCH] D31212: AMDGPU: Rename isKernel
Matt Arsenault via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 21 14:30:10 PDT 2017
arsenm created this revision.
Herald added subscribers: tpr, dstuttard, tony-tye, yaxunl, nhaehnle, wdng, kzhuravl.
What we really want to do is distinguish functions that may
be called by other functions, and graphics shaders are not
called kernels.
https://reviews.llvm.org/D31212
Files:
lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
lib/Target/AMDGPU/AMDGPUMachineFunction.cpp
lib/Target/AMDGPU/AMDGPUMachineFunction.h
Index: lib/Target/AMDGPU/AMDGPUMachineFunction.h
===================================================================
--- lib/Target/AMDGPU/AMDGPUMachineFunction.h
+++ lib/Target/AMDGPU/AMDGPUMachineFunction.h
@@ -30,7 +30,10 @@
/// 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 @@
return LDSSize;
}
- bool isKernel() const {
- return IsKernel;
+ bool isEntryFunction() const {
+ return IsEntryFunction;
}
bool hasNoSignedZerosFPMath() const {
Index: lib/Target/AMDGPU/AMDGPUMachineFunction.cpp
===================================================================
--- lib/Target/AMDGPU/AMDGPUMachineFunction.cpp
+++ lib/Target/AMDGPU/AMDGPUMachineFunction.cpp
@@ -12,15 +12,29 @@
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:
+
+ // TODO: Remove callable functions.
+ default:
+ return true;
+ }
+}
+
AMDGPUMachineFunction::AMDGPUMachineFunction(const MachineFunction &MF) :
MachineFunctionInfo(),
LocalMemoryObjects(),
KernArgSize(0),
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.
Index: lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
===================================================================
--- lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
+++ lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
@@ -145,7 +145,7 @@
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)) {
AMDGPUTargetStreamer *TS =
static_cast<AMDGPUTargetStreamer *>(OutStreamer->getTargetStreamer());
SmallString<128> SymbolName;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31212.92548.patch
Type: text/x-patch
Size: 2618 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170321/4e3dbc15/attachment.bin>
More information about the llvm-commits
mailing list