]> granicus.if.org Git - llvm/commitdiff
AMDGPU: Rename isKernel
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Thu, 30 Mar 2017 23:58:04 +0000 (23:58 +0000)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Thu, 30 Mar 2017 23:58:04 +0000 (23:58 +0000)
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
lib/Target/AMDGPU/AMDGPUMachineFunction.cpp
lib/Target/AMDGPU/AMDGPUMachineFunction.h

index 4f2a0ca2cd025dead39e1c5dc6e99fc2b0d58101..6abf64236f80fe05db71f0f170bea8ee79cce399 100644 (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(
index 0f43e62fe474e3fd55743d3fc884d10893d987d4..27fe639e3d4bb208e61d85633afd17ed5bcf332e 100644 (file)
 
 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.
index b7637f5bb977eb18c1c9cacf658af85b9c0a3497..8bfeb67ad4ecdcb040df0182ead2f26986ef93c1 100644 (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 {