BPF.h 2.6 KB

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