[PATCH] D126226: [OpenMP] Add `-Xoffload-linker` to forward input to the device linker

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 23 12:22:19 PDT 2022


tra added a comment.

In D126226#3532147 <https://reviews.llvm.org/D126226#3532147>, @jhuber6 wrote:

> We already use this approach for the `-Xopenmp-target=<triple> <arg>` option that forwards arguments to the given toolchain, so that's what I was using as a basis.

Yup. I've noticed that. It's unfortunate.

> I'm not sure if I want to hard-code the triple value into the argument itself, since this could theoretically be used for any number of triples, e.g. OpenMP offloading to `ppcle64` and `x86_64`, so it would get a little messy. It's definitely a bit harder to read, but it's a bit of a special-case option so it's to be expected I think.

You do not need to hardcode it. The idea of `JoinedAndSeparate` is that an option `foo` assepts two argumants, one glued to it and another following after a whitespace.
So, when you define an option `-Xoffload-linker-`, and then pass `-Xoffload-linker-nvptx64=foo`, you will get `OPT_offload-linker__` with two arguments. As an example see implementation of `plugin_arg` which deals with the same kind of problem of passing arguments to an open-ended set of plugins.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126226/new/

https://reviews.llvm.org/D126226



More information about the cfe-commits mailing list