Adding the MicroBlaze backend.
[oota-llvm.git] / lib / Target / MBlaze / MBlazeCallingConv.td
1 //===- MBlazeCallingConv.td - Calling Conventions for MBlaze ----*- C++ -*-===//
2 // 
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 // 
8 //===----------------------------------------------------------------------===//
9 // This describes the calling conventions for MBlaze 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<MBlazeSubtarget>().", F), A>;
15
16 //===----------------------------------------------------------------------===//
17 // MBlaze ABI Calling Convention
18 //===----------------------------------------------------------------------===//
19
20 def CC_MBlaze : CallingConv<[
21   // Promote i8/i16 arguments to i32.
22   CCIfType<[i8, i16], CCPromoteToType<i32>>,
23
24   // Integer arguments are passed in integer registers.
25   CCIfType<[i32], CCAssignToReg<[R5, R6, R7, R8, R9, R10]>>,
26
27   // Single fp arguments are passed in floating point registers
28   CCIfType<[f32], CCAssignToReg<[F5, F6, F7, F8, F9, F10]>>,
29
30   // 32-bit values get stored in stack slots that are 4 bytes in
31   // size and 4-byte aligned.
32   CCIfType<[i32, f32], CCAssignToStack<4, 4>>
33 ]>;
34
35 def RetCC_MBlaze : CallingConv<[
36   // i32 are returned in registers R3, R4
37   CCIfType<[i32], CCAssignToReg<[R3, R4]>>,
38
39   // f32 are returned in registers F3, F4
40   CCIfType<[f32], CCAssignToReg<[F3, F4]>>
41 ]>;