[llvm-branch-commits] [llvm] [WebAssembly] Port WebAssemblyMCLowerPrePass (PR #210440)
Heejin Ahn via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Jul 22 18:46:10 PDT 2026
================
@@ -62,16 +66,12 @@ ModulePass *llvm::createWebAssemblyMCLowerPrePass() {
//
// The information stored here is essential for emitExternalDecls in the Wasm
// AsmPrinter
-bool WebAssemblyMCLowerPrePass::runOnModule(Module &M) {
- auto *MMIWP = getAnalysisIfAvailable<MachineModuleInfoWrapperPass>();
- if (!MMIWP)
- return true;
-
- MachineModuleInfo &MMI = MMIWP->getMMI();
+static void mcLower(Module &M, MachineModuleInfo &MMI,
+ llvm::function_ref<MachineFunction *(Function *)> GetMF) {
----------------
aheejin wrote:
Not sure if I understand. `MachineModuleInfo` and `GetMF` are separate arguments anyway:
```cpp
static void mcLower(Module &M, MachineModuleInfo &MMI,
llvm::function_ref<MachineFunction *(Function *)> GetMF) {
```
I think I understand the rationale in #210246 for using `function_ref` for analyses because we may not end up needing to compute the analyses (because there is an `if` condition before that) but this doesn't seem to be the case here. What difference is there when we just pass a function vs. a function that returns a function?
https://github.com/llvm/llvm-project/pull/210440
More information about the llvm-branch-commits
mailing list