SimplifyCFG.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. //===- SimplifyCFG.h - Simplify and canonicalize the CFG --------*- C++ -*-===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is distributed under the University of Illinois Open Source
  6. // License. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. /// \file
  10. /// This file provides the interface for the pass responsible for both
  11. /// simplifying and canonicalizing the CFG.
  12. ///
  13. //===----------------------------------------------------------------------===//
  14. #ifndef LLVM_TRANSFORMS_SCALAR_SIMPLIFYCFG_H
  15. #define LLVM_TRANSFORMS_SCALAR_SIMPLIFYCFG_H
  16. #include "llvm/IR/Function.h"
  17. #include "llvm/IR/PassManager.h"
  18. namespace llvm {
  19. /// \brief A pass to simplify and canonicalize the CFG of a function.
  20. ///
  21. /// This pass iteratively simplifies the entire CFG of a function, removing
  22. /// unnecessary control flows and bringing it into the canonical form expected
  23. /// by the rest of the mid-level optimizer.
  24. class SimplifyCFGPass {
  25. int BonusInstThreshold;
  26. public:
  27. static StringRef name() { return "SimplifyCFGPass"; }
  28. /// \brief Construct a pass with the default thresholds.
  29. SimplifyCFGPass();
  30. /// \brief Construct a pass with a specific bonus threshold.
  31. SimplifyCFGPass(int BonusInstThreshold);
  32. /// \brief Run the pass over the function.
  33. PreservedAnalyses run(Function &F, AnalysisManager<Function> *AM);
  34. };
  35. }
  36. #endif