[llvm] [CommandLine] Set the 'ValueStr' with the selected argument (PR #90816)
Bill Wendling via llvm-commits
llvm-commits at lists.llvm.org
Fri May 3 11:27:33 PDT 2024
bwendling wrote:
> Thanks for the test. However, it is still not clear to me what the motivation for the change was. Maybe similar changes should be made to the specializations of the `cl::parser` class?
I'm doing this for an upcoming change where I want to know which register allocator is used (if it's not the "greedy" allocator, we won't support the change). I know it's a bit of a hack, but it's the best we can do without a rewrite of a large part of ISel and other places. (I can add you to the PR when I create it.)
As for other similar changes, it looks like all of the other fields are filled out correctly.
> Should the change be reflected in the [documentation](https://llvm.org/docs/CommandLine.html)?
Maybe? To be honest, I was surprised that it wasn't available in the situation I'm working with. In the case of the `-regalloc=<name>` flag, it doesn't have an enum, just its own parser that has the list of registered allocators in it. The "value" set (in the non-`ValueStr` field) is a pointer to the constructor for that register allocator, but we don't have access to the original `<name>` in the flag. That *should* be in the `ValueStr` field (if I understand correctly). So it's kinda fixing a deficiency IMO... If you want me to add it to the documentation, I'm fine with that. Just let me know which section is good. :-)
https://github.com/llvm/llvm-project/pull/90816
More information about the llvm-commits
mailing list