[LLVMdev] Writing a pass for the opt tool: likely documentation bug

Sarah Thompson thompson at email.arc.nasa.gov
Wed Jul 25 13:51:50 PDT 2007


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





More information about the llvm-dev mailing list