//===- GenericCycleInfo.h - Info for Cycles in any IR ------*- 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 // //===----------------------------------------------------------------------===// /// /// \file /// \brief Find all cycles in a control-flow graph, including irreducible loops. /// /// See docs/CycleTerminology.rst for a formal definition of cycles. /// /// Briefly: /// - A cycle is a generalization of a loop which can represent /// irreducible control flow. /// - Cycles identified in a program are implementation defined, /// depending on the DFS traversal chosen. /// - Cycles are well-nested, and form a forest with a parent-child /// relationship. /// - In any choice of DFS, every natural loop L is represented by a /// unique cycle C which is a superset of L. /// - In the absence of irreducible control flow, the cycles are /// exactly the natural loops in the program. /// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_GENERICCYCLEINFO_H #define LLVM_ADT_GENERICCYCLEINFO_H #include "llvm/ADT/DenseSet.h" #include "llvm/ADT/GenericSSAContext.h" #include "llvm/ADT/GraphTraits.h" #include "llvm/ADT/SetVector.h" #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" namespace llvm { template <typename ContextT> class GenericCycleInfo; template <typename ContextT> class GenericCycleInfoCompute; /// A possibly irreducible generalization of a \ref Loop. template <typename ContextT> class GenericCycle { … }; /// \brief Cycle information for a function. template <typename ContextT> class GenericCycleInfo { … }; /// \brief GraphTraits for iterating over a sub-tree of the CycleT tree. template <typename CycleRefT, typename ChildIteratorT> struct CycleGraphTraits { … }; GraphTraits<const GenericCycle<BlockT> *>; GraphTraits<GenericCycle<BlockT> *>; } // namespace llvm #endif // LLVM_ADT_GENERICCYCLEINFO_H