19 : defaultLayout(std::make_unique<
DataLayout>(DataLayoutOpInterface())) {
21 auto computeLayout = [
this](
Operation *op) {
22 if (
auto iface = dyn_cast<DataLayoutOpInterface>(op))
23 layouts[op] = std::make_unique<DataLayout>(iface);
24 if (
auto module = dyn_cast<ModuleOp>(op))
25 layouts[op] = std::make_unique<DataLayout>(module);
29 root->
walk(computeLayout);
32 computeLayout(ancestor);
39 auto it = layouts.find(ancestor);
40 if (it != layouts.end())
41 return *it->getSecond();
45 return *defaultLayout;
49 auto it = layouts.find(operation);
50 if (it != layouts.end())
51 return *it->getSecond();
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.
std::enable_if_t< llvm::function_traits< std::decay_t< FnT > >::num_args==1, RetT > walk(FnT &&callback)
Walk the operation by calling the callback for each nested operation (including this one),...
Operation * getParentOp()
Returns the closest surrounding operation that contains this operation or nullptr if this is a top-le...
Include the generated interface declarations.