EarlyCSE.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- EarlyCSE.h - Simple and fast CSE pass --------------------*- 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. //
  14. /// \file
  15. /// This file provides the interface for a simple, fast CSE pass.
  16. //
  17. //===----------------------------------------------------------------------===//
  18. #ifndef LLVM_TRANSFORMS_SCALAR_EARLYCSE_H
  19. #define LLVM_TRANSFORMS_SCALAR_EARLYCSE_H
  20. #include "llvm/IR/PassManager.h"
  21. namespace llvm {
  22. class Function;
  23. /// A simple and fast domtree-based CSE pass.
  24. ///
  25. /// This pass does a simple depth-first walk over the dominator tree,
  26. /// eliminating trivially redundant instructions and using instsimplify to
  27. /// canonicalize things as it goes. It is intended to be fast and catch obvious
  28. /// cases so that instcombine and other passes are more effective. It is
  29. /// expected that a later pass of GVN will catch the interesting/hard cases.
  30. struct EarlyCSEPass : PassInfoMixin<EarlyCSEPass> {
  31. EarlyCSEPass(bool UseMemorySSA = false) : UseMemorySSA(UseMemorySSA) {}
  32. /// Run the pass over the function.
  33. PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
  34. void printPipeline(raw_ostream &OS,
  35. function_ref<StringRef(StringRef)> MapClassName2PassName);
  36. bool UseMemorySSA;
  37. };
  38. } // end namespace llvm
  39. #endif // LLVM_TRANSFORMS_SCALAR_EARLYCSE_H
  40. #ifdef __GNUC__
  41. #pragma GCC diagnostic pop
  42. #endif