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>
On Wed, 31 May 2006, Silken Tiger wrote:>> 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?Right it does. However, does something *else* require MParSchedule? If so, what? -Chris> 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 >-Chris -- http://nondot.org/sabre/ http://llvm.org/
Hi> Right it does. However, does something *else* require MParSchedule? If > so, what?Ok, i am writing on a different backend based on the cbackend. The test usage of this pass looks like this: void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired<LoopInfo>(); AU.addRequired<MParSchedule>(); AU.setPreservesAll(); } and then in the runOnFunction pass of this backend: LI = &getAnalysis<LoopInfo>(); MParSchedule &MPar = getAnalysis<MParSchedule>(); lowerIntrinsics(F); printFloatingPointConstants(F); F.renameLocalSymbols(); list<Schedule *>* ScheduleList; Schedule *currentSchedule; for (Function::iterator i = F.begin(), e = F.end(); i != e; ++i) { for(BasicBlock::iterator j=i->begin(),bbe=i->end();j!=bbe;++j) { BasicBlock *bb; if((bb=dyn_cast<BasicBlock>(j))) { ScheduleList=MPar.lookupBasicBlock(bb); if(ScheduleList) { cerr<<"Schedule List: "<<bb->getName()<<endl; for(list<Schedule*>::iterator lsi=ScheduleList->begin(),lse=ScheduleList->end();lsi!=lse;++lsi) { cerr<<(*lsi)->cycle<<" "<<(*(*lsi)->instr); } cerr<<endl; } else cerr<<"Schedule not found"<<endl; } else cerr<<"Instruction not a basic block"<<endl; } } return false; Compiling and linking works fine but llc -f -march my_backend a.out.bc gives this error: 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)[0xb7da7fa2] /lib/tls/libc.so.6(__assert_fail+0x10f)[0xb7da02df] llc(llvm::PassManagerT<llvm::MTraits>::markPassUsed(llvm::PassInfo const*, llvm::Pass*)+0xf6)[0x8736c36] Aborted Poking around i tried to inherit the MParSchedule Pass from ImmutablePass then i get an different error: llc: /work0/tstone/llvm-1.7/include/llvm/Pass.h:185: AnalysisType& llvm::Pass::getAnalysisID(const llvm::PassInfo*) const [with AnalysisType = llvm::FindUsedTypes]: Assertion `i != AnalysisImpls.size() && "getAnalysis*() called on an analysis that was not " "'required' by pass!"' failed. llc((anonymous namespace)::PrintStackTrace()+0x1f)[0x8807aaf] /lib/tls/libc.so.6(abort+0x1d2)[0xb7d98fa2] /lib/tls/libc.so.6(__assert_fail+0x10f)[0xb7d912df] llc(llvm::FindUsedTypes& llvm::Pass::getAnalysisID<llvm::FindUsedTypes>(llvm::PassInfo const*) const+0xa5)[0x8173da5] [0x8995e54] make: *** [a.out.s] Aborted Thanks for your help ST