Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[mlir] Add derived attribute op interface
Interface provides uniform access to the the derived attribute query method.
- Loading branch information
Showing
5 changed files
with
98 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
mlir/include/mlir/Interfaces/DerivedAttributeOpInterface.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
//===- DerivedAttributeOpInterface.h ----------------------------*- C++ -*-===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This file contains a set of interfaces for derived attribute op interface. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef MLIR_INTERFACES_DERIVEDATTRIBUTEOPINTERFACE_H_ | ||
#define MLIR_INTERFACES_DERIVEDATTRIBUTEOPINTERFACE_H_ | ||
|
||
#include "mlir/IR/OpDefinition.h" | ||
|
||
namespace mlir { | ||
#include "mlir/Interfaces/DerivedAttributeOpInterface.h.inc" | ||
} // namespace mlir | ||
|
||
#endif // MLIR_INTERFACES_DERIVEDATTRIBUTEOPINTERFACE_H_ |
37 changes: 37 additions & 0 deletions
37
mlir/include/mlir/Interfaces/DerivedAttributeOpInterface.td
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
//===- DerivedAttributeOpInterface.td ----------------------*- tablegen -*-===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This file contains a set of interfaces for derived attribute op interface. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef MLIR_DERIVEDATTRIBUTEOPINTERFACE | ||
#define MLIR_DERIVEDATTRIBUTEOPINTERFACE | ||
|
||
include "mlir/IR/OpBase.td" | ||
|
||
def DerivedAttributeOpInterface : OpInterface<"DerivedAttributeOpInterface"> { | ||
let description = [{ | ||
Interface to query derived attribute characteristics. | ||
|
||
Derived attributes are not stored in the operation but are instead derived | ||
from information of the operation. ODS generates convenience accessors for | ||
derived attributes and can be used to simplify translations. | ||
}]; | ||
|
||
let methods = [ | ||
StaticInterfaceMethod< | ||
/*desc=*/"Returns whether name corresponds to a derived attribute.", | ||
/*retTy=*/"bool", | ||
/*methodName=*/"isDerivedAttribute", | ||
/*args=*/(ins "StringRef":$name) | ||
>, | ||
]; | ||
} | ||
|
||
#endif // MLIR_DERIVEDATTRIBUTEOPINTERFACE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
//===- DerivedAttributeOpInterface.cpp -- Derived Attribute interfaces ----===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This file contains a set of interfaces for derived attribute op interface. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#include "mlir/Interfaces/DerivedAttributeOpInterface.h" | ||
|
||
using namespace mlir; | ||
|
||
namespace mlir { | ||
#include "mlir/Interfaces/DerivedAttributeOpInterface.cpp.inc" | ||
} // namespace mlir |