xref: /freebsd/contrib/llvm-project/llvm/lib/Target/AVR/AVRCallingConv.td (revision 349cc55c9796c4596a5b9904cd3281af295f878f)
10b57cec5SDimitry Andric//===-- AVRCallingConv.td - Calling Conventions for AVR ----*- tablegen -*-===//
20b57cec5SDimitry Andric//
30b57cec5SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric// See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric//
70b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric// This describes the calling conventions for AVR architecture.
95ffd83dbSDimitry Andric// Normal functions use a special calling convention, solved in code.
100b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
110b57cec5SDimitry Andric
120b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
130b57cec5SDimitry Andric// AVR Return Value Calling Convention
140b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
150b57cec5SDimitry Andric
160b57cec5SDimitry Andric// Special return value calling convention for runtime functions.
17*349cc55cSDimitry Andricdef RetCC_AVR_BUILTIN : CallingConv<[
180b57cec5SDimitry Andric  CCIfType<[i8], CCAssignToReg<[R24, R25]>>,
190b57cec5SDimitry Andric  CCIfType<[i16], CCAssignToReg<[R23R22, R25R24]>>
200b57cec5SDimitry Andric]>;
210b57cec5SDimitry Andric
220b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
230b57cec5SDimitry Andric// AVR Argument Calling Conventions
240b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
250b57cec5SDimitry Andric
260b57cec5SDimitry Andric// The calling conventions are implemented in custom C++ code
270b57cec5SDimitry Andric
280b57cec5SDimitry Andric// Calling convention for variadic functions.
29*349cc55cSDimitry Andricdef ArgCC_AVR_Vararg : CallingConv<[
300b57cec5SDimitry Andric  // i16 are always passed through the stack with an alignment of 1.
310b57cec5SDimitry Andric  CCAssignToStack<2, 1>
320b57cec5SDimitry Andric]>;
330b57cec5SDimitry Andric
340b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
350b57cec5SDimitry Andric// Callee-saved register lists.
360b57cec5SDimitry Andric//===----------------------------------------------------------------------===//
370b57cec5SDimitry Andric
380b57cec5SDimitry Andricdef CSR_Normal : CalleeSavedRegs<(add R29, R28, (sequence "R%u", 17, 2))>;
390b57cec5SDimitry Andricdef CSR_Interrupts : CalleeSavedRegs<(add(sequence "R%u", 31, 0))>;
40