1 //===- PPCCallingConv.td - Calling Conventions for PowerPC ------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This describes the calling conventions for the PowerPC 32- and 64-bit
13 //===----------------------------------------------------------------------===//
15 /// CCIfSubtarget - Match if the current subtarget has a feature F.
16 class CCIfSubtarget<string F, CCAction A>
17 : CCIf<!strconcat("State.getTarget().getSubtarget<PPCSubtarget>().", F), A>;
19 //===----------------------------------------------------------------------===//
20 // Return Value Calling Convention
21 //===----------------------------------------------------------------------===//
23 // Return-value convention for PowerPC
24 def RetCC_PPC : CallingConv<[
25 CCIfType<[i32], CCAssignToReg<[R3, R4, R5, R6, R7, R8, R9, R10]>>,
26 CCIfType<[i64], CCAssignToReg<[X3, X4, X5, X6]>>,
28 CCIfType<[f32], CCAssignToReg<[F1]>>,
29 CCIfType<[f64], CCAssignToReg<[F1, F2]>>,
31 // Vector types are always returned in V2.
32 CCIfType<[v16i8, v8i16, v4i32, v4f32], CCAssignToReg<[V2]>>
36 //===----------------------------------------------------------------------===//
37 // PowerPC Argument Calling Conventions
38 //===----------------------------------------------------------------------===//
40 def CC_PPC : CallingConv<[
41 // The first 8 integer arguments are passed in integer registers.
42 CCIfType<[i32], CCAssignToReg<[R3, R4, R5, R6, R7, R8, R9, R10]>>,
43 CCIfType<[i64], CCAssignToReg<[X3, X4, X5, X6, X7, X8, X9, X10]>>,
45 // Common sub-targets passes FP values in F1 - F13
46 CCIfType<[f32, f64], CCIfSubtarget<"isMachoABI()",
47 CCAssignToReg<[F1, F2, F3, F4, F5, F6, F7, F8,F9,F10,F11,F12,F13]>>>,
48 // ELF32 sub-target pass FP values in F1 - F8.
49 CCIfType<[f32, f64], CCAssignToReg<[F1, F2, F3, F4, F5, F6, F7, F8]>>,
51 // The first 12 Vector arguments are passed in altivec registers.
52 CCIfType<[v16i8, v8i16, v4i32, v4f32],
53 CCAssignToReg<[V2, V3, V4, V5, V6, V7, V8, V9, V10,V11,V12,V13]>>
56 // Integer/FP values get stored in stack slots that are 8 bytes in size and
57 // 8-byte aligned if there are no more registers to hold them.
58 CCIfType<[i32, i64, f32, f64], CCAssignToStack<8, 8>>,
60 // Vectors get 16-byte stack slots that are 16-byte aligned.
61 CCIfType<[v16i8, v8i16, v4i32, v2i64, v4f32, v2f64],
62 CCAssignToStack<16, 16>>*/