1 //===-- AVRCallingConv.td - Calling Conventions for AVR ----*- tablegen -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
9 // This describes the calling conventions for AVR architecture.
10 //===----------------------------------------------------------------------===//
12 //===----------------------------------------------------------------------===//
13 // AVR Return Value Calling Convention
14 //===----------------------------------------------------------------------===//
16 def RetCC_AVR : CallingConv
18 // i8 is returned in R24.
19 CCIfType<[i8], CCAssignToReg<[R24]>>,
21 // i16 are returned in R25:R24, R23:R22, R21:R20 and R19:R18.
22 CCIfType<[i16], CCAssignToReg<[R25R24, R23R22, R21R20, R19R18]>>
25 // Special return value calling convention for runtime functions.
26 def RetCC_AVR_RT : CallingConv
28 CCIfType<[i8], CCAssignToReg<[R24,R25]>>,
29 CCIfType<[i16], CCAssignToReg<[R23R22, R25R24]>>
32 //===----------------------------------------------------------------------===//
33 // AVR Argument Calling Conventions
34 //===----------------------------------------------------------------------===//
36 // The calling conventions are implemented in custom C++ code
38 // Calling convention for variadic functions.
39 def ArgCC_AVR_Vararg : CallingConv
41 // i16 are always passed through the stack with an alignment of 1.
45 // Special argument calling convention for
46 // multiplication runtime functions.
47 def ArgCC_AVR_RT_MUL : CallingConv
49 CCIfType<[i16], CCAssignToReg<[R27R26,R19R18]>>
52 // Special argument calling convention for
53 // division runtime functions.
54 def ArgCC_AVR_RT_DIV : CallingConv
56 CCIfType<[i8], CCAssignToReg<[R24,R22]>>,
57 CCIfType<[i16], CCAssignToReg<[R25R24, R23R22]>>
60 //===----------------------------------------------------------------------===//
61 // Callee-saved register lists.
62 //===----------------------------------------------------------------------===//
64 def CSR_Normal : CalleeSavedRegs<(add R29, R28, (sequence "R%u", 17, 2))>;
65 def CSR_Interrupts : CalleeSavedRegs<(add (sequence "R%u", 31, 0))>;