[all-commits] [llvm/llvm-project] 495751: [mlir][ods] Simplify useDefaultType/AttributePrint...

Jeff Niu via All-commits all-commits at lists.llvm.org
Wed May 18 10:22:27 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4957518ef57f35e64d0b9716b745c654efa91d36
      https://github.com/llvm/llvm-project/commit/4957518ef57f35e64d0b9716b745c654efa91d36
  Author: Mogball <jeffniu22 at gmail.com>
  Date:   2022-05-18 (Wed, 18 May 2022)

  Changed paths:
    M mlir/examples/toy/Ch7/include/toy/Ops.td
    M mlir/include/mlir/Dialect/Async/IR/AsyncDialect.td
    M mlir/include/mlir/Dialect/DLTI/DLTIBase.td
    M mlir/include/mlir/Dialect/EmitC/IR/EmitCBase.td
    M mlir/include/mlir/Dialect/GPU/GPUBase.td
    M mlir/include/mlir/Dialect/LLVMIR/LLVMOpBase.td
    M mlir/include/mlir/Dialect/Linalg/IR/LinalgBase.td
    M mlir/include/mlir/Dialect/NVGPU/NVGPU.td
    M mlir/include/mlir/Dialect/PDL/IR/PDLDialect.td
    M mlir/include/mlir/Dialect/Quant/QuantOpsBase.td
    M mlir/include/mlir/Dialect/SPIRV/IR/SPIRVBase.td
    M mlir/include/mlir/Dialect/Shape/IR/ShapeBase.td
    M mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td
    M mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorBase.td
    M mlir/include/mlir/Dialect/Vector/IR/VectorOps.td
    M mlir/include/mlir/IR/DialectBase.td
    M mlir/test/python/python_test_ops.td
    M mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp
    M mlir/tools/mlir-tblgen/DialectGen.cpp

  Log Message:
  -----------
  [mlir][ods] Simplify useDefaultType/AttributePrinterParser

The current behaviour of `useDefaultTypePrinterParser` and `useDefaultAttributePrinterParser` is that they are set by default, but the dialect generator only generates the declarations for the parsing and printing hooks if it sees dialect types and attributes. Same goes for the definitions generated by the AttrOrTypeDef generator.

This can lead to confusing and undesirable behaviour if the dialect generator doesn't see the definitions of the attributes and types, for example, if they are sensibly separated into different files: `Dialect.td`, `Ops.td`, `Attributes.td`, and `Types.td`.

Now, these bits are unset by default. Setting them will always result in the dialect generator emitting the declarations for the parsing hooks. And if the AttrOrTypeDef generator sees it set, it will generate the default implementations.

Reviewed By: rriddle, stellaraccident

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




More information about the All-commits mailing list