[LLVMdev] (no subject)
Qingan Li
ww345ww at gmail.com
Mon May 30 02:09:50 PDT 2011
Hi,
I wrote an analysis pass, myPass, inherited from both ModulePass and
ProfileInfo, and this pass requires the CallGraph, i.e.,
* class myPass : public ModulePass, public ProfileInfo { ...};*
* void myPass::getAnalysisUsage(AnalysisUsage &AU) const {*
* AU.addRequired<CallGraph>();*
* AU.setPreservesAll();*
*}*
Then, I assumes the UnreachableBlockElim (inherited from FunctionPass)
requires myPass, by revising the related function as follows:
*UnreachableBlockElim::getAnalysisUsage(AnalysisUsage &AU) const { *
* AU.addPreserved<DominatorTree>();*
* AU.addPreserved<ProfileInfo>();*
* AU.addRequired<StaticProfilePass>();*
* *
* }*
Then, i built it, it is OK. I went on to run it. It failed with a segment
error.
By debugging, it is found that in the following code,
*const PassInfo *PI =
PassRegistry::getPassRegistry()->getPassInfo(*I);*
* AnalysisPass = PI->createPass();*
The return value of PassRegistry::getPassInfo(const void *TI) is NULL, thus
the following dereference of PI is invalid.
I am using llvm 2.9, which is download from http://llvm.org/releases/.
Could anybody help me?
--
Best regards,
Li Qingan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110530/9b1e18dd/attachment.html>
More information about the llvm-dev
mailing list