[llvm] [Instrumentation] Support MachineFunction in ChangeReporter (PR #80946)

via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 7 05:39:54 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);
----------------
paperchalice wrote:

In fact, not all machine functions are available at this time, when running default codegen pipeline.

https://github.com/llvm/llvm-project/pull/80946


More information about the llvm-commits mailing list