1 //===- ARCCallingConv.td - Calling Conventions for ARC -----*- tablegen -*-===//
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
7 //===----------------------------------------------------------------------===//
8 // This describes the calling conventions for ARC architecture.
9 //===----------------------------------------------------------------------===//
11 //===----------------------------------------------------------------------===//
12 // ARC Return Value Calling Convention
13 //===----------------------------------------------------------------------===//
14 def RetCC_ARC : CallingConv<[
15 // i32 are returned in registers R0, R1, R2, R3
16 CCIfType<[i32, i64], CCAssignToReg<[R0, R1, R2, R3]>>,
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>>
24 //===----------------------------------------------------------------------===//
25 // ARC Argument Calling Conventions
26 //===----------------------------------------------------------------------===//
27 def CC_ARC : CallingConv<[
28 // Promote i8/i16 arguments to i32.
29 CCIfType<[i8, i16], CCPromoteToType<i32>>,
31 // The first 8 integer arguments are passed in integer registers.
32 CCIfType<[i32, i64], CCAssignToReg<[R0, R1, R2, R3, R4, R5, R6, R7]>>,
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>>
40 def CSR_ARC : CalleeSavedRegs<(add (sequence "R%u", 13, 25), GP, FP)>;