1 //===-- BPF.h - Top-level interface for BPF representation ------*- 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_BPF_H 10 #define LLVM_LIB_TARGET_BPF_BPF_H 11 12 #include "MCTargetDesc/BPFMCTargetDesc.h" 13 #include "llvm/IR/PassManager.h" 14 #include "llvm/Pass.h" 15 #include "llvm/Target/TargetMachine.h" 16 17 namespace llvm { 18 class BPFTargetMachine; 19 class PassRegistry; 20 21 ModulePass *createBPFAdjustOpt(); 22 ModulePass *createBPFCheckAndAdjustIR(); 23 24 FunctionPass *createBPFAbstractMemberAccess(BPFTargetMachine *TM); 25 FunctionPass *createBPFPreserveDIType(); 26 FunctionPass *createBPFIRPeephole(); 27 FunctionPass *createBPFISelDag(BPFTargetMachine &TM); 28 FunctionPass *createBPFMISimplifyPatchablePass(); 29 FunctionPass *createBPFMIPeepholePass(); 30 FunctionPass *createBPFMIPeepholeTruncElimPass(); 31 FunctionPass *createBPFMIPreEmitPeepholePass(); 32 FunctionPass *createBPFMIPreEmitCheckingPass(); 33 34 void initializeBPFAbstractMemberAccessLegacyPassPass(PassRegistry &); 35 void initializeBPFAdjustOptPass(PassRegistry&); 36 void initializeBPFCheckAndAdjustIRPass(PassRegistry&); 37 void initializeBPFDAGToDAGISelPass(PassRegistry &); 38 void initializeBPFIRPeepholePass(PassRegistry &); 39 void initializeBPFMIPeepholePass(PassRegistry&); 40 void initializeBPFMIPeepholeTruncElimPass(PassRegistry &); 41 void initializeBPFMIPreEmitCheckingPass(PassRegistry&); 42 void initializeBPFMIPreEmitPeepholePass(PassRegistry &); 43 void initializeBPFMISimplifyPatchablePass(PassRegistry &); 44 void initializeBPFPreserveDITypePass(PassRegistry &); 45 46 class BPFAbstractMemberAccessPass 47 : public PassInfoMixin<BPFAbstractMemberAccessPass> { 48 BPFTargetMachine *TM; 49 50 public: 51 BPFAbstractMemberAccessPass(BPFTargetMachine *TM) : TM(TM) {} 52 PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM); 53 54 static bool isRequired() { return true; } 55 }; 56 57 class BPFPreserveDITypePass : public PassInfoMixin<BPFPreserveDITypePass> { 58 public: 59 PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM); 60 61 static bool isRequired() { return true; } 62 }; 63 64 class BPFIRPeepholePass : public PassInfoMixin<BPFIRPeepholePass> { 65 public: 66 PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM); 67 68 static bool isRequired() { return true; } 69 }; 70 71 class BPFAdjustOptPass : public PassInfoMixin<BPFAdjustOptPass> { 72 public: 73 PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM); 74 }; 75 } // namespace llvm 76 77 #endif 78