aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/SystemZ/SystemZCallingConv.td
blob: c799a9e501aa285f08f397bc0f60ed5d81151e9e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//=- SystemZCallingConv.td - Calling Conventions for SystemZ -*- tablegen -*-=//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// This describes the calling conventions for SystemZ architecture.
//===----------------------------------------------------------------------===//

//===----------------------------------------------------------------------===//
// SystemZ Return Value Calling Convention
//===----------------------------------------------------------------------===//
def RetCC_SystemZ : CallingConv<[
  // Promote i8/i16/i32 arguments to i64.
  CCIfType<[i8, i16, i32], CCPromoteToType<i64>>,

  // i64 is returned in register R2
  CCIfType<[i64], CCAssignToReg<[R2D, R3D, R4D, R5D]>>,

  // f32 / f64 are returned in F0
  CCIfType<[f32], CCAssignToReg<[F0S, F2S, F4S, F6S]>>,
  CCIfType<[f64], CCAssignToReg<[F0L, F2L, F4L, F6L]>>
]>;

//===----------------------------------------------------------------------===//
// SystemZ Argument Calling Conventions
//===----------------------------------------------------------------------===//
def CC_SystemZ : CallingConv<[
  // Promote i8/i16/i32 arguments to i64.
  CCIfType<[i8, i16, i32], CCPromoteToType<i64>>,

  // The first 5 integer arguments of non-varargs functions are passed in
  // integer registers.
  CCIfType<[i64], CCAssignToReg<[R2D, R3D, R4D, R5D, R6D]>>,

  // The first 4 floating point arguments of non-varargs functions are passed
  // in FP registers.
  CCIfType<[f32], CCAssignToReg<[F0S, F2S, F4S, F6S]>>,
  CCIfType<[f64], CCAssignToReg<[F0L, F2L, F4L, F6L]>>,

  // Integer values get stored in stack slots that are 8 bytes in
  // size and 8-byte aligned.
  CCIfType<[i64, f32, f64], CCAssignToStack<8, 8>>
]>;