1193323Sed//==- MSP430CallingConv.td - Calling Conventions for MSP430 -*- tablegen -*-==//
2193323Sed//
3353358Sdim// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4353358Sdim// See https://llvm.org/LICENSE.txt for license information.
5353358Sdim// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6193323Sed//
7193323Sed//===----------------------------------------------------------------------===//
8193323Sed// This describes the calling conventions for MSP430 architecture.
9193323Sed//===----------------------------------------------------------------------===//
10193323Sed
11193323Sed//===----------------------------------------------------------------------===//
12193323Sed// MSP430 Return Value Calling Convention
13193323Sed//===----------------------------------------------------------------------===//
14193323Seddef RetCC_MSP430 : CallingConv<[
15321369Sdim  // i8 are returned in registers R12B, R13B, R14B, R15B
16321369Sdim  CCIfType<[i8], CCAssignToReg<[R12B, R13B, R14B, R15B]>>,
17193323Sed
18321369Sdim  // i16 are returned in registers R12, R13, R14, R15
19321369Sdim  CCIfType<[i16], CCAssignToReg<[R12, R13, R14, R15]>>
20193323Sed]>;
21193323Sed
22193323Sed//===----------------------------------------------------------------------===//
23193323Sed// MSP430 Argument Calling Conventions
24193323Sed//===----------------------------------------------------------------------===//
25261991Sdimdef CC_MSP430_AssignStack : CallingConv<[
26249423Sdim  // Pass by value if the byval attribute is given
27249423Sdim  CCIfByVal<CCPassByVal<2, 2>>,
28249423Sdim
29193323Sed  // Promote i8 arguments to i16.
30193323Sed  CCIfType<[i8], CCPromoteToType<i16>>,
31193323Sed
32193323Sed  // Integer values get stored in stack slots that are 2 bytes in
33193323Sed  // size and 2-byte aligned.
34193323Sed  CCIfType<[i16], CCAssignToStack<2, 2>>
35193323Sed]>;
36261991Sdim
37