]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/lib/Target/BPF/BPFCallingConv.td
Merge clang 7.0.1 and several follow-up changes
[FreeBSD/FreeBSD.git] / contrib / llvm / lib / Target / BPF / BPFCallingConv.td
1 //===-- BPFCallingConv.td - Calling Conventions BPF --------*- tablegen -*-===//
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 //
10 // This describes the calling conventions for the BPF architecture.
11 //
12 //===----------------------------------------------------------------------===//
13
14 // BPF 64-bit C return-value convention.
15 def RetCC_BPF64 : CallingConv<[CCIfType<[i64], CCAssignToReg<[R0]>>]>;
16
17 // BPF 64-bit C Calling convention.
18 def CC_BPF64 : CallingConv<[
19   // Promote i8/i16/i32 args to i64
20   CCIfType<[ i8, i16, i32 ], CCPromoteToType<i64>>,
21
22   // All arguments get passed in integer registers if there is space.
23   CCIfType<[i64], CCAssignToReg<[ R1, R2, R3, R4, R5 ]>>,
24
25   // Could be assigned to the stack in 8-byte aligned units, but unsupported
26   CCAssignToStack<8, 8>
27 ]>;
28
29 // Return-value convention when -mattr=+alu32 enabled
30 def RetCC_BPF32 : CallingConv<[
31   CCIfType<[i32], CCAssignToRegWithShadow<[W0], [R0]>>,
32   CCIfType<[i64], CCAssignToRegWithShadow<[R0], [W0]>>
33 ]>;
34
35 // Calling convention when -mattr=+alu32 enabled
36 def CC_BPF32 : CallingConv<[
37   // Promote i8/i16/i32 args to i64
38   CCIfType<[i32], CCAssignToRegWithShadow<[W1, W2, W3, W4, W5],
39                                           [R1, R2, R3, R4, R5]>>,
40
41   // All arguments get passed in integer registers if there is space.
42   CCIfType<[i64], CCAssignToRegWithShadow<[R1, R2, R3, R4, R5],
43                                           [W1, W2, W3, W4, W5]>>,
44
45   // Could be assigned to the stack in 8-byte aligned units, but unsupported
46   CCAssignToStack<8, 8>
47 ]>;
48
49 def CSR : CalleeSavedRegs<(add R6, R7, R8, R9, R10)>;