[LLVMdev] Pass Scheduling Information without using opt

Ralf Karrenberg Chareos at gmx.de
Mon Jul 27 01:43:10 PDT 2009


Daniel Dunbar wrote:
> Ah, in this case llvm_shutdown isn't what you are looking for. I've
> never looked at the Statistic implementation so I can't be any help
> here, but if you poke around starting with "llvm/ADT/Statistic.h" you
> may find a way to do what you want.
I looked into that already, but Statistic.h only gives me the
possibility to implement tracking and printing of my own statistics.
What I want should be located somewhere in the PassManagers, but I do
not find anything helpful. DbgInfoPass only prints out the cfg, same for
CFGPrinterPass (which I can do better by using viewCFG() anyways).
I also found PMDataManager::dumpPassInfo(), but could not get any
information out of it - however, I am also not sure how to use it
correctly and I guess it will probably also not provide statistics about
the PassManager run as a whole.

Here is some example code that describes what I am doing:

MyPass : ModulePass {

bool runOnModule(mod) {

for some Functions f in mod {
(do some stuff)

ExistingModuleProvider mp(mod);
FunctionPassManager* fpm =
new FunctionPassManager(&mp);

fpm->add(createLowerSwitchesPass());
fpm->add(createBreakCriticalEdgesPass());
fpm->add(createLoopSimplifyPass());

fpm2->run(*f);

mp.releaseModule();

(do more stuff)
}

}

}


Now what I want to have is some runtime-output of the pass manager that
tells me what passes were run in what order, give me timing information
if possible etc.

I hope my explanation is better this time :).

Cheers,
Ralf



More information about the llvm-dev mailing list