//===- Dominance.h - Dominator analysis for regions -------------*- 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 // //===----------------------------------------------------------------------===// // // The DominanceInfo and PostDominanceInfo class provide routines for performimg // simple dominance checks, and expose dominator trees for advanced clients. // These classes provide fully region-aware functionality, lazily constructing // dominator information for any multi-block regions that need it. // // For more information about the theory behind dominance in graphs algorithms, // see: https://en.wikipedia.org/wiki/Dominator_(graph_theory) // //===----------------------------------------------------------------------===// #ifndef MLIR_IR_DOMINANCE_H #define MLIR_IR_DOMINANCE_H #include "mlir/IR/RegionGraphTraits.h" #include "llvm/Support/GenericDomTree.h" extern template class llvm::DominatorTreeBase<mlir::Block, false>; extern template class llvm::DominatorTreeBase<mlir::Block, true>; extern template class llvm::DomTreeNodeBase<mlir::Block>; namespace mlir { DominanceInfoNode; class Operation; namespace detail { template <bool IsPostDom> class DominanceInfoBase { … }; extern template class DominanceInfoBase</*IsPostDom=*/true>; extern template class DominanceInfoBase</*IsPostDom=*/false>; } // namespace detail /// A class for computing basic dominance information. Note that this /// class is aware of different types of regions and returns a /// region-kind specific concept of dominance. See RegionKindInterface. class DominanceInfo : public detail::DominanceInfoBase</*IsPostDom=*/false> { … }; /// A class for computing basic postdominance information. class PostDominanceInfo : public detail::DominanceInfoBase</*IsPostDom=*/true> { … }; } // namespace mlir namespace llvm { /// DominatorTree GraphTraits specialization so the DominatorTree can be /// iterated by generic graph iterators. template <> struct GraphTraits<mlir::DominanceInfoNode *> { … }; template <> struct GraphTraits<const mlir::DominanceInfoNode *> { … }; } // namespace llvm #endif