xref: /aosp_15_r20/external/llvm/lib/Target/BPF/BPFCallingConv.td (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker//===-- BPFCallingConv.td - Calling Conventions BPF --------*- tablegen -*-===//
2*9880d681SAndroid Build Coastguard Worker//
3*9880d681SAndroid Build Coastguard Worker//                     The LLVM Compiler Infrastructure
4*9880d681SAndroid Build Coastguard Worker//
5*9880d681SAndroid Build Coastguard Worker// This file is distributed under the University of Illinois Open Source
6*9880d681SAndroid Build Coastguard Worker// License. See LICENSE.TXT for details.
7*9880d681SAndroid Build Coastguard Worker//
8*9880d681SAndroid Build Coastguard Worker//===----------------------------------------------------------------------===//
9*9880d681SAndroid Build Coastguard Worker//
10*9880d681SAndroid Build Coastguard Worker// This describes the calling conventions for the BPF architecture.
11*9880d681SAndroid Build Coastguard Worker//
12*9880d681SAndroid Build Coastguard Worker//===----------------------------------------------------------------------===//
13*9880d681SAndroid Build Coastguard Worker
14*9880d681SAndroid Build Coastguard Worker// BPF 64-bit C return-value convention.
15*9880d681SAndroid Build Coastguard Workerdef RetCC_BPF64 : CallingConv<[CCIfType<[i64], CCAssignToReg<[R0]>>]>;
16*9880d681SAndroid Build Coastguard Worker
17*9880d681SAndroid Build Coastguard Worker// BPF 64-bit C Calling convention.
18*9880d681SAndroid Build Coastguard Workerdef CC_BPF64 : CallingConv<[
19*9880d681SAndroid Build Coastguard Worker  // Promote i8/i16/i32 args to i64
20*9880d681SAndroid Build Coastguard Worker  CCIfType<[ i8, i16, i32 ], CCPromoteToType<i64>>,
21*9880d681SAndroid Build Coastguard Worker
22*9880d681SAndroid Build Coastguard Worker  // All arguments get passed in integer registers if there is space.
23*9880d681SAndroid Build Coastguard Worker  CCIfType<[i64], CCAssignToReg<[ R1, R2, R3, R4, R5 ]>>,
24*9880d681SAndroid Build Coastguard Worker
25*9880d681SAndroid Build Coastguard Worker  // Could be assigned to the stack in 8-byte aligned units, but unsupported
26*9880d681SAndroid Build Coastguard Worker  CCAssignToStack<8, 8>
27*9880d681SAndroid Build Coastguard Worker]>;
28*9880d681SAndroid Build Coastguard Worker
29*9880d681SAndroid Build Coastguard Workerdef CSR : CalleeSavedRegs<(add R6, R7, R8, R9, R10)>;
30