1 //===- LoopExtractor.h - Extract each loop into a new function ------------===// 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 // 9 // A pass wrapper around the ExtractLoop() scalar transformation to extract each 10 // top-level loop into its own new function. If the loop is the ONLY loop in a 11 // given function, it is not touched. This is a pass most useful for debugging 12 // via bugpoint. 13 // 14 //===----------------------------------------------------------------------===// 15 16 #ifndef LLVM_TRANSFORMS_IPO_LOOPEXTRACTOR_H 17 #define LLVM_TRANSFORMS_IPO_LOOPEXTRACTOR_H 18 19 #include "llvm/IR/PassManager.h" 20 21 namespace llvm { 22 23 struct LoopExtractorPass : public PassInfoMixin<LoopExtractorPass> { NumLoopsLoopExtractorPass24 LoopExtractorPass(unsigned NumLoops = ~0) : NumLoops(NumLoops) {} 25 PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM); 26 27 private: 28 unsigned NumLoops; 29 }; 30 } // namespace llvm 31 32 #endif // LLVM_TRANSFORMS_IPO_LOOPEXTRACTOR_H 33