I'm implementing a LLVM pass, and would like to turn some options on or off via the command line, especially I'd like to have a -v verbose mode for my pass.
I couldn't find a mechanism for passing command line flags mentioned in any of the docs, does one exist?
The solution I found is to use LLVM's general CommandLine API: http://llvm.org/docs/CommandLine.html
Works as expected in opt
when loading the pass dynamically.
Another useful trick is:
#define DEBUG_TYPE "my-special-name"
...
#include "llvm/Support/Debug.h"
...
Sprinkle a bunch of debug output around:
DEBUG(dbgs() << "Original Frame Size: " << FrameSize << "\n" );
...
DEBUG(Node->dump(CurDAG));
Then, on the command line: ... -debug-only my-special-name ... will get your output.
If your pass is run with the clang front end, you can use:
... -mllvm -debug-only my-special-name ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With