MLIR  19.0.0git
CFGLoopInfo.h
Go to the documentation of this file.
1 //===- CFGLoopInfo.h - LoopInfo analysis for region bodies ------*- 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 // This file defines the CFGLoopInfo analysis for MLIR. The CFGLoopInfo is used
10 // to identify natural loops and determine the loop depth of various nodes of a
11 // CFG.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef MLIR_ANALYSIS_LOOPINFO_H
16 #define MLIR_ANALYSIS_LOOPINFO_H
17 
18 #include "mlir/IR/Dominance.h"
20 #include "llvm/Support/GenericLoopInfo.h"
21 
22 namespace mlir {
23 class CFGLoop;
24 class CFGLoopInfo;
25 } // namespace mlir
26 
27 namespace llvm {
28 // Implementation in LLVM's LoopInfoImpl.h
29 extern template class LoopBase<mlir::Block, mlir::CFGLoop>;
30 extern template class LoopInfoBase<mlir::Block, mlir::CFGLoop>;
31 } // namespace llvm
32 
33 namespace mlir {
34 
35 /// Representation of a single loop formed by blocks. The inherited LoopBase
36 /// class provides accessors to the loop analysis.
37 class CFGLoop : public llvm::LoopBase<mlir::Block, mlir::CFGLoop> {
38 private:
39  explicit CFGLoop(mlir::Block *block);
40 
41  friend class llvm::LoopBase<mlir::Block, CFGLoop>;
42  friend class llvm::LoopInfoBase<mlir::Block, CFGLoop>;
43 };
44 
45 /// An LLVM LoopInfo instantiation for MLIR that provides access to CFG loops
46 /// found in the dominator tree.
47 class CFGLoopInfo : public llvm::LoopInfoBase<mlir::Block, mlir::CFGLoop> {
48 public:
49  CFGLoopInfo(const llvm::DominatorTreeBase<mlir::Block, false> &domTree);
50 };
51 
52 raw_ostream &operator<<(raw_ostream &os, mlir::Block &block);
53 
54 } // namespace mlir
55 
56 #endif // MLIR_ANALYSIS_LOOPINFO_H
Block represents an ordered list of Operations.
Definition: Block.h:30
An LLVM LoopInfo instantiation for MLIR that provides access to CFG loops found in the dominator tree...
Definition: CFGLoopInfo.h:47
Representation of a single loop formed by blocks.
Definition: CFGLoopInfo.h:37
Include the generated interface declarations.
Definition: CallGraph.h:229
Include the generated interface declarations.
raw_ostream & operator<<(raw_ostream &os, mlir::Block &block)
Definition: CFGLoopInfo.cpp:27