xref: /freebsd/contrib/llvm-project/llvm/lib/Target/BPF/BPFCORE.h (revision 9e5787d2284e187abb5b654d924394a65772e004)
1 //===- BPFCORE.h - Common info for Compile-Once Run-EveryWhere  -*- C++ -*-===//
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 #ifndef LLVM_LIB_TARGET_BPF_BPFCORE_H
10 #define LLVM_LIB_TARGET_BPF_BPFCORE_H
11 
12 #include "llvm/ADT/StringRef.h"
13 
14 namespace llvm {
15 
16 class BPFCoreSharedInfo {
17 public:
18   enum PatchableRelocKind : uint32_t {
19     FIELD_BYTE_OFFSET = 0,
20     FIELD_BYTE_SIZE,
21     FIELD_EXISTENCE,
22     FIELD_SIGNEDNESS,
23     FIELD_LSHIFT_U64,
24     FIELD_RSHIFT_U64,
25     BTF_TYPE_ID_LOCAL,
26     BTF_TYPE_ID_REMOTE,
27 
28     MAX_FIELD_RELOC_KIND,
29   };
30 
31   enum BTFTypeIdFlag : uint32_t {
32     BTF_TYPE_ID_LOCAL_RELOC = 0,
33     BTF_TYPE_ID_REMOTE_RELOC,
34 
35     MAX_BTF_TYPE_ID_FLAG,
36   };
37 
38   /// The attribute attached to globals representing a field access
39   static constexpr StringRef AmaAttr = "btf_ama";
40   /// The attribute attached to globals representing a type id
41   static constexpr StringRef TypeIdAttr = "btf_type_id";
42 };
43 
44 } // namespace llvm
45 
46 #endif
47