[LLVMdev] [RFC] Removing static initializers for command line options

Chris Bieneman beanz at apple.com
Tue Aug 19 13:00:19 PDT 2014


> On Aug 19, 2014, at 12:32 PM, Rafael Espíndola <rafael.espindola at gmail.com> wrote:
> 
>> I strongly feel this is the wrong decision. If you have a single process using two LLVM clients (say WebKit and Mesa), and they both are using an opt pass with different settings. If the storage is global this will not work.
> 
> That is only an issue if they can set the option at all.
> 
> To summarize, the point is that there are two *very* different types of options
> 
> * Nobs for which there is not a single right answer for all users.
> There are very few of these currently and we expect it to remain like
> that. These should not use cl::opt or static storage at all. They
> should be an option passed to the constructor of the pass.  It may
> also involve exposing it to the C api and the PassManagerBuilder.

How would you suggest we expose cl::opts for modifying these options in tools like opt? A good example of this type of option would be the options in LoopUnrollPass.cpp.

> 
> * Options that we use during development of llvm. They are useful for
> testing, tracking a bug or enabling/disabling a feature that is still
> under development. These can use a static storage since external
> clients like webkit will never change them. We do have to avoid these
> options requiring static constructors, since otherwise the client is
> paying for something it will never use.

What about when we're debugging the WebKit JIT? For development of libraries using LLVM it would be nice to be able to toggle these values too, which is why Filip’s suggestion of an API like LLVMConfigSetBoolValue(Config, "ScalarizeLoadStore", 1) would be nice.

-Chris

> 
> Cheers,
> Rafael





More information about the llvm-dev mailing list