145 votes

clang : comment lister les architectures cibles supportées ?

Actuellement, je m'intéresse à ARM en général et plus particulièrement aux cibles iphone/Android. Mais je veux juste en savoir plus sur clang, car il semble jouer un rôle important dans les années à venir.

J'ai essayé

clang -cc1 --help|grep -i list
clang -cc1 --help|grep arch|grep -v search
clang -cc1 --help|grep target

 -triple <value>         Specify target triple (e.g. i686-apple-darwin9)

Je sais que clang a un paramètre -triplet, mais comment puis-je lister toutes les valeurs possibles pour ce paramètre ? J'ai découvert que clang est très différent de gcc en ce qui concerne la compilation croisée, dans le monde de GCC vous devriez avoir un binaire séparé pour tout, comme PLATFORM_make ou PLATFORM_ld (i*86-pc-cygwin i*86-*-linux-gnu etc.). http://git.savannah.gnu.org/cgit/libtool.git/tree/doc/PLATFORMS )

dans le monde clang, il n'y a qu'un seul binaire (comme je l'ai lu sur certains forums). Mais comment puis-je obtenir la liste des cibles supportées ? Et si ma cible n'est pas supportée sur ma distro (linux/Windows/macos/quelque chose) comment puis-je obtenir celle qui supporte plus de plateforme ?

si je fais la dernière version SVN de clang comme ceci :

svn co http://llvm.org/svn/llvm-project/cfe/trunk clang

Est-ce que j'obtiendrai la plupart des plateformes ? Il semble que Clang n'ait pas été construit avec la compilation croisée à l'esprit dès le départ, mais comme il est basé sur llvm, il devrait être très convivial en théorie ? merci !

7voto

Zinovy Nis Points 132

Essayez aussi

> llc -mattr=help

Available CPUs for this target:

  amdfam10      - Select the amdfam10 processor.
  athlon        - Select the athlon processor.
  athlon-4      - Select the athlon-4 processor.
  athlon-fx     - Select the athlon-fx processor.
  athlon-mp     - Select the athlon-mp processor.
  athlon-tbird  - Select the athlon-tbird processor.
  athlon-xp     - Select the athlon-xp processor.
  athlon64      - Select the athlon64 processor.
  athlon64-sse3 - Select the athlon64-sse3 processor.
  atom          - Select the atom processor.
  ...
Available features for this target:

  16bit-mode           - 16-bit mode (i8086).
  32bit-mode           - 32-bit mode (80386).
  3dnow                - Enable 3DNow! instructions.
  3dnowa               - Enable 3DNow! Athlon instructions.
  64bit                - Support 64-bit instructions.
  64bit-mode           - 64-bit mode (x86_64).
  adx                  - Support ADX instructions.
  ...

5voto

DTharun Points 361

clang -march=dont-know empty.c

erreur : CPU cible inconnue 'dont-know'.

note : les valeurs de CPU cibles valides sont : nocona, core2, penryn, bonnell, atom, silvermont, slm, goldmont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge, corei7-avx, ivybridge, core-avx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512, skx, cascadelake, cooperlake, cannonlake, icelake-client, icelake-server, tigerlake, knl, knm, k8, athlon64, athlon-fx, opteron, k8-sse3, athlon64-sse3, opteron-sse3, amdfam10, barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, znver2, x86-64

3voto

bmills Points 51

Il ne listera pas tous les triples, mais

llvm-as < /dev/null | llc -mcpu=help

listera au moins tous les processeurs.

3voto

starfury Points 19

Si vous souhaitez savoir quelles cibles sont prises en charge pour la construction de LLVM ou de Clang à partir des sources (les valeurs de l'option -DLLVM_TARGETS_TO_BUILD ), cherchez la liste des sous-répertoires dans llvm/lib/Target dans la distribution source. A partir de la version 9.0.1, il y a :

AArch64
AMDGPU
ARC
ARM
AVR
BPF
Hexagon
Lanai
MSP430
Mips
NVPTX
PowerPC
RISCV
Sparc
SystemZ
WebAssembly
X86

2voto

DanglingPointer Points 151

Pour ceux qui sont arrivés ici en cherchant à savoir si leur architecture spécifique de famille de CPU x86 a une cible pour l'optimisation llvm/clang (.e.g : zen3, zen1, skylake, penryn, etc)

Vous pouvez afficher la liste en dessous ou l'exécuter :

$ llc -march=x86 -mattr=help
Available CPUs for this target:

  alderlake      - Select the alderlake processor.
  amdfam10       - Select the amdfam10 processor.
  athlon         - Select the athlon processor.
  athlon-4       - Select the athlon-4 processor.
  athlon-fx      - Select the athlon-fx processor.
  athlon-mp      - Select the athlon-mp processor.
  athlon-tbird   - Select the athlon-tbird processor.
  athlon-xp      - Select the athlon-xp processor.
  athlon64       - Select the athlon64 processor.
  athlon64-sse3  - Select the athlon64-sse3 processor.
  atom           - Select the atom processor.
  barcelona      - Select the barcelona processor.
  bdver1         - Select the bdver1 processor.
  bdver2         - Select the bdver2 processor.
  bdver3         - Select the bdver3 processor.
  bdver4         - Select the bdver4 processor.
  bonnell        - Select the bonnell processor.
  broadwell      - Select the broadwell processor.
  btver1         - Select the btver1 processor.
  btver2         - Select the btver2 processor.
  c3             - Select the c3 processor.
  c3-2           - Select the c3-2 processor.
  cannonlake     - Select the cannonlake processor.
  cascadelake    - Select the cascadelake processor.
  cooperlake     - Select the cooperlake processor.
  core-avx-i     - Select the core-avx-i processor.
  core-avx2      - Select the core-avx2 processor.
  core2          - Select the core2 processor.
  corei7         - Select the corei7 processor.
  corei7-avx     - Select the corei7-avx processor.
  generic        - Select the generic processor.
  geode          - Select the geode processor.
  goldmont       - Select the goldmont processor.
  goldmont-plus  - Select the goldmont-plus processor.
  haswell        - Select the haswell processor.
  i386           - Select the i386 processor.
  i486           - Select the i486 processor.
  i586           - Select the i586 processor.
  i686           - Select the i686 processor.
  icelake-client - Select the icelake-client processor.
  icelake-server - Select the icelake-server processor.
  ivybridge      - Select the ivybridge processor.
  k6             - Select the k6 processor.
  k6-2           - Select the k6-2 processor.
  k6-3           - Select the k6-3 processor.
  k8             - Select the k8 processor.
  k8-sse3        - Select the k8-sse3 processor.
  knl            - Select the knl processor.
  knm            - Select the knm processor.
  lakemont       - Select the lakemont processor.
  nehalem        - Select the nehalem processor.
  nocona         - Select the nocona processor.
  opteron        - Select the opteron processor.
  opteron-sse3   - Select the opteron-sse3 processor.
  penryn         - Select the penryn processor.
  pentium        - Select the pentium processor.
  pentium-m      - Select the pentium-m processor.
  pentium-mmx    - Select the pentium-mmx processor.
  pentium2       - Select the pentium2 processor.
  pentium3       - Select the pentium3 processor.
  pentium3m      - Select the pentium3m processor.
  pentium4       - Select the pentium4 processor.
  pentium4m      - Select the pentium4m processor.
  pentiumpro     - Select the pentiumpro processor.
  prescott       - Select the prescott processor.
  rocketlake     - Select the rocketlake processor.
  sandybridge    - Select the sandybridge processor.
  sapphirerapids - Select the sapphirerapids processor.
  silvermont     - Select the silvermont processor.
  skx            - Select the skx processor.
  skylake        - Select the skylake processor.
  skylake-avx512 - Select the skylake-avx512 processor.
  slm            - Select the slm processor.
  tigerlake      - Select the tigerlake processor.
  tremont        - Select the tremont processor.
  westmere       - Select the westmere processor.
  winchip-c6     - Select the winchip-c6 processor.
  winchip2       - Select the winchip2 processor.
  x86-64         - Select the x86-64 processor.
  x86-64-v2      - Select the x86-64-v2 processor.
  x86-64-v3      - Select the x86-64-v3 processor.
  x86-64-v4      - Select the x86-64-v4 processor.
  yonah          - Select the yonah processor.
  znver1         - Select the znver1 processor.
  znver2         - Select the znver2 processor.
  znver3         - Select the znver3 processor.

La liste ci-dessus est à jour au moment de llvm-13

Pour exécuter ce qui précède, vous devez installer llvm au moins et pour obtenir les mêmes résultats que ci-dessus, vous devez installer llvm-13 au moins.

Prograide.com

Prograide est une communauté de développeurs qui cherche à élargir la connaissance de la programmation au-delà de l'anglais.
Pour cela nous avons les plus grands doutes résolus en français et vous pouvez aussi poser vos propres questions ou résoudre celles des autres.

Powered by:

X