Trevor Harmon
2010-Jun-30 23:41 UTC
[LLVMdev] Warnings when using opt for read-only (preserving) passes
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
Nick Lewycky
2010-Jul-01 04:10 UTC
[LLVMdev] Warnings when using opt for read-only (preserving) passes
Trevor Harmon wrote:> 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?opt -disable-output ... 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 > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
Trevor Harmon
2010-Jul-02 20:40 UTC
[LLVMdev] Warnings when using opt for read-only (preserving) passes
On Jun 30, 2010, at 9:10 PM, Nick Lewycky wrote:> opt -disable-output ...Thanks, that works nicely. Any thoughts on why this parameter isn't mentioned in the docs (http://llvm.org/cmds/opt.html ) or in the "opt --help" output? Was it just an oversight? Trevor
Reasonably Related Threads
- [LLVMdev] Warnings when using opt for read-only (preserving) passes
- [LLVMdev] Controlling the order of a FunctionPass
- [LLVMdev] Controlling the order of a FunctionPass
- [LLVMdev] Controlling the order of a FunctionPass
- [LLVMdev] modulepass requiring a functionpass