blob: b38ac616dcf4654789b17150d3105bdbd48c9399 [file] [log] [blame]
Jia Liub22310f2012-02-18 12:03:15 +00001//===-- SparcCallingConv.td - Calling Conventions Sparc ----*- tablegen -*-===//
2//
Chris Lattner49b269d2008-03-17 05:41:48 +00003// 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 Liub22310f2012-02-18 12:03:15 +00007//
Chris Lattner49b269d2008-03-17 05:41:48 +00008//===----------------------------------------------------------------------===//
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.
19def RetCC_Sparc32 : CallingConv<[
Anton Korobeynikovf8a4a0e2008-10-10 20:30:14 +000020 CCIfType<[i32], CCAssignToReg<[I0, I1, I2, I3, I4, I5]>>,
Anton Korobeynikov58deb692008-10-10 21:47:37 +000021 CCIfType<[f32], CCAssignToReg<[F0, F1, F2, F3]>>,
22 CCIfType<[f64], CCAssignToReg<[D0, D1]>>
Chris Lattner49b269d2008-03-17 05:41:48 +000023]>;
Chris Lattner7d4152b2008-03-17 06:58:37 +000024
Jakob Stoklund Olesen0b21f352013-04-02 04:09:02 +000025// Sparc 64-bit C return-value convention.
26def RetCC_Sparc64 : CallingConv<[
27 CCIfType<[i32], CCPromoteToType<i64>>,
28 CCIfType<[i64], CCAssignToReg<[I0, I1, I2, I3, I4, I5]>>,
29 CCIfType<[f32], CCAssignToReg<[F0, F1, F2, F3]>>,
30 CCIfType<[f64], CCAssignToReg<[D0, D1]>>
31]>;
32
Chris Lattner7d4152b2008-03-17 06:58:37 +000033// Sparc 32-bit C Calling convention.
34def CC_Sparc32 : CallingConv<[
Venkatraman Govindarajucc91b7a2011-01-22 13:05:16 +000035 //Custom assign SRet to [sp+64].
36 CCIfSRet<CCCustom<"CC_Sparc_Assign_SRet">>,
Venkatraman Govindarajuc386f8a2011-01-18 06:09:55 +000037 // i32 f32 arguments get passed in integer registers if there is space.
38 CCIfType<[i32, f32], CCAssignToReg<[I0, I1, I2, I3, I4, I5]>>,
39 // f64 arguments are split and passed through registers or through stack.
40 CCIfType<[f64], CCCustom<"CC_Sparc_Assign_f64">>,
41
Chris Lattner7d4152b2008-03-17 06:58:37 +000042 // Alternatively, they are assigned to the stack in 4-byte aligned units.
43 CCAssignToStack<4, 4>
44]>;
Jakob Stoklund Olesen0b21f352013-04-02 04:09:02 +000045
46// Sparc 64-bit C Calling convention.
47def CC_Sparc64 : CallingConv<[
48 // All integers are promoted to i64 by the caller.
49 CCIfType<[i32], CCPromoteToType<i64>>,
50 // Integer arguments get passed in integer registers if there is space.
51 CCIfType<[i64], CCAssignToReg<[I0, I1, I2, I3, I4, I5]>>,
52 // FIXME: Floating point arguments.
53
54 // Alternatively, they are assigned to the stack in 8-byte aligned units.
55 CCAssignToStack<8, 8>
56]>;