44 lines · plain
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-exception6//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 Convention14//===----------------------------------------------------------------------===//15 16// Special return value calling convention for runtime functions.17def RetCC_AVR_BUILTIN : CallingConv<[18 CCIfType<[i8], CCAssignToReg<[R24, R25]>>,19 CCIfType<[i16], CCAssignToReg<[R23R22, R25R24]>>20]>;21 22//===----------------------------------------------------------------------===//23// AVR Argument Calling Conventions24//===----------------------------------------------------------------------===//25 26// The calling conventions are implemented in custom C++ code27 28// Calling convention for variadic functions.29def 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.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_NormalTiny : CalleeSavedRegs<(add R29, R28, R19, R18)>;42def CSR_Interrupts : CalleeSavedRegs<(add(sequence "R%u", 31, 2))>;43def CSR_InterruptsTiny : CalleeSavedRegs<(add(sequence "R%u", 31, 18))>;44