Jia Liu | 31d157a | 2012-02-18 12:03:15 +0000 | [diff] [blame] | 1 | //===-- SparcCallingConv.td - Calling Conventions Sparc ----*- tablegen -*-===// |
| 2 | // |
Chris Lattner | 5a65b92 | 2008-03-17 05:41:48 +0000 | [diff] [blame] | 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. |
Jia Liu | 31d157a | 2012-02-18 12:03:15 +0000 | [diff] [blame] | 7 | // |
Chris Lattner | 5a65b92 | 2008-03-17 05:41:48 +0000 | [diff] [blame] | 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This describes the calling conventions for the Sparc architectures. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | //===----------------------------------------------------------------------===// |
| 15 | // Return Value Calling Conventions |
| 16 | //===----------------------------------------------------------------------===// |
| 17 | |
| 18 | // Sparc 32-bit C return-value convention. |
| 19 | def RetCC_Sparc32 : CallingConv<[ |
Anton Korobeynikov | df75bba | 2008-10-10 20:30:14 +0000 | [diff] [blame] | 20 | CCIfType<[i32], CCAssignToReg<[I0, I1, I2, I3, I4, I5]>>, |
Anton Korobeynikov | 875314b | 2008-10-10 21:47:37 +0000 | [diff] [blame] | 21 | CCIfType<[f32], CCAssignToReg<[F0, F1, F2, F3]>>, |
| 22 | CCIfType<[f64], CCAssignToReg<[D0, D1]>> |
Chris Lattner | 5a65b92 | 2008-03-17 05:41:48 +0000 | [diff] [blame] | 23 | ]>; |
Chris Lattner | 315123f | 2008-03-17 06:58:37 +0000 | [diff] [blame] | 24 | |
| 25 | // Sparc 32-bit C Calling convention. |
| 26 | def CC_Sparc32 : CallingConv<[ |
Venkatraman Govindaraju | 8184e28 | 2011-01-22 13:05:16 +0000 | [diff] [blame] | 27 | //Custom assign SRet to [sp+64]. |
| 28 | CCIfSRet<CCCustom<"CC_Sparc_Assign_SRet">>, |
Venkatraman Govindaraju | 687ae96 | 2011-01-18 06:09:55 +0000 | [diff] [blame] | 29 | // i32 f32 arguments get passed in integer registers if there is space. |
| 30 | CCIfType<[i32, f32], CCAssignToReg<[I0, I1, I2, I3, I4, I5]>>, |
| 31 | // f64 arguments are split and passed through registers or through stack. |
| 32 | CCIfType<[f64], CCCustom<"CC_Sparc_Assign_f64">>, |
| 33 | |
Chris Lattner | 315123f | 2008-03-17 06:58:37 +0000 | [diff] [blame] | 34 | // Alternatively, they are assigned to the stack in 4-byte aligned units. |
| 35 | CCAssignToStack<4, 4> |
| 36 | ]>; |