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
20//===----------------------------------------------------------------------===//
21// XCore Argument Calling Conventions
22//===----------------------------------------------------------------------===//
23def CC_XCore : CallingConv<[
24  // Promote i8/i16 arguments to i32.
25  CCIfType<[i8, i16], CCPromoteToType<i32>>,
26
27  // The 'nest' parameter, if any, is passed in R11.
28  CCIfNest<CCAssignToReg<[R11]>>,
29
30  // The first 4 integer arguments are passed in integer registers.
31  CCIfType<[i32], CCAssignToReg<[R0, R1, R2, R3]>>,
32
33  // Integer values get stored in stack slots that are 4 bytes in
34  // size and 4-byte aligned.
35  CCIfType<[i32], CCAssignToStack<4, 4>>
36]>;
37