MLIR  16.0.0git
Traits.cpp
Go to the documentation of this file.
1 //===- Traits.cpp - Traits for MLIR DLTI dialect --------------------------===//
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 
10 #include "mlir/Dialect/DLTI/DLTI.h"
12 
13 using namespace mlir;
14 
16  // TODO: consider having trait inheritance so that HasDefaultDLTIDataLayout
17  // trait can inherit DataLayoutOpInterface::Trait and enforce the validity of
18  // the assertion below.
19  assert(
20  isa<DataLayoutOpInterface>(op) &&
21  "HasDefaultDLTIDataLayout trait unexpectedly attached to an op that does "
22  "not implement DataLayoutOpInterface");
23  return success();
24 }
25 
26 DataLayoutSpecInterface mlir::impl::getDataLayoutSpec(Operation *op) {
28  DLTIDialect::kDataLayoutAttrName);
29 }
Include the generated interface declarations.
Operation is a basic unit of execution within MLIR.
Definition: Operation.h:28
AttrClass getAttrOfType(StringAttr name)
Definition: Operation.h:375
DataLayoutSpecInterface getDataLayoutSpec(Operation *op)
Definition: Traits.cpp:26
A data layout specification is a list of entries that specify (partial) data layout information...
Definition: DLTI.h:67
LogicalResult success(bool isSuccess=true)
Utility function to generate a LogicalResult.
Definition: LogicalResult.h:56
This class represents an efficient way to signal success or failure.
Definition: LogicalResult.h:26
LogicalResult verifyHasDefaultDLTIDataLayoutTrait(Operation *op)
Definition: Traits.cpp:15