MLIR  19.0.0git
DataLayoutAnalysis.h
Go to the documentation of this file.
1 //===- DataLayoutAnalysis.h - API for Querying Nested Data Layout -*- 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 #ifndef MLIR_ANALYSIS_DATALAYOUTANALYSIS_H
10 #define MLIR_ANALYSIS_DATALAYOUTANALYSIS_H
11 
12 #include "mlir/Support/LLVM.h"
13 #include "llvm/ADT/DenseMap.h"
14 
15 #include <memory>
16 
17 namespace mlir {
18 
19 class Operation;
20 class DataLayout;
21 
22 /// Stores data layout objects for each operation that specifies the data layout
23 /// above and below the given operation.
25 public:
26  /// Constructs the data layouts.
27  explicit DataLayoutAnalysis(Operation *root);
28 
29  /// Returns the data layout active at the given operation, that is the
30  /// data layout specified by the closest ancestor that can specify one, or the
31  /// default layout if there is no such ancestor.
32  const DataLayout &getAbove(Operation *operation) const;
33 
34  /// Returns the data layout specified by the given operation or its closest
35  /// ancestor that can specify one.
36  const DataLayout &getAtOrAbove(Operation *operation) const;
37 
38 private:
39  /// Storage for individual data layouts.
41 
42  /// Default data layout in case no operations specify one.
43  std::unique_ptr<DataLayout> defaultLayout;
44 };
45 
46 } // namespace mlir
47 
48 #endif // MLIR_ANALYSIS_DATALAYOUTANALYSIS_H
Stores data layout objects for each operation that specifies the data layout above and below the give...
const DataLayout & getAtOrAbove(Operation *operation) const
Returns the data layout specified by the given operation or its closest ancestor that can specify one...
const DataLayout & getAbove(Operation *operation) const
Returns the data layout active at the given operation, that is the data layout specified by the close...
DataLayoutAnalysis(Operation *root)
Constructs the data layouts.
The main mechanism for performing data layout queries.
Operation is the basic unit of execution within MLIR.
Definition: Operation.h:88
Include the generated interface declarations.