[clang] [Clang] Make `-Xarch_` handling generic for all toolchains (PR #125421)

Artem Belevich via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 3 11:09:46 PST 2025


Artem-B wrote:

> Summary: Currently, `-Xarch_` is used to forward argument specially to certain toolchains. Currently, this is only supported by the Darwin toolchain. We want to be able to use this generically, and for offloading too. This patch moves the handling out of the Darwin Toolchain and places it in the `getArgsForToolchain` helper which is run before the arguments get passed to the tools.

I think this could use some editing. `-Xarch` is intended to set flags per *target*. Same toolchain may handle more than one target. Perhaps rephrase along the lines of "forward argument to the toolchain used for the given target architecture"?

> this is only supported by the Darwin toolchain.

This is the confusing part. I'm pretty sure `-Xarch_host` `-Xarch_device` and variety of `-Xarch_{gfx,sm}..` variants are also supported by HIP/Cuda toolchains right now. 

IMO, a better way to describe the situation is that MachO is the last remaining special case implementation of Xarch and the patch folds it into a common `Xarch` handling that's already used by offloading toolchains.


https://github.com/llvm/llvm-project/pull/125421


More information about the cfe-commits mailing list