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