IntrinsicsBPF.td 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. //===- IntrinsicsBPF.td - Defines BPF intrinsics -----------*- 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 file defines all of the BPF-specific intrinsics.
  10. //
  11. //===----------------------------------------------------------------------===//
  12. // Specialized loads from packet
  13. let TargetPrefix = "bpf" in { // All intrinsics start with "llvm.bpf."
  14. def int_bpf_load_byte : ClangBuiltin<"__builtin_bpf_load_byte">,
  15. Intrinsic<[llvm_i64_ty], [llvm_ptr_ty, llvm_i64_ty], [IntrReadMem]>;
  16. def int_bpf_load_half : ClangBuiltin<"__builtin_bpf_load_half">,
  17. Intrinsic<[llvm_i64_ty], [llvm_ptr_ty, llvm_i64_ty], [IntrReadMem]>;
  18. def int_bpf_load_word : ClangBuiltin<"__builtin_bpf_load_word">,
  19. Intrinsic<[llvm_i64_ty], [llvm_ptr_ty, llvm_i64_ty], [IntrReadMem]>;
  20. def int_bpf_pseudo : ClangBuiltin<"__builtin_bpf_pseudo">,
  21. Intrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty]>;
  22. def int_bpf_preserve_field_info : ClangBuiltin<"__builtin_bpf_preserve_field_info">,
  23. Intrinsic<[llvm_i32_ty], [llvm_anyptr_ty, llvm_i64_ty],
  24. [IntrNoMem, ImmArg<ArgIndex<1>>]>;
  25. def int_bpf_btf_type_id : ClangBuiltin<"__builtin_bpf_btf_type_id">,
  26. Intrinsic<[llvm_i64_ty], [llvm_i32_ty, llvm_i64_ty],
  27. [IntrNoMem]>;
  28. def int_bpf_preserve_type_info : ClangBuiltin<"__builtin_bpf_preserve_type_info">,
  29. Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i64_ty],
  30. [IntrNoMem]>;
  31. def int_bpf_preserve_enum_value : ClangBuiltin<"__builtin_bpf_preserve_enum_value">,
  32. Intrinsic<[llvm_i64_ty], [llvm_i32_ty, llvm_ptr_ty, llvm_i64_ty],
  33. [IntrNoMem]>;
  34. def int_bpf_passthrough : ClangBuiltin<"__builtin_bpf_passthrough">,
  35. Intrinsic<[llvm_any_ty], [llvm_i32_ty, llvm_any_ty], [IntrNoMem]>;
  36. def int_bpf_compare : ClangBuiltin<"__builtin_bpf_compare">,
  37. Intrinsic<[llvm_i1_ty], [llvm_i32_ty, llvm_anyint_ty, llvm_anyint_ty],
  38. [IntrNoMem]>;
  39. }