1 //===- LanaiCallingConv.td - Calling Conventions Lanai -------*- tablegen -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 // 10 // This describes the calling conventions for the Lanai architectures. 11 // 12 //===----------------------------------------------------------------------===// 13 14 //===----------------------------------------------------------------------===// 15 // Return Value Calling Conventions 16 //===----------------------------------------------------------------------===// 17 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>>, 22 23 // Put argument in registers if marked 'inreg' and not a vararg call. 24 CCIfNotVarArg<CCIfInReg<CCIfType<[i32], 25 CCAssignToReg<[R6, R7, R18, R19]>>>>, 26 27 // Otherwise they are assigned to the stack in 4-byte aligned units. 28 CCAssignToStack<4, 4> 29 ]>; 30 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>>, 35 36 // Put arguments in registers. 37 CCIfNotVarArg<CCIfType<[i32], CCAssignToReg<[ R6, R7, R18, R19 ]>>>, 38 39 // Otherwise they are assigned to the stack in 4-byte aligned units. 40 CCAssignToStack<4, 4> 41 ]>; 42 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]>> 48 ]>; 49 50 def CSR: CalleeSavedRegs<(add)>; 51