LoopExtractor.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- LoopExtractor.h - Extract each loop into a new function ------------===//
  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. // A pass wrapper around the ExtractLoop() scalar transformation to extract each
  15. // top-level loop into its own new function. If the loop is the ONLY loop in a
  16. // given function, it is not touched. This is a pass most useful for debugging
  17. // via bugpoint.
  18. //
  19. //===----------------------------------------------------------------------===//
  20. #ifndef LLVM_TRANSFORMS_IPO_LOOPEXTRACTOR_H
  21. #define LLVM_TRANSFORMS_IPO_LOOPEXTRACTOR_H
  22. #include "llvm/IR/PassManager.h"
  23. namespace llvm {
  24. struct LoopExtractorPass : public PassInfoMixin<LoopExtractorPass> {
  25. LoopExtractorPass(unsigned NumLoops = ~0) : NumLoops(NumLoops) {}
  26. PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
  27. void printPipeline(raw_ostream &OS,
  28. function_ref<StringRef(StringRef)> MapClassName2PassName);
  29. private:
  30. unsigned NumLoops;
  31. };
  32. } // namespace llvm
  33. #endif // LLVM_TRANSFORMS_IPO_LOOPEXTRACTOR_H
  34. #ifdef __GNUC__
  35. #pragma GCC diagnostic pop
  36. #endif