LLVM 24.0.0git
BPFCORE.h
Go to the documentation of this file.
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"
18
19namespace llvm {
20
21class BasicBlock;
22class Instruction;
23class Module;
24
25/// Return the bit offset used to order an element of a BTF structure record.
27 switch (Element->getTag()) {
28 case dwarf::DW_TAG_member:
29 return cast<DIDerivedType>(Element)->getOffsetInBits();
30 case dwarf::DW_TAG_variant_part:
31 return cast<DICompositeType>(Element)->getOffsetInBits();
32 default:
33 llvm_unreachable("Unexpected DI tag of a struct element");
34 }
35}
36
38public:
45
53
60
61 /// The attribute attached to globals representing a field access
62 static constexpr StringRef AmaAttr = "btf_ama";
63 /// The attribute attached to globals representing a type id
64 static constexpr StringRef TypeIdAttr = "btf_type_id";
65
73
74 /// llvm.bpf.passthrough builtin seq number
76
77 /// Insert a bpf passthrough builtin function.
80 Instruction *Before);
84};
85
86} // namespace llvm
87
88#endif
uint64_t uint64_t
This file contains the layout of .BTF and .BTF.ext ELF sections.
This file contains constants used for implementing Dwarf debug support.
The Input class is used to parse a yaml document into in-memory structs and vectors.
static void removeArrayAccessCall(CallInst *Call)
static uint32_t SeqNum
llvm.bpf.passthrough builtin seq number
Definition BPFCORE.h:75
static void removeStructAccessCall(CallInst *Call)
static constexpr StringRef TypeIdAttr
The attribute attached to globals representing a type id.
Definition BPFCORE.h:64
static void removeUnionAccessCall(CallInst *Call)
static Instruction * insertPassThrough(Module *M, BasicBlock *BB, Instruction *Input, Instruction *Before)
Insert a bpf passthrough builtin function.
static constexpr StringRef AmaAttr
The attribute attached to globals representing a field access.
Definition BPFCORE.h:62
LLVM Basic Block Representation.
Definition BasicBlock.h:62
This class represents a function call, abstracting a target machine's calling convention.
Tagged DWARF-like metadata node.
LLVM_ABI dwarf::Tag getTag() const
A Module instance is used to store all the information related to an LLVM module.
Definition Module.h:68
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
CallInst * Call
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
PatchableRelocKind
CO-RE relocation kind codes used in .BTF.ext section.
Definition BTF.h:280
This is an optimization pass for GlobalISel generic memory operations.
uint64_t getBTFRecordElementOffset(const DINode *Element)
Return the bit offset used to order an element of a BTF structure record.
Definition BPFCORE.h:26
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:559
BTF::PatchableRelocKind Kind
Definition BPFCORE.h:67
static AmaRelocation decode(StringRef Name)