[llvm] [CodeGen] Avoid MachineModuleInfo in MachineModuleSlotTracker (PR #140530)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Thu May 22 02:24:58 PDT 2025
================
@@ -983,11 +986,23 @@ void llvm::printMIR(raw_ostream &OS, const Module &M) {
Out << const_cast<Module &>(M);
}
-void llvm::printMIR(raw_ostream &OS, const MachineModuleInfo &MMI,
- const MachineFunction &MF) {
+void llvm::printMIR(raw_ostream &OS, MachineModuleInfo *MMI,
+ FunctionAnalysisManager *FAM, const MachineFunction &MF) {
// RemoveDIs: as there's no textual form for DbgRecords yet, print debug-info
// in dbg.value format.
ScopedDbgInfoFormatSetter FormatSetter(
const_cast<Function &>(MF.getFunction()), UseNewDbgInfoFormat);
- printMF(OS, MMI, MF);
+ if (MMI) {
+ printMF(
+ OS, [&](const Function &F) { return MMI->getMachineFunction(F); }, MF);
+ } else {
+ printMF(
+ OS,
+ [&](const Function &F) {
+ return &FAM->getResult<MachineFunctionAnalysis>(
+ const_cast<Function &>(F))
----------------
arsenm wrote:
Shouldn't need const_cast
https://github.com/llvm/llvm-project/pull/140530
More information about the llvm-commits
mailing list