1//===-- AVRCallingConv.td - Calling Conventions for AVR ----*- tablegen -*-===// 2// 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 6// 7//===----------------------------------------------------------------------===// 8// This describes the calling conventions for AVR architecture. 9// Normal functions use a special calling convention, solved in code. 10//===----------------------------------------------------------------------===// 11 12//===----------------------------------------------------------------------===// 13// AVR Return Value Calling Convention 14//===----------------------------------------------------------------------===// 15 16// Special return value calling convention for runtime functions. 17def RetCC_AVR_BUILTIN : CallingConv 18<[ 19 CCIfType<[i8], CCAssignToReg<[R24,R25]>>, 20 CCIfType<[i16], CCAssignToReg<[R23R22, R25R24]>> 21]>; 22 23//===----------------------------------------------------------------------===// 24// AVR Argument Calling Conventions 25//===----------------------------------------------------------------------===// 26 27// The calling conventions are implemented in custom C++ code 28 29// Calling convention for variadic functions. 30def ArgCC_AVR_Vararg : CallingConv 31<[ 32 // i16 are always passed through the stack with an alignment of 1. 33 CCAssignToStack<2, 1> 34]>; 35 36//===----------------------------------------------------------------------===// 37// Callee-saved register lists. 38//===----------------------------------------------------------------------===// 39 40def CSR_Normal : CalleeSavedRegs<(add R29, R28, (sequence "R%u", 17, 2))>; 41def CSR_Interrupts : CalleeSavedRegs<(add (sequence "R%u", 31, 0))>; 42