1 //===- LanaiCallingConv.td - Calling Conventions Lanai -------*- 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 //===----------------------------------------------------------------------===//
9 // This describes the calling conventions for the Lanai architectures.
11 //===----------------------------------------------------------------------===//
13 //===----------------------------------------------------------------------===//
14 // Return Value Calling Conventions
15 //===----------------------------------------------------------------------===//
17 // Lanai 32-bit C Calling convention.
18 def CC_Lanai32 : CallingConv<[
19 // Promote i8/i16 args to i32
20 CCIfType<[i8, i16], CCPromoteToType<i32>>,
22 // Put argument in registers if marked 'inreg' and not a vararg call.
23 CCIfNotVarArg<CCIfInReg<CCIfType<[i32],
24 CCAssignToReg<[R6, R7, R18, R19]>>>>,
26 // Otherwise they are assigned to the stack in 4-byte aligned units.
30 // Lanai 32-bit Fast Calling convention.
31 def CC_Lanai32_Fast : CallingConv<[
32 // Promote i8/i16 args to i32
33 CCIfType<[ i8, i16 ], CCPromoteToType<i32>>,
35 // Put arguments in registers.
36 CCIfNotVarArg<CCIfType<[i32], CCAssignToReg<[ R6, R7, R18, R19 ]>>>,
38 // Otherwise they are assigned to the stack in 4-byte aligned units.
42 // Lanai 32-bit C return-value convention.
43 def RetCC_Lanai32 : CallingConv<[
44 // Specify two registers to allow returning 64-bit results that have already
45 // been lowered to 2 32-bit values.
46 CCIfType<[i32], CCAssignToReg<[RV, R9]>>
49 def CSR: CalleeSavedRegs<(add)>;