• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1//===- XCoreCallingConv.td - Calling Conventions for XCore -*- tablegen -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8// This describes the calling conventions for XCore architecture.
9//===----------------------------------------------------------------------===//
10
11//===----------------------------------------------------------------------===//
12// XCore Return Value Calling Convention
13//===----------------------------------------------------------------------===//
14def RetCC_XCore : CallingConv<[
15  // i32 are returned in registers R0, R1, R2, R3
16  CCIfType<[i32], CCAssignToReg<[R0, R1, R2, R3]>>,
17
18  // Integer values get stored in stack slots that are 4 bytes in
19  // size and 4-byte aligned.
20  CCIfType<[i32], CCAssignToStack<4, 4>>
21]>;
22
23//===----------------------------------------------------------------------===//
24// XCore Argument Calling Conventions
25//===----------------------------------------------------------------------===//
26def CC_XCore : CallingConv<[
27  // Promote i8/i16 arguments to i32.
28  CCIfType<[i8, i16], CCPromoteToType<i32>>,
29
30  // The 'nest' parameter, if any, is passed in R11.
31  CCIfNest<CCAssignToReg<[R11]>>,
32
33  // The first 4 integer arguments are passed in integer registers.
34  CCIfType<[i32], CCAssignToReg<[R0, R1, R2, R3]>>,
35
36  // Integer values get stored in stack slots that are 4 bytes in
37  // size and 4-byte aligned.
38  CCIfType<[i32], CCAssignToStack<4, 4>>
39]>;
40