Hi> One would expect this, its a facility of the C++ language. The anonymous > namespace is, essentially, the same as declaring everything in it > static. That is, the symbols are not exported and not available for > linking.Yes, it was pretty clear after finding out that this isn't a linking error which i suspected...> > So for all those trying to add an analysis path: > > * add the object name to the USEDLIBS variable in the tools/llc/Makefile > > * use the llvm namespace instead of anonyous > > These statements are only true if you're adding an analysis pass to > LLVM. If the pass is for use outside of LLVM then you want to:<snip> Yes, but this is already documented on the Website and works really well :-).> > This mail is intended as references for people using the search engines, > > prior to asking questions :-). But maybe this information could also be > > added to http://llvm.org/docs/WritingAnLLVMPass.html? > > Such a patch would be readily accepted.Ok, if i get my pass flying i'll write s.t. unfortunatly i hit another roadblock: Everthing now compiles fine, but when running llc with invoking my own backend derived from the cbackend i get the following error: llc -f -march my_backend a.out.bc llc: PassManagerT.h:387: void llvm::PassManagerT<Trait>::markPassUsed(const llvm::PassInfo*, llvm::Pass*) [with Trait = llvm::MTraits]: Assertion `getAnalysisOrNullUp(P) && dynamic_cast<ImmutablePass*>(getAnalysisOrNullUp(P)) && "Pass available but not found! " "Perhaps this is a module pass requiring a function pass?"' failed. llc((anonymous namespace)::PrintStackTrace()+0x1f)[0x880791f] /lib/tls/libc.so.6(abort+0x1d2)[0xb7d00fa2] /lib/tls/libc.so.6(__assert_fail+0x10f)[0xb7cf92df] llc(llvm::PassManagerT<llvm::MTraits>::markPassUsed(llvm::PassInfo const*, llvm::Pass*)+0xf6)[0x8736c36] Aborted The requirements of this pass are quite modest: void MParSchedule::getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); } The Header looks of this pass looks like this: namespace llvm { class MParSchedule : public BasicBlockPass { public: virtual bool runOnBasicBlock(BasicBlock &B); void getAnalysisUsage(AnalysisUsage &AU) const; virtual void releaseMemory(); map<const BasicBlock *,list<Schedule*> *> BlockSchedule; list<Schedule*>* lookupBasicBlock(BasicBlock *); private: bool in_ValueList(Value *val); list<const Value*> ValueList; list<Instruction*> InstructionList; }; }; It gets Registered in the cpp file via: RegisterAnalysis<MParSchedule> X("MParSchedule","Maximal Parallel Schedule"); This pass has been tested as optimization pass with opt, and everything worked in this configuration. Thanks ST
On Tue, 30 May 2006, Silken Tiger wrote:> Everthing now compiles fine, but when running llc with invoking my own backend > derived from the cbackend i get the following error: > namespace llvm { > class MParSchedule : public BasicBlockPass { > public:> This pass has been tested as optimization pass with opt, and everything worked > in this configuration.What requires MParSchedule? Note that, since it's a basic block pass, only other basic block passes can require it. If you have a FunctionPass that requires a BasicBlockPass, it will fail the same was as when a ModulePass requires a FunctionPass. -Chris -- http://nondot.org/sabre/ http://llvm.org/
Fernando Magno Quintao Pereira
2006-May-30 17:51 UTC
[LLVMdev] Adding an object to llc (analysis pass)
Hi. I remember I had some similar problems some weeks ago. My problem was that I was using "makellvm llc" from my working directory, but it caused the libraries to be "unsynchronized". To solve, just make your application from the root directory (e.g.: $HOME/llvm> make).> > Everthing now compiles fine, but when running llc with invoking my own backend > derived from the cbackend i get the following error: > > llc -f -march my_backend a.out.bc > llc: PassManagerT.h:387: void llvm::PassManagerT<Trait>::markPassUsed(const > llvm::PassInfo*, llvm::Pass*) [with Trait = llvm::MTraits]: Assertion > `getAnalysisOrNullUp(P) && > dynamic_cast<ImmutablePass*>(getAnalysisOrNullUp(P)) && "Pass available but > not found! " "Perhaps this is a module pass requiring a function pass?"' > failed. > llc((anonymous namespace)::PrintStackTrace()+0x1f)[0x880791f] > /lib/tls/libc.so.6(abort+0x1d2)[0xb7d00fa2] > /lib/tls/libc.so.6(__assert_fail+0x10f)[0xb7cf92df] > llc(llvm::PassManagerT<llvm::MTraits>::markPassUsed(llvm::PassInfo const*, > llvm::Pass*)+0xf6)[0x8736c36] > Aborted >
Hi Am Dienstag, 30. Mai 2006 19:21 schrieb Chris Lattner:> On Tue, 30 May 2006, Silken Tiger wrote: > > Everthing now compiles fine, but when running llc with invoking my own > > backend derived from the cbackend i get the following error: > > namespace llvm { > > class MParSchedule : public BasicBlockPass { > > public: > > > > This pass has been tested as optimization pass with opt, and everything > > worked in this configuration. > > What requires MParSchedule? Note that, since it's a basic block pass, > only other basic block passes can require it. If you have a FunctionPass > that requires a BasicBlockPass, it will fail the same was as when a > ModulePass requires a FunctionPass.void MParSchedule::getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); } MParSchedule requires nothing and changes nothing. So hopefully the above code represents this fact? I also did an make clean && make in my llvm root directory to check if this is a build system problem. Which it is not. For easier reference i just attached the files of this pass to this mail. They are under GPL. Best Regards ST -------------- next part -------------- A non-text attachment was scrubbed... Name: Makefile Type: text/x-makefile Size: 213 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20060531/7e6564ec/attachment.bin> -------------- next part -------------- A non-text attachment was scrubbed... Name: MParSchedule.cpp Type: text/x-c++src Size: 3950 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20060531/7e6564ec/attachment.cpp> -------------- next part -------------- A non-text attachment was scrubbed... Name: ScheduleList.h Type: text/x-chdr Size: 300 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20060531/7e6564ec/attachment.h> -------------- next part -------------- A non-text attachment was scrubbed... Name: MParSchedule.h Type: text/x-c++hdr Size: 605 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20060531/7e6564ec/attachment-0001.h>