MaskRay wrote: > Code LG and we can do this short/medium-term, though I'm somewhat unsure > about the long-term direction here. > > So far library options have in common that they are always available (when > the library is linked). Tool options (MC, CodeGen) need to opt in by the > tool. I'm wondering whether a better approach would be for the tool to > include MCToolOptions.td itself and use it for its own option parser (once > also migrated away from cl::opt) instead of deferred dynamic registration > with the library options. > > Right now library options register themselves using global ctors, which I > think is not an ideal end state: they still require 50-100 ctors and they > still need to dynamically add all options to a hash map before parsing > options, which is expensive. Given that the constructed hash table is the > same in almost all cases, we could in the end generate the hash table at > build time.
If we want to drop the process-wide registry `RegisterMCToolOptions`, we can add a new cl::parseCommandLineOptions overload with a `ToolOptions` parameter to indicate the tool options (prototype: #240009, which touches 32 files, so it stays separate). https://github.com/llvm/llvm-project/pull/239920 _______________________________________________ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
