[PATCH] D155326: [Clang][lld][RISCV] Passing 'mattr' to lld/llvmgold

Yingwei Zheng via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 14 12:57:35 PDT 2023


dtcxzyw added a comment.

In D155326#4501997 <https://reviews.llvm.org/D155326#4501997>, @jrtc27 wrote:

> Why do you believe this is better than encoding it in the module's IR like the ABI?



- There is no module-level metadata for target CPU and sub-target features. So I just think that this patch is better than merging from **func-level** attributes like D142191 <https://reviews.llvm.org/D142191>.
- Clang passes `-plugin-opt=mcpu` to lld. Then lld builds `lto::Config` using `codegen::getCPUStr` and `codegen::getMAttrs` (both get the result from command args). It is taken for granted that clang passes `-plugin-opt=mattr` down to lld.

If we introduce top-level fields like `target cpu` and `target features`, we should modify a lot of things (clang/llvm/lld). It can take a long time to migrate (like opaque pointers).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D155326



More information about the cfe-commits mailing list