[LLVMdev] Warnings when using opt for read-only (preserving) passes
Trevor Harmon
Trevor.W.Harmon at nasa.gov
Wed Jun 30 16:41:46 PDT 2010
Hi,
I've written a FunctionPass that happens to be read-only (preserving):
It doesn't modify the code in any way; it just does some analysis and
dumps out the results for each function by overriding
FunctionPass::print. I now need to make some changes to the pass, and
these changes will mean that the results cannot be known until all
functions have been visited. So there's no longer anything to do in
FunctionPass::print. Instead I only need to call printf in
FunctionPass::doFinalization to dump the final results.
This presents a minor problem. Taking out FunctionPass::print causes
"opt -analyze ..." to give warnings: "Pass::print not implemented for
pass!" Okay, makes sense, but when I take out the -analyze parameter,
I get another warning: "WARNING: You're attempting to print out a
bitcode file ..." This also makes sense, because opt assumes my pass
has modified the code in some way, so it's trying to output the
modifications.
But how can I get rid of these warnings? I can suppress the second one
by adding "2> /dev/null" to the opt command, but that suppresses the
entire error stream, which isn't good. I also tried converting my
FunctionPass into a ModulePass, and iterating over the functions
manually, but I ran into problems because I can't seem to require a
function pass, such as UnifyFunctionExitNodes, to run on a function if
I'm within a ModulePass.
Any other suggestions? Thanks,
Trevor
More information about the llvm-dev
mailing list