<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
Hello,<div>my name is Marc. I wrote a llvm function pass by using the "hello world" tutorial. But this selfwritten pass (GA_VHDL_Pass) dependes on another function pass (GenomePass). GenomePass also dependes on two other function passes. The Pass GenomePass generates an object, which is used in my GA-VHDL_Pass.</div><div><br></div><div>When I compile my Make file I always get this error message:</div><div><br></div><div><div>/work0/llvm-2.2/Debug/bin/opt --load /work0/llvm-2.2/Debug/lib/MParSchedule.so --load /work0/llvm-2.2/Debug/lib/LLVMblockNrs.so --load /work0/llvm-2.2/Debug/lib/Genome.so --load /work0/llvm-2.2/Debug/lib/GA_VHDL_Pass.so -GA_VHDL_Pass -mem2reg -verify -f -o opt.o a.out.bc</div><div>opt: Pass.cpp:157: void<unnamed>::PassRegistrar::RegisterPass(llvm::PassInfo&): Assertion `Inserted && "Pass registered multiple times!"' failed.</div><div>make: *** [opt.o] Aborted</div></div><div><br></div><div>I do not find the problem causing this, so perhaps some of you know the problem and a good solution.</div><div><br></div><div>Here is the written Code of GA_VHDL_Pass:</div><div><br></div><div><div>//#include "llvm/Pass.h"</div><div>//#include "llvm/Function.h"</div><div>#include "../../Analysis/genome/GenomePass.cpp"</div><div><br></div><div>using namespace llvm;</div><div><br></div><div>namespace llvm{</div><div>class GA_VHDL_Pass: public FunctionPass {</div><div> private:</div><div> GenomePass* GP;</div><div> Genome* fitG;</div><div> public:</div><div> static char ID; // Pass identification, replacement for typeid</div><div> GA_VHDL_Pass() : FunctionPass((intptr_t)&ID) {}</div><div> virtual bool runOnFunction(Function &F) {</div><div> GP = &getAnalysis<GenomePass>();</div><div> fitG=GP->lookup(&F);</div><div> std::cerr<<"test"<<endl;</div><div><br></div><div> return false;</div><div> }</div><div><br></div><div> virtual void getAnalysisUsage(AnalysisUsage &AU) const {</div><div> AU.addRequired<GenomePass>();</div><div> };</div><div> };</div><div><br></div><div><br></div><div> char GA_VHDL_Pass::ID = 0;</div><div>}</div><div>namespace{</div><div> RegisterPass<GA_VHDL_Pass> X("GA_VHDL_Pass", "Create VHDL-Code out of a genome",false);</div><div>}</div></div><div><br></div><div><br></div><div>Followed by the Makefile:</div><div><br></div><div><div>RELEASE=$(shell /work0/llvm-2.2/Debug/bin/llvm-config --build-mode)</div><div>.PHONY: opt_out</div><div>.PHONY: opt.o.ll</div><div>#.PHONY: opte</div><div>.PHONY: opt.o</div><div><br></div><div><br></div><div>#opt_run:opt.o.s opt.o.ll</div><div>opt_run: opt opt.o.ll cat opt.o.ll</div><div># </div><div><br></div><div>opt.o.ll: opt.o</div><div> /work0/llvm-2.2/$(RELEASE)/bin/llvm-dis -o opt.o.ll opt.o</div><div><br></div><div>opt.o: a.out.bc</div><div> /work0/llvm-2.2/$(RELEASE)/bin/opt --load /work0/llvm-2.2/$(RELEASE)/lib/MParSchedule.so --load /work0/llvm-2.2/$(RELEASE)/lib/LLVMblockNrs.so --load /work0/llvm-2.2/$(RELEASE)/lib/Genome.so --load /work0/llvm-2.2/$(RELEASE)/lib/GA_VHDL_Pass.so -GA_VHDL_Pass -mem2reg -verify -f -o opt.o a.out.bc</div><div><br></div><div>a.out.bc: testpass.c</div><div> /work0/llvm-gcc/install/bin/llvm-gcc -c -emit-llvm testpass.c -o a.out.bc</div><div>clean: </div><div> rm a.out.bc opt.o opt.o.ll</div></div><div><br><div> <span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div>Thanks for your help,</div><div>Marc</div><div><br class="khtml-block-placeholder"></div><div><br class="khtml-block-placeholder"></div><br class="Apple-interchange-newline"></span> </div><br></div></body></html>