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