1//===-- RISCVCallingConv.td - Calling Conventions RISCV ----*- 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 RISCV architecture. 11// 12//===----------------------------------------------------------------------===// 13 14// RISCV 32-bit C return-value convention. 15def RetCC_RISCV32 : CallingConv<[CCIfType<[i32], CCAssignToReg<[X10, X11]>>]>; 16 17// RISCV 32-bit C Calling convention. 18def CC_RISCV32 : CallingConv<[ 19 // Promote i8/i16 args to i32 20 CCIfType<[ i8, i16 ], CCPromoteToType<i32>>, 21 22 // All arguments get passed in integer registers if there is space. 23 CCIfType<[i32], CCAssignToReg<[ X10, X11, X12, X13, X14, X15, X16, X17]>>, 24 25 // Could be assigned to the stack in 8-byte aligned units, but unsupported 26 CCAssignToStack<8, 8> 27]>; 28 29def CSR : CalleeSavedRegs<(add X1, X3, X4, X8, X9, (sequence "X%u", 18, 27))>; 30