dump cfg after each pass

A dumb question – is there a way to dump cfg after each pass, something like: --print-cfg-after=sccp, or is there a standard post-processing script that builds the cfg vcg/dot file from the ir dump?

Thanks,

David

Hi David,

A dumb question -- is there a way to dump cfg after each pass, something like:
--print-cfg-after=sccp, or is there a standard post-processing script that
builds the cfg vcg/dot file from the ir dump?

if your IR is dumped to ir.ll, you can do this to see the cfg:
   opt -disable-output -view-cfg ir.ll
You may want to use -view-cfg-only rather than -view-cfg if you are
not interested in the instructions, only the cfg. You could probably
also do something like the following to output the cfg after each pass:
   opt -pass1 -view-cfg -pass2 -view-cfg ... -passN -view-cfg file.ll

Ciao,

Duncan.

You can use to create a dot file of everyfunction for an normal llvm-ir.ll file.

opt -dot-cfg llvm-ir.ll

If you store the dump in a file and use dot this should achieve what you want.

Cheers
Tobi

Thanks for the tip. It works.

David

Yes, this works – without invoking the viewer.

Thanks,

David