1 //===- LoopAccessAnalysisPrinter.cpp - Loop Access Analysis Printer --------==//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #include "llvm/Transforms/Scalar/LoopAccessAnalysisPrinter.h"
11 #include "llvm/Analysis/LoopAccessAnalysis.h"
12 using namespace llvm;
13 
14 #define DEBUG_TYPE "loop-accesses"
15 
16 PreservedAnalyses
run(Loop & L,LoopAnalysisManager & AM,LoopStandardAnalysisResults & AR,LPMUpdater &)17 LoopAccessInfoPrinterPass::run(Loop &L, LoopAnalysisManager &AM,
18                                LoopStandardAnalysisResults &AR, LPMUpdater &) {
19   Function &F = *L.getHeader()->getParent();
20   auto &LAI = AM.getResult<LoopAccessAnalysis>(L, AR);
21   OS << "Loop access info in function '" << F.getName() << "':\n";
22   OS.indent(2) << L.getHeader()->getName() << ":\n";
23   LAI.print(OS, 4);
24   return PreservedAnalyses::all();
25 }
26