Christian Konig | 2c8f6d5 | 2013-03-07 09:03:52 +0000 | [diff] [blame] | 1 | //===---- AMDCallingConv.td - Calling Conventions for Radeon GPUs ---------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This describes the calling conventions for the AMD Radeon GPUs. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | // Inversion of CCIfInReg |
| 15 | class CCIfNotInReg<CCAction A> : CCIf<"!ArgFlags.isInReg()", A> {} |
| 16 | |
| 17 | // Calling convention for SI |
| 18 | def CC_SI : CallingConv<[ |
| 19 | |
| 20 | CCIfInReg<CCIfType<[f32, i32] , CCAssignToReg<[ |
| 21 | SGPR0, SGPR1, SGPR2, SGPR3, SGPR4, SGPR5, SGPR6, SGPR7, |
Tom Stellard | afcf12f | 2013-09-12 02:55:14 +0000 | [diff] [blame] | 22 | SGPR8, SGPR9, SGPR10, SGPR11, SGPR12, SGPR13, SGPR14, SGPR15, |
| 23 | SGPR16 |
Christian Konig | 2c8f6d5 | 2013-03-07 09:03:52 +0000 | [diff] [blame] | 24 | ]>>>, |
| 25 | |
| 26 | CCIfInReg<CCIfType<[i64] , CCAssignToRegWithShadow< |
| 27 | [ SGPR0, SGPR2, SGPR4, SGPR6, SGPR8, SGPR10, SGPR12, SGPR14 ], |
Tom Stellard | a36f077 | 2013-08-14 22:22:03 +0000 | [diff] [blame] | 28 | [ SGPR1, SGPR3, SGPR5, SGPR7, SGPR9, SGPR11, SGPR13, SGPR15 ] |
Christian Konig | 2c8f6d5 | 2013-03-07 09:03:52 +0000 | [diff] [blame] | 29 | >>>, |
| 30 | |
| 31 | CCIfNotInReg<CCIfType<[f32, i32] , CCAssignToReg<[ |
| 32 | VGPR0, VGPR1, VGPR2, VGPR3, VGPR4, VGPR5, VGPR6, VGPR7, |
| 33 | VGPR8, VGPR9, VGPR10, VGPR11, VGPR12, VGPR13, VGPR14, VGPR15, |
| 34 | VGPR16, VGPR17, VGPR18, VGPR19, VGPR20, VGPR21, VGPR22, VGPR23, |
| 35 | VGPR24, VGPR25, VGPR26, VGPR27, VGPR28, VGPR29, VGPR30, VGPR31 |
Vincent Lejeune | d623644 | 2013-10-13 17:56:16 +0000 | [diff] [blame] | 36 | ]>>>, |
| 37 | |
| 38 | CCIfByVal<CCIfType<[i64] , CCAssignToRegWithShadow< |
| 39 | [ SGPR0, SGPR2, SGPR4, SGPR6, SGPR8, SGPR10, SGPR12, SGPR14 ], |
| 40 | [ SGPR1, SGPR3, SGPR5, SGPR7, SGPR9, SGPR11, SGPR13, SGPR15 ] |
| 41 | >>> |
Christian Konig | 2c8f6d5 | 2013-03-07 09:03:52 +0000 | [diff] [blame] | 42 | |
Tom Stellard | ed882c2 | 2013-06-03 17:40:11 +0000 | [diff] [blame] | 43 | ]>; |
| 44 | |
Tom Stellard | acfeebf | 2013-07-23 01:48:05 +0000 | [diff] [blame] | 45 | // Calling convention for compute kernels |
| 46 | def CC_AMDGPU_Kernel : CallingConv<[ |
Tom Stellard | af77543 | 2013-10-23 00:44:32 +0000 | [diff] [blame^] | 47 | CCCustom<"allocateStack"> |
Christian Konig | 2c8f6d5 | 2013-03-07 09:03:52 +0000 | [diff] [blame] | 48 | ]>; |
| 49 | |
| 50 | def CC_AMDGPU : CallingConv<[ |
Tom Stellard | acfeebf | 2013-07-23 01:48:05 +0000 | [diff] [blame] | 51 | CCIf<"State.getTarget().getSubtarget<AMDGPUSubtarget>().getGeneration() == " |
| 52 | "AMDGPUSubtarget::SOUTHERN_ISLANDS && " |
| 53 | "State.getMachineFunction().getInfo<SIMachineFunctionInfo>()->"# |
| 54 | "ShaderType == ShaderType::COMPUTE", CCDelegateTo<CC_AMDGPU_Kernel>>, |
| 55 | CCIf<"State.getTarget().getSubtarget<AMDGPUSubtarget>().getGeneration() < " |
| 56 | "AMDGPUSubtarget::SOUTHERN_ISLANDS && " |
| 57 | "State.getMachineFunction().getInfo<R600MachineFunctionInfo>()->" |
| 58 | "ShaderType == ShaderType::COMPUTE", CCDelegateTo<CC_AMDGPU_Kernel>>, |
Tom Stellard | a6c6e1b | 2013-06-07 20:37:48 +0000 | [diff] [blame] | 59 | CCIf<"State.getTarget().getSubtarget<AMDGPUSubtarget>()"# |
| 60 | ".getGeneration() == AMDGPUSubtarget::SOUTHERN_ISLANDS", CCDelegateTo<CC_SI>> |
Christian Konig | 2c8f6d5 | 2013-03-07 09:03:52 +0000 | [diff] [blame] | 61 | ]>; |