[PATCH] D137516: [TargetSupport] Move TargetParser API in a separate LLVM component.

Sam Elliott via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 7 07:44:14 PST 2022


lenary added a comment.

I'm not convinced we should be leaving any of the other Target Parser information in Support, if we are doing this, though this creates layering issues which I've been trying to unpick.

If you try to take `llvm/Support/*TargetParser*`, you find a few places where there are dependencies from these files to other bits of Support:

- `llvm/Support/Host` has lots of logic for turning cpu information into a target, to handle `-mcpu=native`. My opinion is that should also move into target parser. There are some parts of this file that can move into other parts of `llvm/Support`, like the introspection about number of cores.
- `llvm/{Support/ADT}Triple` depends on the Arm/AArch64 target parsers (because arm triples canonically look like `armv7a-…` or similar, and we use the targetparser to help canonicalise the triple). My opinion is that all this code can move into the target parser.

There are quite a few small cleanup patches to enable this. One of the biggest is that `llvm/Support/CommmandLine` wants to know the current triple and CPU for `--version`, even in e.g. tablegen. This was the change I most struggled with, but I think I have a solution that does the job fine.

I'm going to try to polish and post my patch set this week which does this split, as a comparison to this one.

Re the name: "TargetParser" seems reasonable to me, given that's what we've called the files so far anyway.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137516



More information about the cfe-commits mailing list