================
@@ -245,11 +249,36 @@ void WebAssemblyCodeGenPassBuilder::addPreEmitPass(
   addModulePass(WebAssemblyMCLowerPrePass(), PMW);
 }
 
+void WebAssemblyCodeGenPassBuilder::addAsmPrinterBegin(
+    PassManagerWrapper &PMW) const {
+  addModulePass(WebAssemblyAsmPrinterBeginPass(), PMW);
+}
+
+void WebAssemblyCodeGenPassBuilder::addAsmPrinter(
+    PassManagerWrapper &PMW) const {
+  addMachineFunctionPass(WebAssemblyAsmPrinterPass(), PMW);
+}
+
+void WebAssemblyCodeGenPassBuilder::addAsmPrinterEnd(
+    PassManagerWrapper &PMW) const {
+  addModulePass(WebAssemblyAsmPrinterEndPass(), PMW);
+}
+
 } // namespace
 
-void WebAssemblyTargetMachine::registerPassBuilderCallbacks(PassBuilder &PB){
+void WebAssemblyTargetMachine::registerPassBuilderCallbacks(PassBuilder &PB) {
 #define GET_PASS_REGISTRY "WebAssemblyPassRegistry.def"
 #include "llvm/Passes/TargetPassRegistry.inc"
+  // TODO(boomanaiden154): Move this into the base CodeGenPassBuilder once all
+  // targets that currently implement it have a ported asm-printer pass.
+  if (PIC) {
+    PIC->addClassToPassName(WebAssemblyAsmPrinterBeginPass::name(),
+                            "wasm-asm-printer-begin");
+    PIC->addClassToPassName(WebAssemblyAsmPrinterPass::name(),
+                            "wasm-asm-printer");
+    PIC->addClassToPassName(WebAssemblyAsmPrinterEndPass::name(),
+                            "wasm-asm-printer-end");
+  }
----------------
aheejin wrote:

What is `PIC`? Is there a case `PIC` doesn't exist? (Because there is an `if`) 
What happens in that case?

Also, if these passes are not normally registered, who actually schdeles / 
calls these passes?

https://github.com/llvm/llvm-project/pull/210448
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to