LLVM 23.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"
17
18namespace llvm {
19
20class BasicBlock;
21class Instruction;
22class Module;
23
24/// Return the bit offset used to order an element of a BTF structure record.
26 switch (Element->getTag()) {
27 case dwarf::DW_TAG_member:
28 return cast<DIDerivedType>(Element)->getOffsetInBits();
29 case dwarf::DW_TAG_variant_part:
30 return cast<DICompositeType>(Element)->getOffsetInBits();
31 default:
32 llvm_unreachable("Unexpected DI tag of a struct element");
33 }
34}
35
37public:
44
52
59
60 /// The attribute attached to globals representing a field access
61 static constexpr StringRef AmaAttr = "btf_ama";
62 /// The attribute attached to globals representing a type id
63 static constexpr StringRef TypeIdAttr = "btf_type_id";
64
65 /// llvm.bpf.passthrough builtin seq number
67
68 /// Insert a bpf passthrough builtin function.
71 Instruction *Before);
75};
76
77} // namespace llvm
78
79#endif
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:66
static void removeStructAccessCall(CallInst *Call)
static constexpr StringRef TypeIdAttr
The attribute attached to globals representing a type id.
Definition BPFCORE.h:63
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:61
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:67
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.
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:25
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:559