[all-commits] [llvm/llvm-project] fee905: [mlir][ODS] Support specialized Attribute class fo...

Vladislav Vinogradov via All-commits all-commits at lists.llvm.org
Wed Mar 17 06:52:59 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: fee90542326bc1d81ba684bfc0a2cd21cb04e650
      https://github.com/llvm/llvm-project/commit/fee90542326bc1d81ba684bfc0a2cd21cb04e650
  Author: Vladislav Vinogradov <vlad.vinogradov at intel.com>
  Date:   2021-03-17 (Wed, 17 Mar 2021)

  Changed paths:
    M mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
    M mlir/include/mlir/Dialect/SPIRV/IR/SPIRVEnums.h
    M mlir/include/mlir/Dialect/SPIRV/IR/SPIRVMemoryOps.td
    M mlir/include/mlir/Dialect/Vector/VectorOps.td
    M mlir/include/mlir/IR/OpBase.td
    M mlir/include/mlir/TableGen/Attribute.h
    M mlir/lib/Conversion/SCFToSPIRV/SCFToSPIRV.cpp
    M mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp
    M mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
    M mlir/lib/Conversion/StandardToSPIRV/StandardToSPIRV.cpp
    M mlir/lib/Dialect/GPU/Transforms/ParallelLoopMapper.cpp
    M mlir/lib/Dialect/SPIRV/IR/SPIRVEnums.cpp
    M mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp
    M mlir/lib/TableGen/Attribute.cpp
    M mlir/lib/Target/SPIRV/Deserialization/DeserializeOps.cpp
    M mlir/lib/Target/SPIRV/Deserialization/Deserializer.cpp
    M mlir/test/lib/Dialect/Test/TestOps.td
    M mlir/tools/mlir-tblgen/EnumsGen.cpp
    M mlir/unittests/TableGen/EnumsGenTest.cpp
    M mlir/unittests/TableGen/enums.td

  Log Message:
  -----------
  [mlir][ODS] Support specialized Attribute class for Enums

Add a feature to `EnumAttr` definition to generate
specialized Attribute class for the particular enumeration.

This class will inherit `StringAttr` or `IntegerAttr` and
will override `classof` and `getValue` methods.

With this class the enumeration predicate can be checked with simple
RTTI calls (`isa`, `dyn_cast`) and it will return the typed enumeration
directly instead of raw string/integer.

Based on the following discussion:
https://llvm.discourse.group/t/rfc-add-enum-attribute-decorator-class/2252

Reviewed By: rriddle

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




More information about the All-commits mailing list