blob: 23ef8503d386317cb788fa920a959e312d9459da [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001//===- MipsCallingConv.td - Calling Conventions for Mips --------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file was developed by Bruno Cardoso Lopes and is distributed under the
6// University of Illinois Open Source License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9// This describes the calling conventions for Mips architecture.
10//===----------------------------------------------------------------------===//
11
12/// CCIfSubtarget - Match if the current subtarget has a feature F.
13class CCIfSubtarget<string F, CCAction A>:
14 CCIf<!strconcat("State.getTarget().getSubtarget<MipsSubtarget>().", F), A>;
15
16//===----------------------------------------------------------------------===//
17// Mips Return Value Calling Convention
18//===----------------------------------------------------------------------===//
19def RetCC_Mips : CallingConv<[
20 // i32 are returned in registers V0, V1
21 CCIfType<[i32], CCAssignToReg<[V0, V1]>>
22]>;
23
24
25//===----------------------------------------------------------------------===//
26// Mips Argument Calling Conventions
27//===----------------------------------------------------------------------===//
28def CC_Mips : CallingConv<[
29 // Promote i8/i16 arguments to i32.
30 CCIfType<[i8, i16], CCPromoteToType<i32>>,
31
32 // The first 4 integer arguments are passed in integer registers.
33 CCIfType<[i32], CCAssignToReg<[A0, A1, A2, A3]>>,
34
35 // Integer values get stored in stack slots that are 4 bytes in
36 // size and 4-byte aligned.
37 CCIfType<[i32], CCAssignToStack<4, 4>>
38]>;
39