[Mlir-commits] [llvm] [mlir] [mlir] support dialect attribute translation to LLVM IR (PR #75309)

Tobias Gysi llvmlistbot at llvm.org
Wed Dec 13 04:39:46 PST 2023


================
@@ -40,19 +42,21 @@ class LLVMTranslationDialectInterface
   /// Hook for derived dialect interface to provide translation of the
   /// operations to LLVM IR.
   virtual LogicalResult
-  convertOperation(Operation *op, llvm::IRBuilderBase &builder,
+  convertOperation(Operation *op, LLVM::CapturingIRBuilder &builder,
                    LLVM::ModuleTranslation &moduleTranslation) const {
     return failure();
   }
 
   /// Hook for derived dialect interface to act on an operation that has dialect
   /// attributes from the derived dialect (the operation itself may be from a
   /// different dialect). This gets called after the operation has been
-  /// translated. The hook is expected to use moduleTranslation to look up the
-  /// translation results and amend the corresponding IR constructs. Does
-  /// nothing and succeeds by default.
+  /// translated and accepts as second argument the list of LLVM IR instructions
+  /// that were constructed when translating the operation. The hook is expected
+  /// to use moduleTranslation to look up the translation results and amend the
+  /// corresponding IR constructs. Does nothing and succeeds by default.
----------------
gysit wrote:

```suggestion
  /// translated and accepts as second argument the list of LLVM IR instructions
  /// that were constructed when translating the operation. The hook is expected
  /// to use moduleTranslation to look up the translation results, primarily for
  /// functions and globals that are not LLVM IR instructions, and amend the
  /// corresponding IR constructs. Does nothing and succeeds by default.
```
nit: trying to clarify that moduleTranslation lookups are mainly used for functions and globals since they are not instructions (at least that was may undestanding?)

https://github.com/llvm/llvm-project/pull/75309


More information about the Mlir-commits mailing list