1 //===-- BPF.h - Top-level interface for BPF representation ------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_LIB_TARGET_BPF_BPF_H
10 #define LLVM_LIB_TARGET_BPF_BPF_H
12 #include "MCTargetDesc/BPFMCTargetDesc.h"
13 #include "llvm/IR/PassManager.h"
14 #include "llvm/Target/TargetMachine.h"
17 class BPFTargetMachine
;
19 ModulePass
*createBPFAdjustOpt();
20 ModulePass
*createBPFCheckAndAdjustIR();
22 FunctionPass
*createBPFAbstractMemberAccess(BPFTargetMachine
*TM
);
23 FunctionPass
*createBPFPreserveDIType();
24 FunctionPass
*createBPFISelDag(BPFTargetMachine
&TM
);
25 FunctionPass
*createBPFMISimplifyPatchablePass();
26 FunctionPass
*createBPFMIPeepholePass();
27 FunctionPass
*createBPFMIPeepholeTruncElimPass();
28 FunctionPass
*createBPFMIPreEmitPeepholePass();
29 FunctionPass
*createBPFMIPreEmitCheckingPass();
31 void initializeBPFAdjustOptPass(PassRegistry
&);
32 void initializeBPFCheckAndAdjustIRPass(PassRegistry
&);
34 void initializeBPFAbstractMemberAccessLegacyPassPass(PassRegistry
&);
35 void initializeBPFPreserveDITypePass(PassRegistry
&);
36 void initializeBPFMISimplifyPatchablePass(PassRegistry
&);
37 void initializeBPFMIPeepholePass(PassRegistry
&);
38 void initializeBPFMIPeepholeTruncElimPass(PassRegistry
&);
39 void initializeBPFMIPreEmitPeepholePass(PassRegistry
&);
40 void initializeBPFMIPreEmitCheckingPass(PassRegistry
&);
42 class BPFAbstractMemberAccessPass
43 : public PassInfoMixin
<BPFAbstractMemberAccessPass
> {
47 BPFAbstractMemberAccessPass(BPFTargetMachine
*TM
) : TM(TM
) {}
48 PreservedAnalyses
run(Function
&F
, FunctionAnalysisManager
&AM
);
50 static bool isRequired() { return true; }
53 class BPFPreserveDITypePass
: public PassInfoMixin
<BPFPreserveDITypePass
> {
55 PreservedAnalyses
run(Function
&F
, FunctionAnalysisManager
&AM
);
57 static bool isRequired() { return true; }
60 class BPFAdjustOptPass
: public PassInfoMixin
<BPFAdjustOptPass
> {
62 PreservedAnalyses
run(Module
&M
, ModuleAnalysisManager
&AM
);