1*0b57cec5SDimitry Andric//==- MSP430CallingConv.td - Calling Conventions for MSP430 -*- tablegen -*-==// 2*0b57cec5SDimitry Andric// 3*0b57cec5SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*0b57cec5SDimitry Andric// See https://llvm.org/LICENSE.txt for license information. 5*0b57cec5SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*0b57cec5SDimitry Andric// 7*0b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 8*0b57cec5SDimitry Andric// This describes the calling conventions for MSP430 architecture. 9*0b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 10*0b57cec5SDimitry Andric 11*0b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 12*0b57cec5SDimitry Andric// MSP430 Return Value Calling Convention 13*0b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 14*0b57cec5SDimitry Andricdef RetCC_MSP430 : CallingConv<[ 15*0b57cec5SDimitry Andric // i8 are returned in registers R12B, R13B, R14B, R15B 16*0b57cec5SDimitry Andric CCIfType<[i8], CCAssignToReg<[R12B, R13B, R14B, R15B]>>, 17*0b57cec5SDimitry Andric 18*0b57cec5SDimitry Andric // i16 are returned in registers R12, R13, R14, R15 19*0b57cec5SDimitry Andric CCIfType<[i16], CCAssignToReg<[R12, R13, R14, R15]>> 20*0b57cec5SDimitry Andric]>; 21*0b57cec5SDimitry Andric 22*0b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 23*0b57cec5SDimitry Andric// MSP430 Argument Calling Conventions 24*0b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 25*0b57cec5SDimitry Andricdef CC_MSP430_AssignStack : CallingConv<[ 26*0b57cec5SDimitry Andric // Pass by value if the byval attribute is given 27*0b57cec5SDimitry Andric CCIfByVal<CCPassByVal<2, 2>>, 28*0b57cec5SDimitry Andric 29*0b57cec5SDimitry Andric // Promote i8 arguments to i16. 30*0b57cec5SDimitry Andric CCIfType<[i8], CCPromoteToType<i16>>, 31*0b57cec5SDimitry Andric 32*0b57cec5SDimitry Andric // Integer values get stored in stack slots that are 2 bytes in 33*0b57cec5SDimitry Andric // size and 2-byte aligned. 34*0b57cec5SDimitry Andric CCIfType<[i16], CCAssignToStack<2, 2>> 35*0b57cec5SDimitry Andric]>; 36*0b57cec5SDimitry Andric 37