[PATCH] D31212: AMDGPU: Rename isKernel

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 21 16:54:29 PDT 2017


arsenm updated this revision to Diff 92570.
arsenm added a comment.

Don't bother preserving old behavior for C


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,28 @@
 
 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(),
   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.92570.patch
Type: text/x-patch
Size: 2594 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170321/a20eff71/attachment.bin>


More information about the llvm-commits mailing list