blob: 85f019dcc61d66954ef3b226ed0a116c06a88e24 [file] [log] [blame]
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +00001//===- MipsCallingConv.td - Calling Conventions for Mips --------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner4ee451d2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Bruno Cardoso Lopes972f5892007-06-06 07:42:06 +00007//
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