[llvm] [Instrumentation] Support MachineFunction in ChangeReporter (PR #80946)
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 7 13:37:04 PST 2024
================
@@ -448,6 +478,17 @@ template <typename T> void TextChangeReporter<T>::handleInitialIR(Any IR) {
M->print(Out, nullptr);
}
+template <typename T>
+void TextChangeReporter<T>::handleInitialMIR(const MachineFunction *IR) {
+ // Print all available machine functions.
+ const auto &MMI = IR->getMMI();
+ const auto &M = *MMI.getModule();
+ Out << "*** MIR Dump At Start ***\n";
+ for (const Function &F : M)
+ if (auto *MF = MMI.getMachineFunction(F))
+ MF->print(Out);
----------------
aeubanks wrote:
that's a good point. I'm not sure if we should print something to tell the user that the machine function doesn't exist.
it is weird to print `MIR Dump At Start` and then not print anything if we don't have any MFs yet. perhaps we just don't print anything here if we don't have any MFs
https://github.com/llvm/llvm-project/pull/80946
More information about the llvm-commits
mailing list