[PATCH] D73468: [mlir] LLVM dialect: Generate conversions between EnumAttrCase and LLVM API

Alex Zinenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 27 05:56:50 PST 2020


ftynse created this revision.
ftynse added a reviewer: antiagainst.
Herald added subscribers: llvm-commits, liufengdb, aartbik, lucyrfox, mgester, arpith-jacob, shauheen, burmako, jpienaar, rriddle, mehdi_amini, mgorny.
Herald added a reviewer: nicolasvasilache.
Herald added a project: LLVM.

MLIR materializes various enumeration-based LLVM IR operands as enumeration
attributes using ODS. This requires bidirectional conversion between different
but very similar enums, currently hardcoded. Extend the ODS modeling of
LLVM-specific enumeration attributes to include the name of the corresponding
enum in the LLVM C++ API as well as the names of specific enumerants. Use this
new information to automatically generate the conversion functions between enum
attributes and LLVM API enums in the two-way conversion between the LLVM
dialect and LLVM IR proper.

Use the generated conversion functions for Linkage attributes as an example.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D73468

Files:
  mlir/include/mlir/Dialect/LLVMIR/CMakeLists.txt
  mlir/include/mlir/Dialect/LLVMIR/LLVMOpBase.td
  mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
  mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp
  mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
  mlir/tools/mlir-tblgen/LLVMIRConversionGen.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73468.240545.patch
Type: text/x-patch
Size: 13825 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200127/80e0652d/attachment.bin>


More information about the llvm-commits mailing list