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