File indexing completed on 2026-05-10 08:43:12
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #ifndef LLVM_ANALYSIS_DDGPRINTER_H
0016 #define LLVM_ANALYSIS_DDGPRINTER_H
0017
0018 #include "llvm/Analysis/DDG.h"
0019 #include "llvm/Support/DOTGraphTraits.h"
0020
0021 namespace llvm {
0022 class LPMUpdater;
0023 class Loop;
0024
0025
0026
0027
0028 class DDGDotPrinterPass : public PassInfoMixin<DDGDotPrinterPass> {
0029 public:
0030 PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
0031 LoopStandardAnalysisResults &AR, LPMUpdater &U);
0032 static bool isRequired() { return true; }
0033 };
0034
0035
0036
0037
0038 template <>
0039 struct DOTGraphTraits<const DataDependenceGraph *>
0040 : public DefaultDOTGraphTraits {
0041
0042 DOTGraphTraits(bool IsSimple = false) : DefaultDOTGraphTraits(IsSimple) {}
0043
0044
0045 std::string getGraphName(const DataDependenceGraph *G) {
0046 assert(G && "expected a valid pointer to the graph.");
0047 return "DDG for '" + std::string(G->getName()) + "'";
0048 }
0049
0050
0051
0052 std::string getNodeLabel(const DDGNode *Node,
0053 const DataDependenceGraph *Graph);
0054
0055
0056
0057
0058 std::string
0059 getEdgeAttributes(const DDGNode *Node,
0060 GraphTraits<const DDGNode *>::ChildIteratorType I,
0061 const DataDependenceGraph *G);
0062
0063
0064
0065 bool isNodeHidden(const DDGNode *Node, const DataDependenceGraph *G);
0066
0067 private:
0068
0069 static std::string getSimpleNodeLabel(const DDGNode *Node,
0070 const DataDependenceGraph *G);
0071
0072
0073
0074 static std::string getVerboseNodeLabel(const DDGNode *Node,
0075 const DataDependenceGraph *G);
0076
0077
0078 static std::string getSimpleEdgeAttributes(const DDGNode *Src,
0079 const DDGEdge *Edge,
0080 const DataDependenceGraph *G);
0081
0082
0083
0084 static std::string getVerboseEdgeAttributes(const DDGNode *Src,
0085 const DDGEdge *Edge,
0086 const DataDependenceGraph *G);
0087 };
0088
0089 using DDGDotGraphTraits = DOTGraphTraits<const DataDependenceGraph *>;
0090
0091 }
0092
0093 #endif