Is it possible to translate or forward flags from clang to llc?


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= -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 ( 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