BPFCallingConv.td 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. //===-- BPFCallingConv.td - Calling Conventions BPF --------*- tablegen -*-===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. //
  9. // This describes the calling conventions for the BPF architecture.
  10. //
  11. //===----------------------------------------------------------------------===//
  12. // BPF 64-bit C return-value convention.
  13. def RetCC_BPF64 : CallingConv<[CCIfType<[i64], CCAssignToReg<[R0]>>]>;
  14. // BPF 64-bit C Calling convention.
  15. def CC_BPF64 : CallingConv<[
  16. // Promote i8/i16/i32 args to i64
  17. CCIfType<[ i8, i16, i32 ], CCPromoteToType<i64>>,
  18. // All arguments get passed in integer registers if there is space.
  19. CCIfType<[i64], CCAssignToReg<[ R1, R2, R3, R4, R5 ]>>,
  20. // Could be assigned to the stack in 8-byte aligned units, but unsupported
  21. CCAssignToStack<8, 8>
  22. ]>;
  23. // Return-value convention when -mattr=+alu32 enabled
  24. def RetCC_BPF32 : CallingConv<[
  25. CCIfType<[i32], CCAssignToRegWithShadow<[W0], [R0]>>,
  26. CCIfType<[i64], CCAssignToRegWithShadow<[R0], [W0]>>
  27. ]>;
  28. // Calling convention when -mattr=+alu32 enabled
  29. def CC_BPF32 : CallingConv<[
  30. // Promote i8/i16/i32 args to i64
  31. CCIfType<[i32], CCAssignToRegWithShadow<[W1, W2, W3, W4, W5],
  32. [R1, R2, R3, R4, R5]>>,
  33. // All arguments get passed in integer registers if there is space.
  34. CCIfType<[i64], CCAssignToRegWithShadow<[R1, R2, R3, R4, R5],
  35. [W1, W2, W3, W4, W5]>>,
  36. // Could be assigned to the stack in 8-byte aligned units, but unsupported
  37. CCAssignToStack<8, 8>
  38. ]>;
  39. def CSR : CalleeSavedRegs<(add R6, R7, R8, R9, R10)>;