[cfe-users] Is it possible to translate or forward flags from clang to llc?

Massimiliano Culpo via cfe-users cfe-users at lists.llvm.org
Wed Nov 27 02:36:50 PST 2019


I'm looking into what could be the best way to add compiler flags for Clang
to emit optimized code for a specific chip on a given architecture.

Looking at various sources I saw that:

   - llc -march=<architecture> -mcpu=help

returns the list of the supported cpus which is already helpful. The piece
of information I'm currently missing is how to translate llc's flags like:

   - `-march=x86-64 -mcpu=broadwell`
   - `-march=aarch64 -mattr=+v8.1a,+fp-armv8,+neon,+crc,+crypto`

etc. into something that is understood by clang.

In case the context for doing this is of interest, I'm a core developer of
a package manager focused on HPC (https://github.com/spack/spack) and we'll
use this information to automatically inject optimization flags when
installing application from sources based on the chip selected by the user.

Massimiliano Culpo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20191127/f615e117/attachment.html>

More information about the cfe-users mailing list