InstSimplifyPass.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- InstSimplifyPass.h ---------------------------------------*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. /// \file
  14. ///
  15. /// Defines passes for running instruction simplification across chunks of IR.
  16. ///
  17. //===----------------------------------------------------------------------===//
  18. #ifndef LLVM_TRANSFORMS_UTILS_INSTSIMPLIFYPASS_H
  19. #define LLVM_TRANSFORMS_UTILS_INSTSIMPLIFYPASS_H
  20. #include "llvm/IR/PassManager.h"
  21. namespace llvm {
  22. class FunctionPass;
  23. /// Run instruction simplification across each instruction in the function.
  24. ///
  25. /// Instruction simplification has useful constraints in some contexts:
  26. /// - It will never introduce *new* instructions.
  27. /// - There is no need to iterate to a fixed point.
  28. ///
  29. /// Many passes use instruction simplification as a library facility, but it may
  30. /// also be useful (in tests and other contexts) to have access to this very
  31. /// restricted transform at a pass granularity. However, for a much more
  32. /// powerful and comprehensive peephole optimization engine, see the
  33. /// `instcombine` pass instead.
  34. class InstSimplifyPass : public PassInfoMixin<InstSimplifyPass> {
  35. public:
  36. PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
  37. };
  38. } // end namespace llvm
  39. #endif // LLVM_TRANSFORMS_UTILS_INSTSIMPLIFYPASS_H
  40. #ifdef __GNUC__
  41. #pragma GCC diagnostic pop
  42. #endif