-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, I try to write a tool that uses the PassManager to load profiling information for a module like this: ... ModulePass *LoaderPass = createProfileLoaderPass(); PassMgr.add(LoaderPass); PassMgr.run(*M); ... I can verify that the pass was run, but how to I get to the ProfileInfo implemented by that pass? I tried ... ProfileInfo PI = LoaderPass->getAnalysis<ProfileInfo>(); ... but this does not seem to return the correct profiling information. Thanks, Andi -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkonn0sACgkQPiYq0rq7s/AqawCgjwS5F8z33kjO/cFuDc/CcBeC d+UAn2ZXnqTCOAVO0Ib1Qu/QvEDO7wmG =0cmm -----END PGP SIGNATURE-----
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Okay, found it: Andreas Neustifter wrote:> I try to write a tool that uses the PassManager to load profiling > information for a module like this: > > ... > ModulePass *LoaderPass = createProfileLoaderPass(); > PassMgr.add(LoaderPass); > PassMgr.run(*M); > ... > > I can verify that the pass was run, but how to I get to the ProfileInfo > implemented by that pass? > > I tried > > ... > ProfileInfo PI = LoaderPass->getAnalysis<ProfileInfo>(); > ... > > but this does not seem to return the correct profiling information.I have writen a small pass that just does what I need: namespace { class LoaderInterface : public ModulePass { ProfileInfo *PI; public: static char ID; // Class identification, replacement for typeinfo explicit LoaderInterface() : ModulePass(&ID) {} virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); AU.addRequired<ProfileInfo>(); } ProfileInfo* getPI() { return PI; } bool runOnModule(Module &M) { PI = &getAnalysis<ProfileInfo>(); return false; } }; } char LoaderInterface::ID = 0; So now I can just use the pass as expected: .... PassManager PassMgr = PassManager(); PassMgr.add(createProfileLoaderPass()); LoaderInterface *LI = new LoaderInterface(); PassMgr.add(LI); PassMgr.run(*M); ProfileInfo *PI = LI->getPI(); .... Andi -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkon5dUACgkQPiYq0rq7s/BB/gCfQEaRL5ZrAralWrYFnnkO7heU v6kAnR+HLruRNj/IGoTh8ud//U1xHBMc =jC9S -----END PGP SIGNATURE-----
Maybe Matching Threads
- [LLVMdev] Loading ProfileInfo
- [LLVMdev] Loading ProfileInfo in Backend. (Was: [PATCH] & Question: Preserving ProfileInfo for backend.)
- [LLVMdev] Loading ProfileInfo
- [LLVMdev] Loading ProfileInfo in Backend. (Was: [PATCH] & Question: Preserving ProfileInfo for backend.)
- [LLVMdev] [Fwd: Can someone help me with error while i make my own pass]