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<[
18 CCIfType<[i8], CCAssignToReg<[R24, R25]>>,
19 CCIfType<[i16], CCAssignToReg<[R23R22, R25R24]>>
22 //===----------------------------------------------------------------------===//
23 // AVR Argument Calling Conventions
24 //===----------------------------------------------------------------------===//
26 // The calling conventions are implemented in custom C++ code
28 // Calling convention for variadic functions.
29 def ArgCC_AVR_Vararg : CallingConv<[
30 // i8 are always passed through the stack with a byte slot and byte alignment.
31 CCIfType<[i8], CCAssignToStack<1, 1>>,
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_NormalTiny : CalleeSavedRegs<(add R29, R28, R19, R18)>;
42 def CSR_Interrupts : CalleeSavedRegs<(add(sequence "R%u", 31, 2))>;
43 def CSR_InterruptsTiny : CalleeSavedRegs<(add(sequence "R%u", 31, 18))>;