1 //===- LanaiCallingConv.td - Calling Conventions Lanai -------*- tablegen -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This describes the calling conventions for the Lanai architectures.
12 //===----------------------------------------------------------------------===//
14 //===----------------------------------------------------------------------===//
15 // Return Value Calling Conventions
16 //===----------------------------------------------------------------------===//
18 // Lanai 32-bit C Calling convention.
19 def CC_Lanai32 : CallingConv<[
20 // Promote i8/i16 args to i32
21 CCIfType<[i8, i16], CCPromoteToType<i32>>,
23 // Put argument in registers if marked 'inreg' and not a vararg call.
24 CCIfNotVarArg<CCIfInReg<CCIfType<[i32],
25 CCAssignToReg<[R6, R7, R18, R19]>>>>,
27 // Otherwise they are assigned to the stack in 4-byte aligned units.
31 // Lanai 32-bit Fast Calling convention.
32 def CC_Lanai32_Fast : CallingConv<[
33 // Promote i8/i16 args to i32
34 CCIfType<[ i8, i16 ], CCPromoteToType<i32>>,
36 // Put arguments in registers.
37 CCIfNotVarArg<CCIfType<[i32], CCAssignToReg<[ R6, R7, R18, R19 ]>>>,
39 // Otherwise they are assigned to the stack in 4-byte aligned units.
43 // Lanai 32-bit C return-value convention.
44 def RetCC_Lanai32 : CallingConv<[
45 // Specify two registers to allow returning 64-bit results that have already
46 // been lowered to 2 32-bit values.
47 CCIfType<[i32], CCAssignToReg<[RV, R9]>>
50 def CSR: CalleeSavedRegs<(add)>;