[LLVMdev] Patch: Prefix for ParseCommandLineOptions()

Chris Lattner clattner at apple.com
Mon Mar 9 13:54:11 PDT 2009


On Mar 9, 2009, at 9:43 AM, Alexei Svitkine wrote:

> I like your predicate idea - that could solve both #1 and #2.
>
> I'm wondering whether it would be possible to get the predicate stuff
> automatically somehow - based on which library an option is coming
> from. Something like looking at the path in __FILE__.

We do something similar with the DEBUG macro.  Users #define a  
DEBUG_TYPE at the top of the .cpp file, and all DEBUG macros are keyed  
to it.

> Then we could simply enable/disable any options based on their library
> of origin (i.e. as in, one of the --libs out of llvm-config --libs).
> Provided each backend is in its own library, this would work.
>
> In your example, "llc -march=x86 --help", what would happen is this:
>
> First, everything is enabled. When "-march=x86" is processed, it will
> disable all backends except for x86. When --help is then processed, it
> will only list enabled options - i.e. and thus exclude the other
> backends.

That would make sense.

> For my use, I would do something like this:
>
> Disable options from any llvm-config --libs I'm linking against that I
> don't care about. (Perhaps a utility function can be added to disable
> everything, and then I can just enable what I'm interested in).

Ok.

-Chris



More information about the llvm-dev mailing list