• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1//===- ARCCallingConv.td - Calling Conventions for ARC -----*- 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 ARC architecture.
9//===----------------------------------------------------------------------===//
10
11//===----------------------------------------------------------------------===//
12// ARC Return Value Calling Convention
13//===----------------------------------------------------------------------===//
14def RetCC_ARC : CallingConv<[
15  // i32 are returned in registers R0, R1, R2, R3
16  CCIfType<[i32, i64], 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<[i64], CCAssignToStack<8, 4>>,
21  CCIfType<[i32], CCAssignToStack<4, 4>>
22]>;
23
24//===----------------------------------------------------------------------===//
25// ARC Argument Calling Conventions
26//===----------------------------------------------------------------------===//
27def CC_ARC : CallingConv<[
28  // Promote i8/i16 arguments to i32.
29  CCIfType<[i8, i16], CCPromoteToType<i32>>,
30
31  // The first 8 integer arguments are passed in integer registers.
32  CCIfType<[i32, i64], CCAssignToReg<[R0, R1, R2, R3, R4, R5, R6, R7]>>,
33
34  // Integer values get stored in stack slots that are 4 bytes in
35  // size and 4-byte aligned.
36  CCIfType<[i64], CCAssignToStack<8, 4>>,
37  CCIfType<[i32], CCAssignToStack<4, 4>>
38]>;
39
40def CSR_ARC : CalleeSavedRegs<(add (sequence "R%u", 13, 25), GP, FP)>;
41