SparcCallingConv.td revision 249423
1234353Sdim//===-- SparcCallingConv.td - Calling Conventions Sparc ----*- tablegen -*-===//
2234353Sdim//
3193323Sed//                     The LLVM Compiler Infrastructure
4193323Sed//
5193323Sed// This file is distributed under the University of Illinois Open Source
6193323Sed// License. See LICENSE.TXT for details.
7234353Sdim//
8193323Sed//===----------------------------------------------------------------------===//
9193323Sed//
10193323Sed// This describes the calling conventions for the Sparc architectures.
11193323Sed//
12193323Sed//===----------------------------------------------------------------------===//
13193323Sed
14193323Sed//===----------------------------------------------------------------------===//
15193323Sed// Return Value Calling Conventions
16193323Sed//===----------------------------------------------------------------------===//
17193323Sed
18193323Sed// Sparc 32-bit C return-value convention.
19193323Seddef RetCC_Sparc32 : CallingConv<[
20193323Sed  CCIfType<[i32], CCAssignToReg<[I0, I1, I2, I3, I4, I5]>>,
21193323Sed  CCIfType<[f32], CCAssignToReg<[F0, F1, F2, F3]>>,
22193323Sed  CCIfType<[f64], CCAssignToReg<[D0, D1]>>
23193323Sed]>;
24193323Sed
25249423Sdim// Sparc 64-bit C return-value convention.
26249423Sdimdef RetCC_Sparc64 : CallingConv<[
27249423Sdim  CCIfType<[i32], CCPromoteToType<i64>>,
28249423Sdim  CCIfType<[i64], CCAssignToReg<[I0, I1, I2, I3, I4, I5]>>,
29249423Sdim  CCIfType<[f32], CCAssignToReg<[F0, F1, F2, F3]>>,
30249423Sdim  CCIfType<[f64], CCAssignToReg<[D0, D1]>>
31249423Sdim]>;
32249423Sdim
33193323Sed// Sparc 32-bit C Calling convention.
34193323Seddef CC_Sparc32 : CallingConv<[
35218893Sdim  //Custom assign SRet to [sp+64].
36218893Sdim  CCIfSRet<CCCustom<"CC_Sparc_Assign_SRet">>,
37218893Sdim  // i32 f32 arguments get passed in integer registers if there is space.
38218893Sdim  CCIfType<[i32, f32], CCAssignToReg<[I0, I1, I2, I3, I4, I5]>>,
39218893Sdim  // f64 arguments are split and passed through registers or through stack.
40218893Sdim  CCIfType<[f64], CCCustom<"CC_Sparc_Assign_f64">>,
41218893Sdim
42193323Sed  // Alternatively, they are assigned to the stack in 4-byte aligned units.
43193323Sed  CCAssignToStack<4, 4>
44193323Sed]>;
45249423Sdim
46249423Sdim// Sparc 64-bit C Calling convention.
47249423Sdimdef CC_Sparc64 : CallingConv<[
48249423Sdim  // All integers are promoted to i64 by the caller.
49249423Sdim  CCIfType<[i32], CCPromoteToType<i64>>,
50249423Sdim  // Integer arguments get passed in integer registers if there is space.
51249423Sdim  CCIfType<[i64], CCAssignToReg<[I0, I1, I2, I3, I4, I5]>>,
52249423Sdim  // FIXME: Floating point arguments.
53249423Sdim
54249423Sdim  // Alternatively, they are assigned to the stack in 8-byte aligned units.
55249423Sdim  CCAssignToStack<8, 8>
56249423Sdim]>;
57