[PATCH] D76571: [mlir] Start simple C++ backend

Stephen Neuendorffer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 23 11:28:23 PDT 2020


stephenneuendorffer added inline comments.


================
Comment at: mlir/include/mlir/Target/Cpp.h:39
+/// Known limitations:
+/// - Doesn't understand C++ semantics and so may emit invalid code;
+/// - Doesn't attempt to ensure the function names are valid C++ names;
----------------
What do you think about introducing an "EmitC" dialect, rather than doing string catenation here, isolate it somewhere else?


================
Comment at: mlir/lib/Target/Cpp/TranslateToCpp.cpp:197-207
+llvm::StringMap<CppEmitter::EmitterRegistryFunction> &
+getMutableCppEmitterRegistry() {
+  static llvm::StringMap<CppEmitter::EmitterRegistryFunction> registry;
+  return registry;
+}
+
+void mlir::registerCppEmitter(
----------------
Maybe an Interface would work well here, instead of having a separate registry?  I've used this to build a simulator for some dialects and it seems to scale reasonably well.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D76571/new/

https://reviews.llvm.org/D76571





More information about the llvm-commits mailing list