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