Anthony Yu
2013-Jun-21 11:27 UTC
[LLVMdev] About writing a modulePass in addPreEmitPass() for NVPTX
Hello, I want to write a modulePass in addPreEmitPass() for NVPTX, but I encounter an assertion failed when executing clang. Here is my error message. ===Pass 'NVPTX Assembly Printer' is not initialized. Verify if there is a pass dependency cycle. Required Passes: llc: /home/pyyu/local/llvm/lib/IR/PassManager.cpp:637: void llvm::PMTopLevelManager::schedulePass(llvm::Pass*): Assertion `PI && "Expected required passes to be initialized"' failed. 0 llc 0x000000000176cd86 llvm::sys::PrintStackTrace(_IO_FILE*) + 38 1 llc 0x000000000176d00d 2 llc 0x000000000176ca5c 3 libpthread.so.0 0x00007f9867638cb0 4 libc.so.6 0x00007f986688a425 gsignal + 53 5 libc.so.6 0x00007f986688db8b abort + 379 6 libc.so.6 0x00007f98668830ee 7 libc.so.6 0x00007f9866883192 8 llc 0x00000000016ec3b1 llvm::PMTopLevelManager::schedulePass(llvm::Pass*) + 983 9 llc 0x00000000016f2990 10 llc 0x00000000016f0e91 llvm::PassManager::add(llvm::Pass*) + 39 11 llc 0x00000000011c119b llvm::LLVMTargetMachine::addPassesToEmitFile(llvm::PassManagerBase&, llvm::formatted_raw_ostream&, llvm::TargetMachine::CodeGenFileType, bool, void const*, void const*) + 1705 12 llc 0x00000000008c08b5 13 llc 0x00000000008bf8cd main + 237 14 libc.so.6 0x00007f986687576d __libc_start_main + 237 15 llc 0x00000000008bf229 ==== What my modulePass does is to print all of the function name in the module. I use setPreservesAll() in getAnalysisUsage(), so there isn't any pass dependency cycle. I notice that NVPTXAsmPrinter says it does static initialization. I'm not sure if it is related to this error. Is there any advice to solve this error? And I also want to know if there is a way to verify if there is a pass dependency cycle. Thanks for any advice. Antony Yu -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130621/dab51f7d/attachment.html>
Justin Holewinski
2013-Jun-21 23:44 UTC
[LLVMdev] About writing a modulePass in addPreEmitPass() for NVPTX
Are you sure you are initializing your pass properly? Can you show a stripped down version of your pass? On Fri, Jun 21, 2013 at 7:27 AM, Anthony Yu <swpenim at gmail.com> wrote:> Hello, > > I want to write a modulePass in addPreEmitPass() for NVPTX, but I > encounter an assertion failed when executing clang. > > Here is my error message. > ===> Pass 'NVPTX Assembly Printer' is not initialized. > Verify if there is a pass dependency cycle. > Required Passes: > llc: /home/pyyu/local/llvm/lib/IR/PassManager.cpp:637: void > llvm::PMTopLevelManager::schedulePass(llvm::Pass*): Assertion `PI && > "Expected required passes to be initialized"' failed. > 0 llc 0x000000000176cd86 > llvm::sys::PrintStackTrace(_IO_FILE*) + 38 > 1 llc 0x000000000176d00d > 2 llc 0x000000000176ca5c > 3 libpthread.so.0 0x00007f9867638cb0 > 4 libc.so.6 0x00007f986688a425 gsignal + 53 > 5 libc.so.6 0x00007f986688db8b abort + 379 > 6 libc.so.6 0x00007f98668830ee > 7 libc.so.6 0x00007f9866883192 > 8 llc 0x00000000016ec3b1 > llvm::PMTopLevelManager::schedulePass(llvm::Pass*) + 983 > 9 llc 0x00000000016f2990 > 10 llc 0x00000000016f0e91 llvm::PassManager::add(llvm::Pass*) > + 39 > 11 llc 0x00000000011c119b > llvm::LLVMTargetMachine::addPassesToEmitFile(llvm::PassManagerBase&, > llvm::formatted_raw_ostream&, llvm::TargetMachine::CodeGenFileType, bool, > void const*, void const*) + 1705 > 12 llc 0x00000000008c08b5 > 13 llc 0x00000000008bf8cd main + 237 > 14 libc.so.6 0x00007f986687576d __libc_start_main + 237 > 15 llc 0x00000000008bf229 > ====> > What my modulePass does is to print all of the function name in the > module. > I use setPreservesAll() in getAnalysisUsage(), so there isn't any pass > dependency cycle. > > I notice that NVPTXAsmPrinter says it does static initialization. I'm not > sure if it is related to this error. > > Is there any advice to solve this error? And I also want to know if there > is a way to verify if there is a pass dependency cycle. > > > Thanks for any advice. > Antony Yu > > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >-- Thanks, Justin Holewinski -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130621/d5318387/attachment.html>
Antony Yu
2013-Jun-22 14:36 UTC
[LLVMdev] About writing a modulePass in addPreEmitPass() for NVPTX
I write my pass in a mix way of NVPTXAllocaHoisting, NVPTXSplitBBatBar and transforms/Hello. The following is part of the codes: in NVPTXTargetMachine.cpp bool NVPTXPassConfig::addPreEmitPass() { addPass(createTest()); return false; } in NVPTXTest.h namespace llvm{ class NVPTXTest : public ModulePass { void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); } }; extern ModulePass *createTest(); } in NVPTXTest.cpp namespace llvm { char NVPTXTest::ID = 0; static RegisterPass<NVPTXTest> X("test", "Test Module Pass"); ModulePass *createTest() { return new NVPTXTest(); } } Thanks Antony Yu -- View this message in context: http://llvm.1065342.n5.nabble.com/About-writing-a-modulePass-in-addPreEmitPass-for-NVPTX-tp58701p58752.html Sent from the LLVM - Dev mailing list archive at Nabble.com.
Possibly Parallel Threads
- [LLVMdev] About writing a modulePass in addPreEmitPass() for NVPTX
- [LLVMdev] About writing a modulePass in addPreEmitPass() for NVPTX
- [LLVMdev] About writing a modulePass in addPreEmitPass() for NVPTX
- [LLVMdev] About writing a modulePass in addPreEmitPass() for NVPTX
- [LLVMdev] About writing a modulePass in addPreEmitPass() for NVPTX