LLVM  16.0.0git
DDGPrinter.h
Go to the documentation of this file.
1 //===- llvm/Analysis/DDGPrinter.h -------------------------------*- C++ -*-===//
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 
9 //===----------------------------------------------------------------------===//
10 //
11 // This file defines the DOT printer for the Data-Dependence Graph (DDG).
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_ANALYSIS_DDGPRINTER_H
16 #define LLVM_ANALYSIS_DDGPRINTER_H
17 
18 #include "llvm/Analysis/DDG.h"
20 
21 namespace llvm {
22 class LPMUpdater;
23 class Loop;
24 
25 //===--------------------------------------------------------------------===//
26 // Implementation of DDG DOT Printer for a loop.
27 //===--------------------------------------------------------------------===//
28 class DDGDotPrinterPass : public PassInfoMixin<DDGDotPrinterPass> {
29 public:
32 };
33 
34 //===--------------------------------------------------------------------===//
35 // Specialization of DOTGraphTraits.
36 //===--------------------------------------------------------------------===//
37 template <>
39  : public DefaultDOTGraphTraits {
40 
41  DOTGraphTraits(bool IsSimple = false) : DefaultDOTGraphTraits(IsSimple) {}
42 
43  /// Generate a title for the graph in DOT format
44  std::string getGraphName(const DataDependenceGraph *G) {
45  assert(G && "expected a valid pointer to the graph.");
46  return "DDG for '" + std::string(G->getName()) + "'";
47  }
48 
49  /// Print a DDG node either in concise form (-ddg-dot-only) or
50  /// verbose mode (-ddg-dot).
51  std::string getNodeLabel(const DDGNode *Node,
52  const DataDependenceGraph *Graph);
53 
54  /// Print attributes of an edge in the DDG graph. If the edge
55  /// is a MemoryDependence edge, then detailed dependence info
56  /// available from DependenceAnalysis is displayed.
57  std::string
58  getEdgeAttributes(const DDGNode *Node,
60  const DataDependenceGraph *G);
61 
62  /// Do not print nodes that are part of a pi-block separately. They
63  /// will be printed when their containing pi-block is being printed.
64  bool isNodeHidden(const DDGNode *Node, const DataDependenceGraph *G);
65 
66 private:
67  /// Print a DDG node in concise form.
68  static std::string getSimpleNodeLabel(const DDGNode *Node,
69  const DataDependenceGraph *G);
70 
71  /// Print a DDG node with more information including containing instructions
72  /// and detailed information about the dependence edges.
73  static std::string getVerboseNodeLabel(const DDGNode *Node,
74  const DataDependenceGraph *G);
75 
76  /// Print a DDG edge in concise form.
77  static std::string getSimpleEdgeAttributes(const DDGNode *Src,
78  const DDGEdge *Edge,
79  const DataDependenceGraph *G);
80 
81  /// Print a DDG edge with more information including detailed information
82  /// about the dependence edges.
83  static std::string getVerboseEdgeAttributes(const DDGNode *Src,
84  const DDGEdge *Edge,
85  const DataDependenceGraph *G);
86 };
87 
89 
90 } // namespace llvm
91 
92 #endif // LLVM_ANALYSIS_DDGPRINTER_H
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::PassInfoMixin
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:371
llvm::Loop
Represents a single loop in the control flow graph.
Definition: LoopInfo.h:547
llvm::LoopStandardAnalysisResults
The adaptor from a function pass to a loop pass computes these analyses and makes them available to t...
Definition: LoopAnalysisManager.h:51
llvm::DDGDotPrinterPass::run
PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM, LoopStandardAnalysisResults &AR, LPMUpdater &U)
Definition: DDGPrinter.cpp:32
llvm::DDGEdge
Data Dependency Graph Edge.
Definition: DDG.h:213
llvm::DDGDotPrinterPass
Definition: DDGPrinter.h:28
llvm::DOTGraphTraits
DOTGraphTraits - Template class that can be specialized to customize how graphs are converted to 'dot...
Definition: DOTGraphTraits.h:166
G
const DataFlowGraph & G
Definition: RDFGraph.cpp:200
llvm::LPMUpdater
This class provides an interface for updating the loop pass manager based on mutations to the loop ne...
Definition: LoopPassManager.h:262
const
aarch64 promote const
Definition: AArch64PromoteConstant.cpp:232
llvm::DOTGraphTraits< const DataDependenceGraph * >
Definition: DDGPrinter.h:38
I
#define I(x, y, z)
Definition: MD5.cpp:58
llvm::DOTGraphTraits< const DataDependenceGraph * >::getGraphName
std::string getGraphName(const DataDependenceGraph *G)
Generate a title for the graph in DOT format.
Definition: DDGPrinter.h:44
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
DDG.h
Node
Definition: ItaniumDemangle.h:156
llvm::DOTGraphTraits< const DataDependenceGraph * >::DOTGraphTraits
DOTGraphTraits(bool IsSimple=false)
Definition: DDGPrinter.h:41
DOTGraphTraits.h
llvm::DDGNode
Data Dependence Graph Node The graph can represent the following types of nodes:
Definition: DDG.h:44
llvm::DataDependenceGraph
Data Dependency Graph.
Definition: DDG.h:306
llvm::DefaultDOTGraphTraits
DefaultDOTGraphTraits - This class provides the default implementations of all of the DOTGraphTraits ...
Definition: DOTGraphTraits.h:28
getNodeLabel
static std::string getNodeLabel(const ValueInfo &VI, GlobalValueSummary *GVS)
Definition: ModuleSummaryIndex.cpp:488
llvm::AnalysisManager
A container for analyses that lazily runs them and caches their results.
Definition: InstructionSimplify.h:42
llvm::GraphTraits
Definition: GraphTraits.h:37