LoopAccessAnalysisPrinter.cpp 977 B

123456789101112131415161718192021222324
  1. //===- LoopAccessAnalysisPrinter.cpp - Loop Access Analysis Printer --------==//
  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. #include "llvm/Transforms/Scalar/LoopAccessAnalysisPrinter.h"
  9. #include "llvm/Analysis/LoopAccessAnalysis.h"
  10. using namespace llvm;
  11. #define DEBUG_TYPE "loop-accesses"
  12. PreservedAnalyses
  13. LoopAccessInfoPrinterPass::run(Loop &L, LoopAnalysisManager &AM,
  14. LoopStandardAnalysisResults &AR, LPMUpdater &) {
  15. Function &F = *L.getHeader()->getParent();
  16. auto &LAI = AM.getResult<LoopAccessAnalysis>(L, AR);
  17. OS << "Loop access info in function '" << F.getName() << "':\n";
  18. OS.indent(2) << L.getHeader()->getName() << ":\n";
  19. LAI.print(OS, 4);
  20. return PreservedAnalyses::all();
  21. }