diff options
author | Arthur Eubanks <aeubanks@google.com> | 2024-02-07 10:15:43 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-07 09:15:43 -0800 |
commit | bb531c9a0068a078c5bbe95298769b235aa1ad75 (patch) | |
tree | 9f51c4c27d8d5df0bd2300f0dc4dcbdb252d74c6 /llvm/lib/CodeGen/MachineModuleInfo.cpp | |
parent | 65bf93dd7b4cfe96b549fd8248455ba4869ba27c (diff) | |
download | llvm-bb531c9a0068a078c5bbe95298769b235aa1ad75.zip llvm-bb531c9a0068a078c5bbe95298769b235aa1ad75.tar.gz llvm-bb531c9a0068a078c5bbe95298769b235aa1ad75.tar.bz2 |
[NewPM/Codegen] Move MachineModuleInfo ownership outside of analysis (#80937)
With the legacy pass manager, MachineModuleInfoWrapperPass owned the
MachineModuleInfo used in the codegen pipeline. It can do this since
it's an ImmutablePass that doesn't get invalidated.
However, with the new pass manager, it is legal for the
ModuleAnalysisManager to clear all of its analyses, regardless of if the
analysis does not want to be invalidated. So we must move ownership of
the MachineModuleInfo outside of the analysis (this is similar to
PassInstrumentation). For now, make the PassBuilder user register a
MachineModuleAnalysis that returns a reference to a MachineModuleInfo
that the user owns. Perhaps we can find a better place to own the
MachineModuleInfo to make using the codegen pass manager less cumbersome
in the future.
Diffstat (limited to 'llvm/lib/CodeGen/MachineModuleInfo.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineModuleInfo.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/MachineModuleInfo.cpp b/llvm/lib/CodeGen/MachineModuleInfo.cpp index 921feb2..f24288b 100644 --- a/llvm/lib/CodeGen/MachineModuleInfo.cpp +++ b/llvm/lib/CodeGen/MachineModuleInfo.cpp @@ -237,11 +237,10 @@ bool MachineModuleInfoWrapperPass::doFinalization(Module &M) { AnalysisKey MachineModuleAnalysis::Key; -MachineModuleInfo MachineModuleAnalysis::run(Module &M, - ModuleAnalysisManager &) { - MachineModuleInfo MMI(TM); +MachineModuleAnalysis::Result +MachineModuleAnalysis::run(Module &M, ModuleAnalysisManager &) { MMI.TheModule = &M; - MMI.DbgInfoAvailable = !DisableDebugInfoPrinting && - !M.debug_compile_units().empty(); - return MMI; + MMI.DbgInfoAvailable = + !DisableDebugInfoPrinting && !M.debug_compile_units().empty(); + return Result(MMI); } |