[all-commits] [llvm/llvm-project] 59f59d: [mlir] Allow to override type/attr aliases from va...

Vladislav Vinogradov via All-commits all-commits at lists.llvm.org
Fri Aug 6 02:05:00 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 59f59d1c621cf6844c41fd92ad32a897fc9d10bd
      https://github.com/llvm/llvm-project/commit/59f59d1c621cf6844c41fd92ad32a897fc9d10bd
  Author: Vladislav Vinogradov <vlad.vinogradov at intel.com>
  Date:   2021-08-06 (Fri, 06 Aug 2021)

  Changed paths:
    M mlir/include/mlir/IR/OpImplementation.h
    M mlir/lib/IR/AsmPrinter.cpp
    M mlir/lib/IR/BuiltinDialect.cpp
    M mlir/test/IR/print-attr-type-aliases.mlir
    M mlir/test/lib/Dialect/Test/TestDialect.cpp

  Log Message:
  -----------
  [mlir] Allow to override type/attr aliases from various hooks

Use new return type for `OpAsmDialectInterface::getAlias`:

* `AliasResult::NoAlias` if an alias was not provided.
* `AliasResult::OverridableAlias` if an alias was provided, but it might be overriden by other hook.
* `AliasResult::FinalAlias` if an alias was provided and it should be used (no other hooks will be checked).

In that case `AsmPrinter` will use either the first alias with `FinalAlias` result or
the last alias with `OverridableAlias` result (it depends on dialect array order).

Used `OverridableAlias` result for `BuiltinOpAsmDialectInterface`.

Use case: provide more informative alias for built-in attributes like `AffineMapAttr`
instead of generic "map<N>".

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D107437




More information about the All-commits mailing list