//===- CallGraph.h - CallGraph analysis for MLIR ----------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file contains an analysis for computing the multi-level callgraph from a // given top-level operation. This nodes within this callgraph are defined by // the `CallOpInterface` and `CallableOpInterface` operation interfaces defined // in CallInterface.td. // //===----------------------------------------------------------------------===// #ifndef MLIR_ANALYSIS_CALLGRAPH_H #define MLIR_ANALYSIS_CALLGRAPH_H #include "mlir/Support/LLVM.h" #include "llvm/ADT/GraphTraits.h" #include "llvm/ADT/MapVector.h" #include "llvm/ADT/PointerIntPair.h" #include "llvm/ADT/SetVector.h" namespace mlir { class CallOpInterface; struct CallInterfaceCallable; class Operation; class Region; class SymbolTableCollection; //===----------------------------------------------------------------------===// // CallGraphNode //===----------------------------------------------------------------------===// /// This class represents a single callable in the callgraph. Aside from the /// external node, each node represents a callable node in the graph and /// contains a valid corresponding Region. The external node is a virtual node /// used to represent external edges into, and out of, the callgraph. class CallGraphNode { … }; //===----------------------------------------------------------------------===// // CallGraph //===----------------------------------------------------------------------===// class CallGraph { … }; } // namespace mlir namespace llvm { // Provide graph traits for traversing call graphs using standard graph // traversals. template <> struct GraphTraits<const mlir::CallGraphNode *> { … }; template <> struct GraphTraits<const mlir::CallGraph *> : public GraphTraits<const mlir::CallGraphNode *> { … }; } // namespace llvm #endif // MLIR_ANALYSIS_CALLGRAPH_H