Sarah Thompson
2007-Jul-25 20:51 UTC
[LLVMdev] Writing a pass for the opt tool: likely documentation bug
Hi, I'm currently attempting to implement a pass that will hopefully run under the opt tool. Currently, I'm having some difficulties -- the sample code for the Hello pass (see http://llvm.org/docs/WritingAnLLVMPass.html) doesn't work. The first error is that the section starting 'As a while, the cpp file looks like:' omits the declaration for char Hello::ID = 0 that is given separately above. If you add this, opt still fails with the message: opt: /usr/local/rse/llvm/src/lib/VMCore/Pass.cpp:158: void <unnamed>::PassRegistrar::RegisterPass(llvm::PassInfo&): Assertion `Inserted && "Pass registered multiple times!"' failed. which appears to be triggered by the RegisterPass<Hello> X... line in the source (the error disappears if you comment that line out, though for obvious reasons the pass won't work if you do that). I've checked, there definitely isn't anything weird going on that would cause more than one instance of RegisterPass<Hello> to be seen by the compiler. I am intending to have a go at writing probably several passes that will attempt a SPIN-like code to code transformation that turns llvm bitcode into another piece of llvm bitcode that, when run, has the effect of model-checking the original program. I won't get much done if I can't make any of my passes work, of course, so any tips would be gratefully appreciated at this point! (I'm using the LLVM 2.0 release version). Thank you in advance, Sarah
Devang Patel
2007-Jul-25 21:02 UTC
[LLVMdev] Writing a pass for the opt tool: likely documentation bug
Sarah, We have Hello pass in svn at lib/Transforms/Hello This is a working example. I will update documentation to include "char Hello::ID = 0". On Jul 25, 2007, at 1:51 PM, Sarah Thompson wrote:> Hi, > > I'm currently attempting to implement a pass that will hopefully run > under the opt tool. Currently, I'm having some difficulties -- the > sample code for the Hello pass (see > http://llvm.org/docs/WritingAnLLVMPass.html) doesn't work. The first > error is that the section starting 'As a while, the cpp file looks > like:' omits the declaration for char Hello::ID = 0 that is given > separately above. If you add this, opt still fails with the message: > > opt: /usr/local/rse/llvm/src/lib/VMCore/Pass.cpp:158: void > <unnamed>::PassRegistrar::RegisterPass(llvm::PassInfo&): Assertion > `Inserted && "Pass registered multiple times!"' failed. > > which appears to be triggered by the RegisterPass<Hello> X... line > in the source (the error disappears if you comment that line out, > though for obvious reasons the pass won't work if you do that). I've > checked, there definitely isn't anything weird going on that would > cause more than one instance of RegisterPass<Hello> to be seen by > the compiler.This may happen if either you're sharing ::ID for two passes or you're registering Hello twice. - Devang> > > I am intending to have a go at writing probably several passes that > will attempt a SPIN-like code to code transformation that turns llvm > bitcode into another piece of llvm bitcode that, when run, has the > effect of model-checking the original program. I won't get much done > if I can't make any of my passes work, of course, so any tips would > be gratefully appreciated at this point! > > (I'm using the LLVM 2.0 release version). > > Thank you in advance, > Sarah > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reid Spencer
2007-Jul-25 21:20 UTC
[LLVMdev] Writing a pass for the opt tool: likely documentation bug
It can also happen if you link *anything* from LLVM into the Hello.so. Don't do that :) Reid. On Wed, 2007-07-25 at 14:02 -0700, Devang Patel wrote:> Sarah, > > We have Hello pass in svn at > > lib/Transforms/Hello > > This is a working example. I will update documentation to include > "char Hello::ID = 0". > > On Jul 25, 2007, at 1:51 PM, Sarah Thompson wrote: > > > Hi, > > > > I'm currently attempting to implement a pass that will hopefully run > > under the opt tool. Currently, I'm having some difficulties -- the > > sample code for the Hello pass (see > > http://llvm.org/docs/WritingAnLLVMPass.html) doesn't work. The first > > error is that the section starting 'As a while, the cpp file looks > > like:' omits the declaration for char Hello::ID = 0 that is given > > separately above. If you add this, opt still fails with the message: > > > > opt: /usr/local/rse/llvm/src/lib/VMCore/Pass.cpp:158: void > > <unnamed>::PassRegistrar::RegisterPass(llvm::PassInfo&): Assertion > > `Inserted && "Pass registered multiple times!"' failed. > > > > which appears to be triggered by the RegisterPass<Hello> X... line > > in the source (the error disappears if you comment that line out, > > though for obvious reasons the pass won't work if you do that). I've > > checked, there definitely isn't anything weird going on that would > > cause more than one instance of RegisterPass<Hello> to be seen by > > the compiler. > > This may happen if either you're sharing ::ID for two passes or you're > registering Hello twice. > > - > Devang > > > > > > > I am intending to have a go at writing probably several passes that > > will attempt a SPIN-like code to code transformation that turns llvm > > bitcode into another piece of llvm bitcode that, when run, has the > > effect of model-checking the original program. I won't get much done > > if I can't make any of my passes work, of course, so any tips would > > be gratefully appreciated at this point! > > > > (I'm using the LLVM 2.0 release version). > > > > Thank you in advance, > > Sarah > > > > > > _______________________________________________ > > LLVM Developers mailing list > > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Apparently Analagous Threads
- [LLVMdev] Writing a pass for the opt tool: likely documentation bug
- [LLVMdev] Writing a pass for the opt tool: likely documentation bug
- [LLVMdev] LLVM Hello Pass load error when using opt -load Hello.so
- [LLVMdev] Problems creating a pass
- [LLVMdev] LLVM Hello Pass load error when using opt -load Hello.so