MLIR 22.0.0git
Traits.h
Go to the documentation of this file.
1//===- Traits.h - Trait Declaration for MLIR DLTI dialect -------*- 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_DIALECT_DLTI_TRAITS_H
10#define MLIR_DIALECT_DLTI_TRAITS_H
11
14
15namespace mlir {
16class DataLayoutSpecAttr;
17
18namespace impl {
20DataLayoutSpecInterface getDataLayoutSpec(Operation *op);
21TargetSystemSpecInterface getTargetSystemSpec(Operation *op);
22} // namespace impl
23
24/// Trait to be used by operations willing to use the implementation of the
25/// data layout interfaces provided by the Target dialect.
26template <typename ConcreteOp>
28 : public OpTrait::TraitBase<ConcreteOp, HasDefaultDLTIDataLayout> {
29public:
30 /// Verifies that the operation to which this trait is attached is valid for
31 /// the trait, i.e., that it implements the data layout operation interface.
32 static LogicalResult verifyTrait(Operation *op) {
34 }
35
36 /// Returns the data layout specification as provided by the Target dialect
37 /// specification attribute.
38 DataLayoutSpecInterface getDataLayoutSpec() {
40 }
41
42 /// Returns the target system description specification as provided by DLTI
43 /// dialect
44 TargetSystemSpecInterface getTargetSystemSpec() {
46 }
47};
48} // namespace mlir
49
50#endif // MLIR_DIALECT_DLTI_TRAITS_H
Trait to be used by operations willing to use the implementation of the data layout interfaces provid...
Definition Traits.h:28
TargetSystemSpecInterface getTargetSystemSpec()
Returns the target system description specification as provided by DLTI dialect.
Definition Traits.h:44
static LogicalResult verifyTrait(Operation *op)
Verifies that the operation to which this trait is attached is valid for the trait,...
Definition Traits.h:32
DataLayoutSpecInterface getDataLayoutSpec()
Returns the data layout specification as provided by the Target dialect specification attribute.
Definition Traits.h:38
Helper class for implementing traits.
Operation is the basic unit of execution within MLIR.
Definition Operation.h:88
DataLayoutSpecInterface getDataLayoutSpec(Operation *op)
Definition Traits.cpp:26
TargetSystemSpecInterface getTargetSystemSpec(Operation *op)
Definition Traits.cpp:31
LogicalResult verifyHasDefaultDLTIDataLayoutTrait(Operation *op)
Definition Traits.cpp:15
Include the generated interface declarations.