LLVM 22.0.0git
CFGSCCPrinter.cpp
Go to the documentation of this file.
1//===- CFGSCCPrinter.cpp --------------------------------------------------===//
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
12#include "llvm/IR/CFG.h"
13
14using namespace llvm;
15
18 unsigned SccNum = 0;
19 OS << "SCCs for Function " << F.getName() << " in PostOrder:";
20 for (scc_iterator<Function *> SCCI = scc_begin(&F); !SCCI.isAtEnd(); ++SCCI) {
21 const std::vector<BasicBlock *> &NextSCC = *SCCI;
22 OS << "\nSCC #" << ++SccNum << ": ";
24 for (BasicBlock *BB : NextSCC) {
25 OS << LS;
26 BB->printAsOperand(OS, false);
27 }
28 if (NextSCC.size() == 1 && SCCI.hasCycle())
29 OS << " (Has self-loop).";
30 }
31 OS << "\n";
32
34}
This file provides various utilities for inspecting and working with the control flow graph in LLVM I...
#define F(x, y, z)
Definition MD5.cpp:54
This builds on the llvm/ADT/GraphTraits.h file to find the strongly connected components (SCCs) of a ...
This file contains some functions that are useful when dealing with strings.
LLVM Basic Block Representation.
Definition BasicBlock.h:62
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
A helper class to return the specified delimiter string after the first invocation of operator String...
A set of analyses that are preserved following a run of a transformation pass.
Definition Analysis.h:112
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
Definition Analysis.h:118
Enumerate the SCCs of a directed graph in reverse topological order of the SCC DAG.
Definition SCCIterator.h:49
bool isAtEnd() const
Direct loop termination test which is more efficient than comparison with end().
This is an optimization pass for GlobalISel generic memory operations.
Definition Types.h:26
scc_iterator< T > scc_begin(const T &G)
Construct the begin iterator for a deduced graph type T.
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.