Path: blob/main/contrib/llvm-project/llvm/lib/Transforms/Scalar/LoopAccessAnalysisPrinter.cpp
35266 views
//===- LoopAccessAnalysisPrinter.cpp - Loop Access Analysis Printer --------==//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#include "llvm/Transforms/Scalar/LoopAccessAnalysisPrinter.h"9#include "llvm/ADT/PriorityWorklist.h"10#include "llvm/Analysis/LoopAccessAnalysis.h"11#include "llvm/Analysis/LoopInfo.h"12#include "llvm/Transforms/Utils/LoopUtils.h"1314using namespace llvm;1516#define DEBUG_TYPE "loop-accesses"1718PreservedAnalyses LoopAccessInfoPrinterPass::run(Function &F,19FunctionAnalysisManager &AM) {20auto &LAIs = AM.getResult<LoopAccessAnalysis>(F);21auto &LI = AM.getResult<LoopAnalysis>(F);22OS << "Printing analysis 'Loop Access Analysis' for function '" << F.getName()23<< "':\n";2425SmallPriorityWorklist<Loop *, 4> Worklist;26appendLoopsToWorklist(LI, Worklist);27while (!Worklist.empty()) {28Loop *L = Worklist.pop_back_val();29OS.indent(2) << L->getHeader()->getName() << ":\n";30LAIs.getInfo(*L).print(OS, 4);31}32return PreservedAnalyses::all();33}343536