diff options
| author | Justin Bogner <mail@justinbogner.com> | 2015-11-04 22:24:08 +0000 |
|---|---|---|
| committer | Justin Bogner <mail@justinbogner.com> | 2015-11-04 22:24:08 +0000 |
| commit | c2b98f03db39fea4783c9a094d8ff83608441328 (patch) | |
| tree | ad913630cb5abc24083c1d574f50bb0f184c1237 /llvm/lib/Analysis/LoopInfo.cpp | |
| parent | 4505bf68b05e491232400e8cbdd13a934e3a88ae (diff) | |
| download | bcm5719-llvm-c2b98f03db39fea4783c9a094d8ff83608441328.tar.gz bcm5719-llvm-c2b98f03db39fea4783c9a094d8ff83608441328.zip | |
PM: Rephrase PrintLoopPass as a wrapper around a new-style pass. NFC
Splits PrintLoopPass into a new-style pass and a PrintLoopPassWrapper,
much like we already do for PrintFunctionPass and PrintModulePass.
llvm-svn: 252085
Diffstat (limited to 'llvm/lib/Analysis/LoopInfo.cpp')
| -rw-r--r-- | llvm/lib/Analysis/LoopInfo.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/LoopInfo.cpp b/llvm/lib/Analysis/LoopInfo.cpp index 3d30c3a06e2..9ee72361c92 100644 --- a/llvm/lib/Analysis/LoopInfo.cpp +++ b/llvm/lib/Analysis/LoopInfo.cpp @@ -691,6 +691,20 @@ PreservedAnalyses LoopPrinterPass::run(Function &F, return PreservedAnalyses::all(); } +PrintLoopPass::PrintLoopPass() : OS(dbgs()) {} +PrintLoopPass::PrintLoopPass(raw_ostream &OS, const std::string &Banner) + : OS(OS), Banner(Banner) {} + +PreservedAnalyses PrintLoopPass::run(Loop &L) { + OS << Banner; + for (auto *Block : L.blocks()) + if (Block) + Block->print(OS); + else + OS << "Printing <null> block"; + return PreservedAnalyses::all(); +} + //===----------------------------------------------------------------------===// // LoopInfo implementation // |

