[all-commits] [llvm/llvm-project] 9f186b: [mlir][ods] Make Type- and AttrInterfaces also `Ty...

zero9178 via All-commits all-commits at lists.llvm.org
Thu Jul 7 03:22:04 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9f186bb125d697786066f1fdd1d0c0e0479a3a4d
      https://github.com/llvm/llvm-project/commit/9f186bb125d697786066f1fdd1d0c0e0479a3a4d
  Author: Markus Böck <markus.boeck02 at gmail.com>
  Date:   2022-07-07 (Thu, 07 Jul 2022)

  Changed paths:
    M mlir/docs/PDLL.md
    M mlir/include/mlir/IR/OpBase.td
    M mlir/lib/TableGen/Interfaces.cpp
    M mlir/lib/Tools/PDLL/Parser/Parser.cpp
    M mlir/test/mlir-pdll/Parser/include_td.pdll
    A mlir/test/mlir-tblgen/interfaces-as-constraints.td
    M mlir/tools/mlir-tblgen/OpFormatGen.cpp

  Log Message:
  -----------
  [mlir][ods] Make Type- and AttrInterfaces also `Type`s and `Attr`s

By making TypeInterfaces and AttrInterfaces, Types and Attrs respectively it'd then be possible to use them anywhere where a Type or Attr may go. That is within the arguments and results of an Op definition, in a RewritePattern etc.

Prior to this change users had to separately define a Type or Attr, with a predicate to check whether a type or attribute implements a given interface. Such code will be redundant now.
Removing such occurrences in upstream dialects will be part of a separate patch.

As part of implementing this patch, slight refactoring had to be done. In particular, Interfaces cppClassName field was renamed to cppInterfaceName as it "clashed" with TypeConstraints cppClassName. In particular Interfaces cppClassName expected just the class name, without any namespaces, while TypeConstraints cppClassName expected a fully qualified class name.

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


  Commit: 1a92dbcfa88a857bf735c897125d9a2f9be53e9e
      https://github.com/llvm/llvm-project/commit/1a92dbcfa88a857bf735c897125d9a2f9be53e9e
  Author: Markus Böck <markus.boeck02 at gmail.com>
  Date:   2022-07-07 (Thu, 07 Jul 2022)

  Changed paths:
    M mlir/include/mlir/Dialect/LLVMIR/LLVMOpBase.td
    M mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
    M mlir/include/mlir/Dialect/OpenMP/CMakeLists.txt
    M mlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
    A mlir/include/mlir/Dialect/OpenMP/OpenMPTypeInterfaces.td
    M mlir/include/mlir/IR/OpBase.td
    M mlir/lib/Dialect/OpenMP/CMakeLists.txt

  Log Message:
  -----------
  [mlir][ods] Replace redundant `Type` instances for interfaces

This patch makes use of TypeInterface implementing Type to remove instances of Type that simply checked whether a type implemented a given interface.
As part of this refactoring, some changes had to be done in the OpenMP Dialect files. In particular, they assumed that OpenMPOps.td to only ever include OpenMP TypeInterfaces, which did not hold anymore with a moved include in LLVMOpBase.td. For that reason, the type interface defintions were moved into a new file as is convention.

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


Compare: https://github.com/llvm/llvm-project/compare/60d6be5dd3f4...1a92dbcfa88a


More information about the All-commits mailing list