Hi! I'd like to analyze a function with the llvm::LoopInfo pass and then write some info to disk. I create a FunctionPassManager and insert it and a DominatorTree which is required by LoopInfo. As it turns out the analysis info is only available to other passes and gets cleared when the run function of the pass manager returns. I therefore guess that I need to create an own pass. Is this correct? This means that I also have to register it using llvm::RegisterPass but it will be of no use to other passes. Therefore I ask if this is the way to go. - Jochen
On Thursday 11 March 2010 12:36:55 Jochen Wilhelmy wrote:> Hi! > > I'd like to analyze a function with the llvm::LoopInfo pass and then > write some info to disk. I create a FunctionPassManager and insert it and > a DominatorTree which is required by LoopInfo. > As it turns out the analysis info is only available to other > passes and gets cleared when the run function of the pass manager returns. > I therefore guess that I need to create an own pass. > Is this correct? > This means that I also have to register it using llvm::RegisterPass but > it will > be of no use to other passes. > Therefore I ask if this is the way to go.If I understand what you're saying, yes. You need to create a pass that depends on LoopInfo. Your getAnalysisUsage implementation should add LoopInfo as required. Then you can perform a getAnalysis<LoopInfo>() to get at it and dump whatever you need to disk. I'm not sure what you mean by this new pass being of no use to other passes. It's not generating any new information about the program (or if it is, it's writing it to disk), so other passes wouldn't need it anyway. -Dave
Hi!> I'm not sure what you mean by this new pass being of no use to other passes. > It's not generating any new information about the program (or if it is, it's > writing it to disk), so other passes wouldn't need it anyway. >So I know that I'm on the right way. I just think it's a bit of overhead implementing an own pass and register it using llvm::RegisterPass can the PassArg of RegisterPass clash with other passes? or can I just do static RegisterPass<MyPass> tmp("foo", "My Pass"); ? -Jochen
Maybe Matching Threads
- [LLVMdev] how to access loopInfo
- [LLVMdev] how to access loopInfo
- [LLVMdev] 2.9 segfault when requesting for both LoopInfo and DominatorTree analyses.
- [LLVMdev] 2.9 segfault when requesting for both LoopInfo and DominatorTree analyses.
- [LLVMdev] 2.9 segfault when requesting for both LoopInfo and DominatorTree analyses.