[flang-commits] [flang] [flang] Introducing a method to dynamically and conditionally register dialect interfaces. (PR #80881)

via flang-commits flang-commits at lists.llvm.org
Wed Feb 7 00:12:53 PST 2024


================
@@ -786,6 +786,10 @@ void CodeGenAction::generateLLVMIR() {
   llvm::OptimizationLevel level = mapToLevel(opts);
 
   fir::support::loadDialects(*mlirCtx);
+  mlir::DialectRegistry registry;
+  fir::support::registerNonCodegenDialects(registry);
+  fir::support::addFIRExtensions(registry);
----------------
jeanPerier wrote:

Actually, there are two other calls to loadDialects in this file (in `CodeGenAction::beginSourceFileAction` and `CodeGenAction::lowerHLFIRToFIR`), don't you need to call `addFIRExtensions` there too?

Maybe you could instead add an option to `loadDialects` and call `addFIRExtensions` inside `loadDialects` and propagate the option.

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


More information about the flang-commits mailing list