@@ -512,8 +512,55 @@ int gcc_modet::doit()
512
512
// clang supports -target <arch-quadruple> and --target=<arch-quadruple>
513
513
if (cmdline.isset (" target" ))
514
514
{
515
+ // list of targets supported by LLVM 10.0, found using llc --version
516
+ static const std::map<std::string, std::string> target_map = {
517
+ {" aarch64" , " arm64" /* AArch64 (little endian) */ },
518
+ {" aarch64_32" , " arm" /* AArch64 (little endian ILP32) */ },
519
+ {" aarch64_be" , " none" /* AArch64 (big endian) */ },
520
+ {" amdgcn" , " none" /* AMD GCN GPUs */ },
521
+ {" arm" , " arm" /* ARM */ },
522
+ {" arm64" , " arm64" /* ARM64 (little endian) */ },
523
+ {" arm64_32" , " arm" /* ARM64 (little endian ILP32) */ },
524
+ {" armeb" , " none" /* ARM (big endian) */ },
525
+ {" avr" , " none" /* Atmel AVR Microcontroller */ },
526
+ {" bpf" , " none" /* BPF (host endian) */ },
527
+ {" bpfeb" , " none" /* BPF (big endian) */ },
528
+ {" bpfel" , " none" /* BPF (little endian) */ },
529
+ {" hexagon" , " none" /* Hexagon */ },
530
+ {" i386" , " i386" /* (not in llc's list: 32-bit x86) */ },
531
+ {" lanai" , " none" /* Lanai */ },
532
+ {" mips" , " mips" /* MIPS (32-bit big endian) */ },
533
+ {" mips64" , " mips64" /* MIPS (64-bit big endian) */ },
534
+ {" mips64el" , " mips64el" /* MIPS (64-bit little endian) */ },
535
+ {" mipsel" , " mipsel" /* MIPS (32-bit little endian) */ },
536
+ {" msp430" , " none" /* MSP430 [experimental] */ },
537
+ {" nvptx" , " none" /* NVIDIA PTX 32-bit */ },
538
+ {" nvptx64" , " none" /* NVIDIA PTX 64-bit */ },
539
+ {" ppc32" , " powerpc" /* PowerPC 32 */ },
540
+ {" ppc64" , " ppc64" /* PowerPC 64 */ },
541
+ {" ppc64le" , " ppc64le" /* PowerPC 64 LE */ },
542
+ {" r600" , " none" /* AMD GPUs HD2XXX-HD6XXX */ },
543
+ {" riscv32" , " none" /* 32-bit RISC-V */ },
544
+ {" riscv64" , " riscv64" /* 64-bit RISC-V */ },
545
+ {" sparc" , " sparc" /* Sparc */ },
546
+ {" sparcel" , " none" /* Sparc LE */ },
547
+ {" sparcv9" , " sparc64" /* Sparc V9 */ },
548
+ {" systemz" , " none" /* SystemZ */ },
549
+ {" thumb" , " armhf" /* Thumb */ },
550
+ {" thumbeb" , " none" /* Thumb (big endian) */ },
551
+ {" wasm32" , " none" /* WebAssembly 32-bit */ },
552
+ {" wasm64" , " none" /* WebAssembly 64-bit */ },
553
+ {" x86" , " i386" /* 32-bit X86: Pentium-Pro and above */ },
554
+ {" x86_64" , " x86_64" /* 64-bit X86: EM64T and AMD64 */ },
555
+ {" xcore" , " none" /* XCore */ },
556
+ };
515
557
std::string arch_quadruple = cmdline.get_value (" target" );
516
- config.set_arch (arch_quadruple.substr (0 , arch_quadruple.find (' -' )));
558
+ auto it =
559
+ target_map.find (arch_quadruple.substr (0 , arch_quadruple.find (' -' )));
560
+ if (it == target_map.end ())
561
+ config.set_arch (" none" );
562
+ else
563
+ config.set_arch (it->second );
517
564
}
518
565
519
566
// -fshort-wchar makes wchar_t "short unsigned int"
0 commit comments