[Lldb-commits] [lldb] Add flags to dump IR to a file before and after LLVM passes (PR #65179)

2023-09-03 Thread Min-Yih Hsu via lldb-commits


@@ -830,6 +831,182 @@ void PrintIRInstrumentation::registerCallbacks(
   }
 }
 
+void DumpIRInstrumentation::registerCallbacks(
+PassInstrumentationCallbacks &PIC) {
+
+  if (!(shouldDumpBeforeSomePass() || shouldDumpAfterSomePass()))
+return;
+
+  this->PIC = &PIC;
+
+  PIC.registerBeforeNonSkippedPassCallback(
+  [this](StringRef P, Any IR) { this->pushPass(P, IR); });
+
+  if (shouldDumpBeforeSomePass())
+PIC.registerBeforeNonSkippedPassCallback(
+[this](StringRef P, Any IR) { this->dumpBeforePass(P, IR); });
+
+  if (shouldDumpAfterSomePass()) {
+PIC.registerAfterPassCallback(
+[this](StringRef P, Any IR, const PreservedAnalyses &) {
+  this->dumpAfterPass(P, IR);
+});
+  }
+
+  // It is important the the "popPass" callback fires after the dumpAfterPass
+  // callback
+  PIC.registerAfterPassCallback(
+  [this](StringRef P, Any IR, const PreservedAnalyses &) {
+this->popPass(P);
+  });
+}
+
+void DumpIRInstrumentation::dumpBeforePass(StringRef PassID, Any IR) {
+  if (isIgnored(PassID))

mshockwave wrote:

somehow I thought the brace on line 870 marks the end of this function, my bad. 
It's all good now

https://github.com/llvm/llvm-project/pull/65179
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [NFC][CodeGen] Change CodeGenOpt::Level/CodeGenFileType into enum classes (PR #66295)

2023-09-13 Thread Min-Yih Hsu via lldb-commits

https://github.com/mshockwave approved this pull request.


https://github.com/llvm/llvm-project/pull/66295
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits