[PATCH] D73362: [mlir] EnumsGen: dissociate string form of integer enum from C++ symbol name
Alex Zinenko via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 24 08:59:02 PST 2020
ftynse created this revision.
Herald added subscribers: llvm-commits, liufengdb, lucyrfox, mgester, arpith-jacob, antiagainst, shauheen, burmako, jpienaar, rriddle, mehdi_amini.
Herald added a reviewer: nicolasvasilache.
Herald added a project: LLVM.
ftynse added a reviewer: antiagainst.
ftynse added a subscriber: flaub.
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D73362
Files:
mlir/include/mlir/Dialect/LLVMIR/LLVMOpBase.td
mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
mlir/include/mlir/IR/OpBase.td
mlir/include/mlir/TableGen/Attribute.h
mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
mlir/lib/TableGen/Attribute.cpp
mlir/tools/mlir-tblgen/EnumsGen.cpp
mlir/unittests/TableGen/EnumsGenTest.cpp
mlir/unittests/TableGen/enums.td
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73362.240217.patch
Type: text/x-patch
Size: 16976 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200124/2c37414c/attachment-0001.bin>
More information about the llvm-commits
mailing list