[PATCH] D19015: [LTO] ensure lto_codegen_debug_options() are passed on to LLVM

Mehdi Amini via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 13 13:40:52 PDT 2016


> On Apr 13, 2016, at 1:29 PM, Rafael EspĂ­ndola <rafael.espindola at gmail.com> wrote:
> 
>> What clang does is instantiate llvm::TargetOptions and fill in the fields
>> directly.  That is a *bad API* because it too closely ties the caller and
>> callee to lock-step revisions.  Clang statically links LLVM so there is
>> no versioning problem, but it is definitely not the right library API.
>> --paulr
> 
> To solve that you need to add a new C only enum or struct. In the same
> way we have lto_codegen_model, we could have lto_codegen_options.

To be clear, by string-based API, I meant key-value not command line to parse. Something like:

set_option("function-section", "1');

With a giant:

if(option == "function-section")
  ...
else if(option == ...)


As I said I'm not fond of it (the enum seems cleaner).


---  
Mehdi



More information about the llvm-commits mailing list