[all-commits] [llvm/llvm-project] fdc496: [mlir] EnumsGen: dissociate string form of integer...

ftynse via All-commits all-commits at lists.llvm.org
Thu Jan 30 08:04:10 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: fdc496a3d30d2d82814965a6aa987b7ef0b136ef
      https://github.com/llvm/llvm-project/commit/fdc496a3d30d2d82814965a6aa987b7ef0b136ef
  Author: Alex Zinenko <zinenko at google.com>
  Date:   2020-01-30 (Thu, 30 Jan 2020)

  Changed paths:
    M mlir/include/mlir/Dialect/LLVMIR/LLVMOpBase.td
    M mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
    M mlir/include/mlir/IR/OpBase.td
    M mlir/include/mlir/TableGen/Attribute.h
    M mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
    M mlir/lib/TableGen/Attribute.cpp
    M mlir/tools/mlir-tblgen/EnumsGen.cpp
    M mlir/unittests/TableGen/EnumsGenTest.cpp
    M mlir/unittests/TableGen/enums.td

  Log Message:
  -----------
  [mlir] EnumsGen: dissociate string form of integer enum from C++ symbol name

Summary:
In some cases, one may want to use different names for C++ symbol of an
enumerand from its string representation. In particular, in the LLVM dialect
for, e.g., Linkage, we would like to preserve the same enumerand names as LLVM
API and the same textual IR form as LLVM IR, yet the two are different
(CamelCase vs snake_case with additional limitations on not being a C++
keyword).

Modify EnumAttrCaseInfo in OpBase.td to include both the integer value and its
string representation. By default, this representation is the same as C++
symbol name. Introduce new IntStrAttrCaseBase that allows one to use different
names. Exercise it for LLVM Dialect Linkage attribute. Other attributes will
follow as separate changes.

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




More information about the All-commits mailing list