1 //===-- BPFCallingConv.td - Calling Conventions BPF --------*- tablegen -*-===//
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 BPF architecture.
12 //===----------------------------------------------------------------------===//
14 // BPF 64-bit C return-value convention.
15 def RetCC_BPF64 : CallingConv<[CCIfType<[i64], CCAssignToReg<[R0]>>]>;
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>>,
22 // All arguments get passed in integer registers if there is space.
23 CCIfType<[i64], CCAssignToReg<[ R1, R2, R3, R4, R5 ]>>,
25 // Could be assigned to the stack in 8-byte aligned units, but unsupported
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]>>
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]>>,
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]>>,
45 // Could be assigned to the stack in 8-byte aligned units, but unsupported
49 def CSR : CalleeSavedRegs<(add R6, R7, R8, R9, R10)>;