Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 1 | //===- MipsCallingConv.td - Calling Conventions for Mips --------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | 4ee451d | 2007-12-29 20:36:04 +0000 | [diff] [blame^] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // This describes the calling conventions for Mips architecture. |
| 10 | //===----------------------------------------------------------------------===// |
| 11 | |
| 12 | /// CCIfSubtarget - Match if the current subtarget has a feature F. |
| 13 | class CCIfSubtarget<string F, CCAction A>: |
| 14 | CCIf<!strconcat("State.getTarget().getSubtarget<MipsSubtarget>().", F), A>; |
| 15 | |
| 16 | //===----------------------------------------------------------------------===// |
| 17 | // Mips Return Value Calling Convention |
| 18 | //===----------------------------------------------------------------------===// |
| 19 | def 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 | //===----------------------------------------------------------------------===// |
| 28 | def 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 | |