[llvm-shlib] Fix the version naming style of libLLVM for Windows (#85710)
[llvm-project.git] / llvm / lib / Target / BPF / BPFCORE.h
blobf46a8ef62a7faa1ee01c0d6b10ed9d8b9fc64c8d
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 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_LIB_TARGET_BPF_BPFCORE_H
10 #define LLVM_LIB_TARGET_BPF_BPFCORE_H
12 #include "llvm/ADT/StringRef.h"
13 #include "llvm/IR/Instructions.h"
15 namespace llvm {
17 class BasicBlock;
18 class Instruction;
19 class Module;
21 class BPFCoreSharedInfo {
22 public:
23 enum BTFTypeIdFlag : uint32_t {
24 BTF_TYPE_ID_LOCAL_RELOC = 0,
25 BTF_TYPE_ID_REMOTE_RELOC,
27 MAX_BTF_TYPE_ID_FLAG,
30 enum PreserveTypeInfo : uint32_t {
31 PRESERVE_TYPE_INFO_EXISTENCE = 0,
32 PRESERVE_TYPE_INFO_SIZE,
33 PRESERVE_TYPE_INFO_MATCH,
35 MAX_PRESERVE_TYPE_INFO_FLAG,
38 enum PreserveEnumValue : uint32_t {
39 PRESERVE_ENUM_VALUE_EXISTENCE = 0,
40 PRESERVE_ENUM_VALUE,
42 MAX_PRESERVE_ENUM_VALUE_FLAG,
45 /// The attribute attached to globals representing a field access
46 static constexpr StringRef AmaAttr = "btf_ama";
47 /// The attribute attached to globals representing a type id
48 static constexpr StringRef TypeIdAttr = "btf_type_id";
50 /// llvm.bpf.passthrough builtin seq number
51 static uint32_t SeqNum;
53 /// Insert a bpf passthrough builtin function.
54 static Instruction *insertPassThrough(Module *M, BasicBlock *BB,
55 Instruction *Input,
56 Instruction *Before);
57 static void removeArrayAccessCall(CallInst *Call);
58 static void removeStructAccessCall(CallInst *Call);
59 static void removeUnionAccessCall(CallInst *Call);
62 } // namespace llvm
64 #endif