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 void printPipeline(raw_ostream &OS, 27 function_ref<StringRef(StringRef)> MapClassName2PassName); 28 29 private: 30 unsigned NumLoops; 31 }; 32 } // namespace llvm 33 34 #endif // LLVM_TRANSFORMS_IPO_LOOPEXTRACTOR_H 35