[flang-commits] [flang] [flang] Introducing a method to dynamically and conditionally register dialect interfaces. (PR #80881)
Vijay Kandiah via flang-commits
flang-commits at lists.llvm.org
Wed Feb 7 09:35:35 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);
----------------
VijayKandiah wrote:
Hi Jean, I chose not to call `addFIRExtensions` at those other places because of the following. With my set of changes, I meant to demonstrate the use of `addFIRExtensions` to dynamically register the `FIRInlinerInterface` only where it is needed, which is in `CodeGenAction::generateLLVMIR` before `createMLIRToLLVMPassPipeline`. The `FIRInlinerInterface` isn't really needed to be registered at those other two places.
The `addFIRExtensions` method can be extended for conditionally enabling other interfaces. If we need to add calls to `addFIRExtensions` at those other places in this file for your upcoming changes with ASM printing, we can just pass `addFIRInlinerInterface = false` in those calls to not register the `FIRInlinerInterface` there.
https://github.com/llvm/llvm-project/pull/80881
More information about the flang-commits
mailing list