LLVM  17.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 
10 #include "llvm/ADT/SCCIterator.h"
11 #include "llvm/IR/CFG.h"
12 
13 using namespace llvm;
14 
17  unsigned SccNum = 0;
18  OS << "SCCs for Function " << F.getName() << " in PostOrder:";
19  for (scc_iterator<Function *> SCCI = scc_begin(&F); !SCCI.isAtEnd(); ++SCCI) {
20  const std::vector<BasicBlock *> &NextSCC = *SCCI;
21  OS << "\nSCC #" << ++SccNum << ": ";
22  bool First = true;
23  for (BasicBlock *BB : NextSCC) {
24  if (First)
25  First = false;
26  else
27  OS << ", ";
28  BB->printAsOperand(OS, false);
29  }
30  if (NextSCC.size() == 1 && SCCI.hasCycle())
31  OS << " (Has self-loop).";
32  }
33  OS << "\n";
34 
35  return PreservedAnalyses::all();
36 }
llvm::PreservedAnalyses
A set of analyses that are preserved following a run of a transformation pass.
Definition: PassManager.h:152
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::CFGSCCPrinterPass::run
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
Definition: CFGSCCPrinter.cpp:15
SCCIterator.h
llvm::Function
Definition: Function.h:59
F
#define F(x, y, z)
Definition: MD5.cpp:55
llvm::BasicBlock
LLVM Basic Block Representation.
Definition: BasicBlock.h:55
First
into llvm powi allowing the code generator to produce balanced multiplication trees First
Definition: README.txt:54
CFG.h
llvm::scc_begin
scc_iterator< T > scc_begin(const T &G)
Construct the begin iterator for a deduced graph type T.
Definition: SCCIterator.h:232
CFGSCCPrinter.h
llvm::scc_iterator
Enumerate the SCCs of a directed graph in reverse topological order of the SCC DAG.
Definition: SCCIterator.h:46
llvm::PreservedAnalyses::all
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
Definition: PassManager.h:158
llvm::AnalysisManager
A container for analyses that lazily runs them and caches their results.
Definition: InstructionSimplify.h:42
BB
Common register allocation spilling lr str ldr sxth r3 ldr mla r4 can lr mov lr str ldr sxth r3 mla r4 and then merge mul and lr str ldr sxth r3 mla r4 It also increase the likelihood the store may become dead bb27 Successors according to LLVM BB
Definition: README.txt:39