Reid Spencer
2004-Aug-24 16:20 UTC
[LLVMdev] Support/CommandLine.h exposed through Pass.h?
Hi, In writing llvmc, I need to link in the Bytecode reader in order to extract the "dependent libraries" from the bytecode files. And, bytecode reader needs vmcore. And, vmcore has a static cl::opt<bool> named "EnableTiming" for the -time-passes option. This conflicts at runtime with llvmc's -time-passes option (which it passes through to sub-tools). So, my solution is to declare the EnableTiming global var in Pass.h, remove its "static" keyword in Pass.cpp and expose "Support/CommandLine.h" in Pass.h. This compiles and works fine in all tools, but its a bit gross to expose CommandLine.h via Pass.h. Anyone object? An alternative is to remove EnableTiming from VMCore completely (it really doesn't belong there) and have callers pass in a boolean if they want timing. Then each of the tools can define their own option and provide the boolean value as a constructor argument for a Pass? Anyone got any better ideas? Reid. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20040824/a1b24383/attachment.sig>
Reid Spencer
2004-Aug-24 17:35 UTC
[LLVMdev] Support/CommandLine.h exposed through Pass.h?
On Tue, 2004-08-24 at 10:39, Chris Lattner wrote:> On Tue, 24 Aug 2004, Reid Spencer wrote: > > > So, my solution is to declare the EnableTiming global var in Pass.h, > > remove its "static" keyword in Pass.cpp and expose > > "Support/CommandLine.h" in Pass.h. This compiles and works fine in all > > tools, but its a bit gross to expose CommandLine.h via Pass.h. > > > > Anyone object? > > Yes, I do. :) Check out how -debug is handled. In particular, the > CommandLine library supports the idea of "external storage", which will > allow you to just put a bool in the header, and have the command line > option set the bool. This is described in the CommandLine documentation > as well.Ah, okay. That makes sense. Will do.> > -Chris-------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20040824/f01d426c/attachment.sig>
Chris Lattner
2004-Aug-24 17:39 UTC
[LLVMdev] Support/CommandLine.h exposed through Pass.h?
On Tue, 24 Aug 2004, Reid Spencer wrote:> In writing llvmc, I need to link in the Bytecode reader in order to > extract the "dependent libraries" from the bytecode files. And, bytecode > reader needs vmcore. And, vmcore has a static cl::opt<bool> named > "EnableTiming" for the -time-passes option. This conflicts at runtime > with llvmc's -time-passes option (which it passes through to > sub-tools).Ok.> So, my solution is to declare the EnableTiming global var in Pass.h, > remove its "static" keyword in Pass.cpp and expose > "Support/CommandLine.h" in Pass.h. This compiles and works fine in all > tools, but its a bit gross to expose CommandLine.h via Pass.h. > > Anyone object?Yes, I do. :) Check out how -debug is handled. In particular, the CommandLine library supports the idea of "external storage", which will allow you to just put a bool in the header, and have the command line option set the bool. This is described in the CommandLine documentation as well. -Chris -- http://llvm.org/ http://nondot.org/sabre/
Apparently Analagous Threads
- [LLVMdev] Support/CommandLine.h exposed through Pass.h?
- [LLVMdev] llvmc - Compiler Driver - Status Update & Issues
- [LLVMdev] 2.5 Pre-release1 available for testing
- [LLVMdev] API changes (was Antw.: 2.0 Pre-release tarballs online)
- Re: <qemu:commandline> domain XML tag is not working?