Hello LLVM,<br><br>I am following the document "Writing an LLVM Pass". When I ran "opt -load ../../../Debug/lib/MyPass.so -mypass < hello.bc > /dev/null" I got the next error:<br><br>***@ubuntu:~/test$ opt -load ../../llvm/Debug/lib/MyPass.so -mypass < hello.bc > /dev/null<br>
opt: Pass.cpp:159: void<unnamed>::PassRegistrar::RegisterPass(const llvm::PassInfo&): Assertion `Inserted && "Pass registered multiple times!"' failed.<br>Aborted<br><br>To compile MyPass I used "make" command instead of "gmake", could it be the problem? Or maybe I just type (copy) something wrong? Could someone take a look of my files and point my errors out? <br>
<br>Thanks in advance,<br><br> Juan Carlos<br><br>*****************<br>*** Makefile ***<br>*****************<br>
LEVEL = ../../..<br>LIBRARYNAME = MyPass<br>LOADABLE_MODULE = 1<br>LLVMLIBS = LLVMCore.a LLVMSupport.a LLVMSystem.a<br>include $(LEVEL)/Makefile.common<br><br>**********************<br>
*** MyPass.cpp ***<br>**********************<br>

#include "llvm/Pass.h"<br>#include "llvm/Function.h"<br>#include "llvm/Support/raw_ostream.h"<br><br>using namespace llvm;<br><br>namespace {<br>struct MyPass : public FunctionPass {<br><br>
    static char ID;<br>        MyPass() : FunctionPass(&ID) {}<br><br>         virtual bool runOnFunction(Function &F) {<br>           errs() << "MyPass: " << F.getName() << "\n";<br>
           return false;<br>         }<br>       };  // end of struct MyPass<br><br>char MyPass::ID = 0;<br>RegisterPass<MyPass> X("mypass", "My first Pass",<br>                      false /* Only looks at CFG */,<br>
                      false /* Analysis Pass */);<br>}  // end of anonymous namespace<br><br><br>-- <br>Juan Carlos<br>