@target_clones ala clang?

Johan j at j.nl
Sun Apr 13 18:37:49 UTC 2025


On Sunday, 13 April 2025 at 18:09:03 UTC, Bruce Carneal wrote:
> Is implementing a clang style @target_clones capability for LDC 
> a big ask?

Yes I believe this is a lot of work.
Generating multiple functions out of the same source with 
different target settings is probably fairly easy (if not 
trivial). The problem is generating the ifunc resolver function. 
I looked into this when @target was added. It is unfortunate that 
the ifunc resolver function code (with all the complexity of 
which target attribute should be tested first) is all in clang 
library, not in LLVM library.
If one would want to implement it, my proposal would be to get 
into LLVM and convince clang/LLVM to move the target attribute 
and ifunc resolver code into the LLVM library, such that it can 
be used by more frontends than just clang.

-Johan



More information about the digitalmars-d-ldc mailing list