llvm-capstone/mlir
Felipe de Azevedo Piovezan 86d68e2885 [mlir] Gen removeAttr methods with tablegen
If an operation defines an optional attribute (OptionalAttr or
UnitAttr), transformations may wish to remove these attributes while
maintaining invariants established by the operation. Currently, the only
way to do this is by calling `Operation::removeAttr("attrName")`, which
requires developers to know the exact name of the attribute used by
table-gen. Furthermore, if the attribute name changes, this won't be
detected at compile time. Instead, `removeAttr` would return an empty
attribute and no errors would be raised, unless the caller checks for
the returned value.

This patch adds table gen support for generating `remove<AttrName>Attr`
methods for OptionalAttributes defined by operations.

Implementation choice: to preserve camelCase for the method's name, the
first character of an attribute called `myAttr` is changed to upper case
in order to preserve the coding style, so the final method would be
called `removeMyAttr`.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D93903
2021-01-05 18:48:09 +00:00
..
cmake/modules [mlir][python] Fix python extension building on windows. 2020-12-31 00:11:39 -08:00
docs [mlir] Remove LLVMType, LLVM dialect types now derive Type directly 2021-01-05 17:36:54 +01:00
examples [NFC] Fix -Wrange-loop-analysis warnings. 2021-01-05 18:44:17 +00:00
include [mlir] Remove LLVMType, LLVM dialect types now derive Type directly 2021-01-05 17:36:54 +01:00
integration_test [mlir][Linalg] Revisit the Linalg on tensors abstraction 2020-12-21 12:29:10 -08:00
lib [mlir] Remove LLVMType, LLVM dialect types now derive Type directly 2021-01-05 17:36:54 +01:00
test [mlir] Gen removeAttr methods with tablegen 2021-01-05 18:48:09 +00:00
tools [mlir] Gen removeAttr methods with tablegen 2021-01-05 18:48:09 +00:00
unittests [mlir][IR][NFC] Move context/location parameters of builtin Type::get methods to the start of the parameter list 2020-12-17 13:01:36 -08:00
utils [mlir] Move std.tensor_cast -> tensor.cast. 2020-12-17 16:06:56 -08:00
.clang-format
.clang-tidy
CMakeLists.txt [mlir][Python] Check numpy in Python bindings configuration. 2020-12-02 09:29:20 +08:00
LICENSE.TXT
README.md

Multi-Level Intermediate Representation

See https://mlir.llvm.org/ for more information.