1//===- XCoreCallingConv.td - Calling Conventions for XCore -*- tablegen -*-===//
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// This describes the calling conventions for XCore architecture.
10//===----------------------------------------------------------------------===//
11
12//===----------------------------------------------------------------------===//
13// XCore Return Value Calling Convention
14//===----------------------------------------------------------------------===//
15def RetCC_XCore : CallingConv<[
16  // i32 are returned in registers R0, R1, R2, R3
17  CCIfType<[i32], CCAssignToReg<[R0, R1, R2, R3]>>,
18
19  // Integer values get stored in stack slots that are 4 bytes in
20  // size and 4-byte aligned.
21  CCIfType<[i32], CCAssignToStack<4, 4>>
22]>;
23
24//===----------------------------------------------------------------------===//
25// XCore Argument Calling Conventions
26//===----------------------------------------------------------------------===//
27def CC_XCore : CallingConv<[
28  // Promote i8/i16 arguments to i32.
29  CCIfType<[i8, i16], CCPromoteToType<i32>>,
30
31  // The 'nest' parameter, if any, is passed in R11.
32  CCIfNest<CCAssignToReg<[R11]>>,
33
34  // The first 4 integer arguments are passed in integer registers.
35  CCIfType<[i32], CCAssignToReg<[R0, R1, R2, R3]>>,
36
37  // Integer values get stored in stack slots that are 4 bytes in
38  // size and 4-byte aligned.
39  CCIfType<[i32], CCAssignToStack<4, 4>>
40]>;
41