BPF.h 2.5 KB

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