Index: include/llvm/Support/ARMTargetParser.def =================================================================== --- include/llvm/Support/ARMTargetParser.def +++ include/llvm/Support/ARMTargetParser.def @@ -42,45 +42,79 @@ #undef ARM_FPU #ifndef ARM_ARCH -#define ARM_ARCH(NAME, ID, CPU_ATTR, SUB_ARCH, ARCH_ATTR) +#define ARM_ARCH(NAME, ID, CPU_ATTR, SUB_ARCH, ARCH_ATTR, ARCH_BASE_EXT) #endif ARM_ARCH("invalid", AK_INVALID, nullptr, nullptr, - ARMBuildAttrs::CPUArch::Pre_v4) -ARM_ARCH("armv2", AK_ARMV2, "2", "v2", ARMBuildAttrs::CPUArch::Pre_v4) -ARM_ARCH("armv2a", AK_ARMV2A, "2A", "v2a", ARMBuildAttrs::CPUArch::Pre_v4) -ARM_ARCH("armv3", AK_ARMV3, "3", "v3", ARMBuildAttrs::CPUArch::Pre_v4) -ARM_ARCH("armv3m", AK_ARMV3M, "3M", "v3m", ARMBuildAttrs::CPUArch::Pre_v4) -ARM_ARCH("armv4", AK_ARMV4, "4", "v4", ARMBuildAttrs::CPUArch::v4) -ARM_ARCH("armv4t", AK_ARMV4T, "4T", "v4t", ARMBuildAttrs::CPUArch::v4T) -ARM_ARCH("armv5t", AK_ARMV5T, "5T", "v5", ARMBuildAttrs::CPUArch::v5T) -ARM_ARCH("armv5te", AK_ARMV5TE, "5TE", "v5e", ARMBuildAttrs::CPUArch::v5TE) -ARM_ARCH("armv5tej", AK_ARMV5TEJ, "5TEJ", "v5e", ARMBuildAttrs::CPUArch::v5TEJ) -ARM_ARCH("armv6", AK_ARMV6, "6", "v6", ARMBuildAttrs::CPUArch::v6) -ARM_ARCH("armv6k", AK_ARMV6K, "6K", "v6k", ARMBuildAttrs::CPUArch::v6K) -ARM_ARCH("armv6t2", AK_ARMV6T2, "6T2", "v6t2", ARMBuildAttrs::CPUArch::v6T2) -ARM_ARCH("armv6z", AK_ARMV6Z, "6Z", "v6z", ARMBuildAttrs::CPUArch::v6KZ) -ARM_ARCH("armv6zk", AK_ARMV6ZK, "6ZK", "v6zk", ARMBuildAttrs::CPUArch::v6KZ) -ARM_ARCH("armv6-m", AK_ARMV6M, "6-M", "v6m", ARMBuildAttrs::CPUArch::v6_M) -ARM_ARCH("armv6s-m", AK_ARMV6SM, "6S-M", "v6sm", ARMBuildAttrs::CPUArch::v6S_M) -ARM_ARCH("armv7-a", AK_ARMV7A, "7-A", "v7", ARMBuildAttrs::CPUArch::v7) -ARM_ARCH("armv7-r", AK_ARMV7R, "7-R", "v7r", ARMBuildAttrs::CPUArch::v7) -ARM_ARCH("armv7-m", AK_ARMV7M, "7-M", "v7m", ARMBuildAttrs::CPUArch::v7) -ARM_ARCH("armv7e-m", AK_ARMV7EM, "7E-M", "v7em", ARMBuildAttrs::CPUArch::v7E_M) -ARM_ARCH("armv8-a", AK_ARMV8A, "8-A", "v8", ARMBuildAttrs::CPUArch::v8) -ARM_ARCH("armv8.1-a", AK_ARMV8_1A, "8.1-A", "v8.1a", ARMBuildAttrs::CPUArch::v8) + ARMBuildAttrs::CPUArch::Pre_v4, AEK_NONE) +ARM_ARCH("armv2", AK_ARMV2, "2", "v2", ARMBuildAttrs::CPUArch::Pre_v4, + AEK_NONE) +ARM_ARCH("armv2a", AK_ARMV2A, "2A", "v2a", ARMBuildAttrs::CPUArch::Pre_v4, + AEK_NONE) +ARM_ARCH("armv3", AK_ARMV3, "3", "v3", ARMBuildAttrs::CPUArch::Pre_v4, + AEK_NONE) +ARM_ARCH("armv3m", AK_ARMV3M, "3M", "v3m", ARMBuildAttrs::CPUArch::Pre_v4, + AEK_NONE) +ARM_ARCH("armv4", AK_ARMV4, "4", "v4", ARMBuildAttrs::CPUArch::v4, + AEK_NONE) +ARM_ARCH("armv4t", AK_ARMV4T, "4T", "v4t", ARMBuildAttrs::CPUArch::v4T, + AEK_NONE) +ARM_ARCH("armv5t", AK_ARMV5T, "5T", "v5", ARMBuildAttrs::CPUArch::v5T, + AEK_NONE) +ARM_ARCH("armv5te", AK_ARMV5TE, "5TE", "v5e", ARMBuildAttrs::CPUArch::v5TE, + AEK_NONE) +ARM_ARCH("armv5tej", AK_ARMV5TEJ, "5TEJ", "v5e", ARMBuildAttrs::CPUArch::v5TEJ, + AEK_NONE) +ARM_ARCH("armv6", AK_ARMV6, "6", "v6", ARMBuildAttrs::CPUArch::v6, + AEK_NONE) +ARM_ARCH("armv6k", AK_ARMV6K, "6K", "v6k", ARMBuildAttrs::CPUArch::v6K, + AEK_NONE) +ARM_ARCH("armv6t2", AK_ARMV6T2, "6T2", "v6t2", ARMBuildAttrs::CPUArch::v6T2, + AEK_NONE) +ARM_ARCH("armv6z", AK_ARMV6Z, "6Z", "v6z", ARMBuildAttrs::CPUArch::v6KZ, + AEK_SEC) +ARM_ARCH("armv6zk", AK_ARMV6ZK, "6ZK", "v6zk", ARMBuildAttrs::CPUArch::v6KZ, + AEK_SEC) +ARM_ARCH("armv6-m", AK_ARMV6M, "6-M", "v6m", ARMBuildAttrs::CPUArch::v6_M, + AEK_NONE) +ARM_ARCH("armv6s-m", AK_ARMV6SM, "6S-M", "v6sm", ARMBuildAttrs::CPUArch::v6S_M, + AEK_NONE) +ARM_ARCH("armv7-a", AK_ARMV7A, "7-A", "v7", ARMBuildAttrs::CPUArch::v7, + AEK_NONE) +ARM_ARCH("armv7-r", AK_ARMV7R, "7-R", "v7r", ARMBuildAttrs::CPUArch::v7, + AEK_HWDIV) +ARM_ARCH("armv7-m", AK_ARMV7M, "7-M", "v7m", ARMBuildAttrs::CPUArch::v7, + AEK_HWDIV) +ARM_ARCH("armv7e-m", AK_ARMV7EM, "7E-M", "v7em", ARMBuildAttrs::CPUArch::v7E_M, + AEK_HWDIV) +ARM_ARCH("armv8-a", AK_ARMV8A, "8-A", "v8", ARMBuildAttrs::CPUArch::v8, + (AEK_SEC | AEK_MP | AEK_VIRT | AEK_HWDIVARM | AEK_HWDIV)) +ARM_ARCH("armv8.1-a", AK_ARMV8_1A, "8.1-A", "v8.1a", ARMBuildAttrs::CPUArch::v8, + (AEK_SEC | AEK_MP | AEK_VIRT | AEK_HWDIVARM | AEK_HWDIV)) // Non-standard Arch names. -ARM_ARCH("iwmmxt", AK_IWMMXT, "iwmmxt", "", ARMBuildAttrs::CPUArch::v5TE) -ARM_ARCH("iwmmxt2", AK_IWMMXT2, "iwmmxt2", "", ARMBuildAttrs::CPUArch::v5TE) -ARM_ARCH("xscale", AK_XSCALE, "xscale", "", ARMBuildAttrs::CPUArch::v5TE) -ARM_ARCH("armv5", AK_ARMV5, "5T", "v5", ARMBuildAttrs::CPUArch::v5T) -ARM_ARCH("armv5e", AK_ARMV5E, "5TE", "v5e", ARMBuildAttrs::CPUArch::v5TE) -ARM_ARCH("armv6j", AK_ARMV6J, "6J", "v6", ARMBuildAttrs::CPUArch::v6) -ARM_ARCH("armv6hl", AK_ARMV6HL, "6-M", "v6hl", ARMBuildAttrs::CPUArch::v6_M) -ARM_ARCH("armv7", AK_ARMV7, "7", "v7", ARMBuildAttrs::CPUArch::v7) -ARM_ARCH("armv7l", AK_ARMV7L, "7-L", "v7l", ARMBuildAttrs::CPUArch::v7) -ARM_ARCH("armv7hl", AK_ARMV7HL, "7-L", "v7hl", ARMBuildAttrs::CPUArch::v7) -ARM_ARCH("armv7s", AK_ARMV7S, "7-S", "v7s", ARMBuildAttrs::CPUArch::v7) -ARM_ARCH("armv7k", AK_ARMV7K, "7-K", "v7k", ARMBuildAttrs::CPUArch::v7) +ARM_ARCH("iwmmxt", AK_IWMMXT, "iwmmxt", "", ARMBuildAttrs::CPUArch::v5TE, + AEK_NONE) +ARM_ARCH("iwmmxt2", AK_IWMMXT2, "iwmmxt2", "", ARMBuildAttrs::CPUArch::v5TE, + AEK_NONE) +ARM_ARCH("xscale", AK_XSCALE, "xscale", "", ARMBuildAttrs::CPUArch::v5TE, + AEK_NONE) +ARM_ARCH("armv5", AK_ARMV5, "5T", "v5", ARMBuildAttrs::CPUArch::v5T, + AEK_NONE) +ARM_ARCH("armv5e", AK_ARMV5E, "5TE", "v5e", ARMBuildAttrs::CPUArch::v5TE, + AEK_NONE) +ARM_ARCH("armv6j", AK_ARMV6J, "6J", "v6", ARMBuildAttrs::CPUArch::v6, + AEK_NONE) +ARM_ARCH("armv6hl", AK_ARMV6HL, "6-M", "v6hl", ARMBuildAttrs::CPUArch::v6_M, + AEK_NONE) +ARM_ARCH("armv7", AK_ARMV7, "7", "v7", ARMBuildAttrs::CPUArch::v7, + AEK_NONE) +ARM_ARCH("armv7l", AK_ARMV7L, "7-L", "v7l", ARMBuildAttrs::CPUArch::v7, + AEK_NONE) +ARM_ARCH("armv7hl", AK_ARMV7HL, "7-L", "v7hl", ARMBuildAttrs::CPUArch::v7, + AEK_NONE) +ARM_ARCH("armv7s", AK_ARMV7S, "7-S", "v7s", ARMBuildAttrs::CPUArch::v7, + AEK_NONE) +ARM_ARCH("armv7k", AK_ARMV7K, "7-K", "v7k", ARMBuildAttrs::CPUArch::v7, + AEK_NONE) #undef ARM_ARCH #ifndef ARM_ARCH_EXT_NAME @@ -114,91 +148,102 @@ #undef ARM_HW_DIV_NAME #ifndef ARM_CPU_NAME -#define ARM_CPU_NAME(NAME, ID, DEFAULT_FPU, IS_DEFAULT) +#define ARM_CPU_NAME(NAME, ID, DEFAULT_FPU, IS_DEFAULT, DEFAULT_EXT) #endif -ARM_CPU_NAME("arm2", AK_ARMV2, FK_NONE, true) -ARM_CPU_NAME("arm3", AK_ARMV2A, FK_NONE, true) -ARM_CPU_NAME("arm6", AK_ARMV3, FK_NONE, true) -ARM_CPU_NAME("arm7m", AK_ARMV3M, FK_NONE, true) -ARM_CPU_NAME("arm8", AK_ARMV4, FK_NONE, false) -ARM_CPU_NAME("arm810", AK_ARMV4, FK_NONE, false) -ARM_CPU_NAME("strongarm", AK_ARMV4, FK_NONE, true) -ARM_CPU_NAME("strongarm110", AK_ARMV4, FK_NONE, false) -ARM_CPU_NAME("strongarm1100", AK_ARMV4, FK_NONE, false) -ARM_CPU_NAME("strongarm1110", AK_ARMV4, FK_NONE, false) -ARM_CPU_NAME("arm7tdmi", AK_ARMV4T, FK_NONE, true) -ARM_CPU_NAME("arm7tdmi-s", AK_ARMV4T, FK_NONE, false) -ARM_CPU_NAME("arm710t", AK_ARMV4T, FK_NONE, false) -ARM_CPU_NAME("arm720t", AK_ARMV4T, FK_NONE, false) -ARM_CPU_NAME("arm9", AK_ARMV4T, FK_NONE, false) -ARM_CPU_NAME("arm9tdmi", AK_ARMV4T, FK_NONE, false) -ARM_CPU_NAME("arm920", AK_ARMV4T, FK_NONE, false) -ARM_CPU_NAME("arm920t", AK_ARMV4T, FK_NONE, false) -ARM_CPU_NAME("arm922t", AK_ARMV4T, FK_NONE, false) -ARM_CPU_NAME("arm9312", AK_ARMV4T, FK_NONE, false) -ARM_CPU_NAME("arm940t", AK_ARMV4T, FK_NONE, false) -ARM_CPU_NAME("ep9312", AK_ARMV4T, FK_NONE, false) -ARM_CPU_NAME("arm10tdmi", AK_ARMV5T, FK_NONE, true) -ARM_CPU_NAME("arm1020t", AK_ARMV5T, FK_NONE, false) -ARM_CPU_NAME("arm9e", AK_ARMV5TE, FK_NONE, false) -ARM_CPU_NAME("arm946e-s", AK_ARMV5TE, FK_NONE, false) -ARM_CPU_NAME("arm966e-s", AK_ARMV5TE, FK_NONE, false) -ARM_CPU_NAME("arm968e-s", AK_ARMV5TE, FK_NONE, false) -ARM_CPU_NAME("arm10e", AK_ARMV5TE, FK_NONE, false) -ARM_CPU_NAME("arm1020e", AK_ARMV5TE, FK_NONE, false) -ARM_CPU_NAME("arm1022e", AK_ARMV5TE, FK_NONE, true) -ARM_CPU_NAME("iwmmxt", AK_ARMV5TE, FK_NONE, false) -ARM_CPU_NAME("xscale", AK_ARMV5TE, FK_NONE, false) -ARM_CPU_NAME("arm926ej-s", AK_ARMV5TEJ, FK_NONE, true) -ARM_CPU_NAME("arm1136jf-s", AK_ARMV6, FK_VFPV2, true) -ARM_CPU_NAME("arm1176j-s", AK_ARMV6K, FK_NONE, false) -ARM_CPU_NAME("arm1176jz-s", AK_ARMV6K, FK_NONE, false) -ARM_CPU_NAME("mpcore", AK_ARMV6K, FK_VFPV2, false) -ARM_CPU_NAME("mpcorenovfp", AK_ARMV6K, FK_NONE, false) -ARM_CPU_NAME("arm1176jzf-s", AK_ARMV6K, FK_VFPV2, true) -ARM_CPU_NAME("arm1176jzf-s", AK_ARMV6Z, FK_VFPV2, true) -ARM_CPU_NAME("arm1176jzf-s", AK_ARMV6ZK, FK_VFPV2, true) -ARM_CPU_NAME("arm1156t2-s", AK_ARMV6T2, FK_NONE, true) -ARM_CPU_NAME("arm1156t2f-s", AK_ARMV6T2, FK_VFPV2, false) -ARM_CPU_NAME("cortex-m0", AK_ARMV6M, FK_NONE, true) -ARM_CPU_NAME("cortex-m0plus", AK_ARMV6M, FK_NONE, false) -ARM_CPU_NAME("cortex-m1", AK_ARMV6M, FK_NONE, false) -ARM_CPU_NAME("sc000", AK_ARMV6M, FK_NONE, false) -ARM_CPU_NAME("cortex-a5", AK_ARMV7A, FK_NEON_VFPV4, false) -ARM_CPU_NAME("cortex-a7", AK_ARMV7A, FK_NEON_VFPV4, false) -ARM_CPU_NAME("cortex-a8", AK_ARMV7A, FK_NEON, true) -ARM_CPU_NAME("cortex-a9", AK_ARMV7A, FK_NEON_FP16, false) -ARM_CPU_NAME("cortex-a12", AK_ARMV7A, FK_NEON_VFPV4, false) -ARM_CPU_NAME("cortex-a15", AK_ARMV7A, FK_NEON_VFPV4, false) -ARM_CPU_NAME("cortex-a17", AK_ARMV7A, FK_NEON_VFPV4, false) -ARM_CPU_NAME("krait", AK_ARMV7A, FK_NEON_VFPV4, false) -ARM_CPU_NAME("cortex-r4", AK_ARMV7R, FK_NONE, true) -ARM_CPU_NAME("cortex-r4f", AK_ARMV7R, FK_VFPV3_D16, false) -ARM_CPU_NAME("cortex-r5", AK_ARMV7R, FK_VFPV3_D16, false) -ARM_CPU_NAME("cortex-r7", AK_ARMV7R, FK_VFPV3_D16_FP16, false) -ARM_CPU_NAME("sc300", AK_ARMV7M, FK_NONE, false) -ARM_CPU_NAME("cortex-m3", AK_ARMV7M, FK_NONE, true) -ARM_CPU_NAME("cortex-m4", AK_ARMV7EM, FK_FPV4_SP_D16, true) -ARM_CPU_NAME("cortex-m7", AK_ARMV7EM, FK_FPV5_D16, false) -ARM_CPU_NAME("cortex-a53", AK_ARMV8A, FK_CRYPTO_NEON_FP_ARMV8, true) -ARM_CPU_NAME("cortex-a57", AK_ARMV8A, FK_CRYPTO_NEON_FP_ARMV8, false) -ARM_CPU_NAME("cortex-a72", AK_ARMV8A, FK_CRYPTO_NEON_FP_ARMV8, false) -ARM_CPU_NAME("cyclone", AK_ARMV8A, FK_CRYPTO_NEON_FP_ARMV8, false) -ARM_CPU_NAME("generic", AK_ARMV8_1A, FK_NEON_FP_ARMV8, true) +ARM_CPU_NAME("arm2", AK_ARMV2, FK_NONE, true, AEK_NONE) +ARM_CPU_NAME("arm3", AK_ARMV2A, FK_NONE, true, AEK_NONE) +ARM_CPU_NAME("arm6", AK_ARMV3, FK_NONE, true, AEK_NONE) +ARM_CPU_NAME("arm7m", AK_ARMV3M, FK_NONE, true, AEK_NONE) +ARM_CPU_NAME("arm8", AK_ARMV4, FK_NONE, false, AEK_NONE) +ARM_CPU_NAME("arm810", AK_ARMV4, FK_NONE, false, AEK_NONE) +ARM_CPU_NAME("strongarm", AK_ARMV4, FK_NONE, true, AEK_NONE) +ARM_CPU_NAME("strongarm110", AK_ARMV4, FK_NONE, false, AEK_NONE) +ARM_CPU_NAME("strongarm1100", AK_ARMV4, FK_NONE, false, AEK_NONE) +ARM_CPU_NAME("strongarm1110", AK_ARMV4, FK_NONE, false, AEK_NONE) +ARM_CPU_NAME("arm7tdmi", AK_ARMV4T, FK_NONE, true, AEK_NONE) +ARM_CPU_NAME("arm7tdmi-s", AK_ARMV4T, FK_NONE, false, AEK_NONE) +ARM_CPU_NAME("arm710t", AK_ARMV4T, FK_NONE, false, AEK_NONE) +ARM_CPU_NAME("arm720t", AK_ARMV4T, FK_NONE, false, AEK_NONE) +ARM_CPU_NAME("arm9", AK_ARMV4T, FK_NONE, false, AEK_NONE) +ARM_CPU_NAME("arm9tdmi", AK_ARMV4T, FK_NONE, false, AEK_NONE) +ARM_CPU_NAME("arm920", AK_ARMV4T, FK_NONE, false, AEK_NONE) +ARM_CPU_NAME("arm920t", AK_ARMV4T, FK_NONE, false, AEK_NONE) +ARM_CPU_NAME("arm922t", AK_ARMV4T, FK_NONE, false, AEK_NONE) +ARM_CPU_NAME("arm9312", AK_ARMV4T, FK_NONE, false, AEK_NONE) +ARM_CPU_NAME("arm940t", AK_ARMV4T, FK_NONE, false, AEK_NONE) +ARM_CPU_NAME("ep9312", AK_ARMV4T, FK_NONE, false, AEK_NONE) +ARM_CPU_NAME("arm10tdmi", AK_ARMV5T, FK_NONE, true, AEK_NONE) +ARM_CPU_NAME("arm1020t", AK_ARMV5T, FK_NONE, false, AEK_NONE) +ARM_CPU_NAME("arm9e", AK_ARMV5TE, FK_NONE, false, AEK_NONE) +ARM_CPU_NAME("arm946e-s", AK_ARMV5TE, FK_NONE, false, AEK_NONE) +ARM_CPU_NAME("arm966e-s", AK_ARMV5TE, FK_NONE, false, AEK_NONE) +ARM_CPU_NAME("arm968e-s", AK_ARMV5TE, FK_NONE, false, AEK_NONE) +ARM_CPU_NAME("arm10e", AK_ARMV5TE, FK_NONE, false, AEK_NONE) +ARM_CPU_NAME("arm1020e", AK_ARMV5TE, FK_NONE, false, AEK_NONE) +ARM_CPU_NAME("arm1022e", AK_ARMV5TE, FK_NONE, true, AEK_NONE) +ARM_CPU_NAME("iwmmxt", AK_ARMV5TE, FK_NONE, false, AEK_NONE) +ARM_CPU_NAME("xscale", AK_ARMV5TE, FK_NONE, false, AEK_NONE) +ARM_CPU_NAME("arm926ej-s", AK_ARMV5TEJ, FK_NONE, true, AEK_NONE) +ARM_CPU_NAME("arm1136jf-s", AK_ARMV6, FK_VFPV2, true, AEK_NONE) +ARM_CPU_NAME("arm1176j-s", AK_ARMV6K, FK_NONE, false, AEK_NONE) +ARM_CPU_NAME("arm1176jz-s", AK_ARMV6K, FK_NONE, false, AEK_NONE) +ARM_CPU_NAME("mpcore", AK_ARMV6K, FK_VFPV2, false, AEK_NONE) +ARM_CPU_NAME("mpcorenovfp", AK_ARMV6K, FK_NONE, false, AEK_NONE) +ARM_CPU_NAME("arm1176jzf-s", AK_ARMV6K, FK_VFPV2, true, AEK_NONE) +ARM_CPU_NAME("arm1176jzf-s", AK_ARMV6Z, FK_VFPV2, true, AEK_NONE) +ARM_CPU_NAME("arm1176jzf-s", AK_ARMV6ZK, FK_VFPV2, true, AEK_NONE) +ARM_CPU_NAME("arm1156t2-s", AK_ARMV6T2, FK_NONE, true, AEK_NONE) +ARM_CPU_NAME("arm1156t2f-s", AK_ARMV6T2, FK_VFPV2, false, AEK_NONE) +ARM_CPU_NAME("cortex-m0", AK_ARMV6M, FK_NONE, true, AEK_NONE) +ARM_CPU_NAME("cortex-m0plus", AK_ARMV6M, FK_NONE, false, AEK_NONE) +ARM_CPU_NAME("cortex-m1", AK_ARMV6M, FK_NONE, false, AEK_NONE) +ARM_CPU_NAME("sc000", AK_ARMV6M, FK_NONE, false, AEK_NONE) +ARM_CPU_NAME("cortex-a5", AK_ARMV7A, FK_NEON_VFPV4, false, (AEK_SEC | AEK_MP)) +ARM_CPU_NAME("cortex-a7", AK_ARMV7A, FK_NEON_VFPV4, false, + (AEK_SEC | AEK_MP | AEK_VIRT | AEK_HWDIVARM | AEK_HWDIV)) +ARM_CPU_NAME("cortex-a8", AK_ARMV7A, FK_NEON, true, AEK_SEC) +ARM_CPU_NAME("cortex-a9", AK_ARMV7A, FK_NEON_FP16, false, (AEK_SEC | AEK_MP)) +ARM_CPU_NAME("cortex-a12", AK_ARMV7A, FK_NEON_VFPV4, false, + (AEK_SEC | AEK_MP | AEK_VIRT | AEK_HWDIVARM | AEK_HWDIV)) +ARM_CPU_NAME("cortex-a15", AK_ARMV7A, FK_NEON_VFPV4, false, + (AEK_SEC | AEK_MP | AEK_VIRT | AEK_HWDIVARM | AEK_HWDIV)) +ARM_CPU_NAME("cortex-a17", AK_ARMV7A, FK_NEON_VFPV4, false, + (AEK_SEC | AEK_MP | AEK_VIRT | AEK_HWDIVARM | AEK_HWDIV)) +ARM_CPU_NAME("krait", AK_ARMV7A, FK_NEON_VFPV4, false, + (AEK_HWDIVARM | AEK_HWDIV)) +ARM_CPU_NAME("cortex-r4", AK_ARMV7R, FK_NONE, true, AEK_NONE) +ARM_CPU_NAME("cortex-r4f", AK_ARMV7R, FK_VFPV3_D16, false, AEK_NONE) +ARM_CPU_NAME("cortex-r5", AK_ARMV7R, FK_NONE, false, + (AEK_MP | AEK_HWDIVARM)) +ARM_CPU_NAME("cortex-r5f", AK_ARMV7R, FK_VFPV3_D16, false, + (AEK_MP | AEK_HWDIVARM)) +ARM_CPU_NAME("cortex-r7", AK_ARMV7R, FK_VFPV3_D16_FP16, false, + (AEK_MP | AEK_HWDIVARM)) +ARM_CPU_NAME("sc300", AK_ARMV7M, FK_NONE, false, AEK_NONE) +ARM_CPU_NAME("cortex-m3", AK_ARMV7M, FK_NONE, true, AEK_NONE) +ARM_CPU_NAME("cortex-m4", AK_ARMV7EM, FK_NONE, true, AEK_NONE) +ARM_CPU_NAME("cortex-m4f", AK_ARMV7EM, FK_FPV4_SP_D16, true, AEK_NONE) +ARM_CPU_NAME("cortex-m7", AK_ARMV7EM, FK_FPV5_D16, false, AEK_NONE) +ARM_CPU_NAME("cortex-a53", AK_ARMV8A, FK_CRYPTO_NEON_FP_ARMV8, true, AEK_CRC) +ARM_CPU_NAME("cortex-a57", AK_ARMV8A, FK_CRYPTO_NEON_FP_ARMV8, false, AEK_CRC) +ARM_CPU_NAME("cortex-a72", AK_ARMV8A, FK_CRYPTO_NEON_FP_ARMV8, false, AEK_CRC) +ARM_CPU_NAME("cyclone", AK_ARMV8A, FK_CRYPTO_NEON_FP_ARMV8, false, AEK_CRC) +ARM_CPU_NAME("generic", AK_ARMV8_1A, FK_NEON_FP_ARMV8, true, AEK_NONE) // Non-standard Arch names. -ARM_CPU_NAME("iwmmxt", AK_IWMMXT, FK_NONE, true) -ARM_CPU_NAME("xscale", AK_XSCALE, FK_NONE, true) -ARM_CPU_NAME("arm10tdmi", AK_ARMV5, FK_NONE, true) -ARM_CPU_NAME("arm1022e", AK_ARMV5E, FK_NONE, true) -ARM_CPU_NAME("arm1136j-s", AK_ARMV6J, FK_NONE, true) -ARM_CPU_NAME("arm1136jz-s", AK_ARMV6J, FK_NONE, false) -ARM_CPU_NAME("cortex-m0", AK_ARMV6SM, FK_NONE, true) -ARM_CPU_NAME("arm1176jzf-s", AK_ARMV6HL, FK_VFPV2, true) -ARM_CPU_NAME("cortex-a8", AK_ARMV7, FK_NEON, true) -ARM_CPU_NAME("cortex-a8", AK_ARMV7L, FK_NEON, true) -ARM_CPU_NAME("cortex-a8", AK_ARMV7HL, FK_NEON, true) -ARM_CPU_NAME("cortex-m4", AK_ARMV7EM, FK_NONE, true) -ARM_CPU_NAME("swift", AK_ARMV7S, FK_NEON_VFPV4, true) +ARM_CPU_NAME("iwmmxt", AK_IWMMXT, FK_NONE, true, AEK_NONE) +ARM_CPU_NAME("xscale", AK_XSCALE, FK_NONE, true, AEK_NONE) +ARM_CPU_NAME("arm10tdmi", AK_ARMV5, FK_NONE, true, AEK_NONE) +ARM_CPU_NAME("arm1022e", AK_ARMV5E, FK_NONE, true, AEK_NONE) +ARM_CPU_NAME("arm1136j-s", AK_ARMV6J, FK_NONE, true, AEK_NONE) +ARM_CPU_NAME("arm1136jz-s", AK_ARMV6J, FK_NONE, false, AEK_NONE) +ARM_CPU_NAME("cortex-m0", AK_ARMV6SM, FK_NONE, true, AEK_NONE) +ARM_CPU_NAME("arm1176jzf-s", AK_ARMV6HL, FK_VFPV2, true, AEK_NONE) +ARM_CPU_NAME("cortex-a8", AK_ARMV7, FK_NEON, true, AEK_SEC) +ARM_CPU_NAME("cortex-a8", AK_ARMV7L, FK_NEON, true, AEK_SEC) +ARM_CPU_NAME("cortex-a8", AK_ARMV7HL, FK_NEON, true, AEK_SEC) +ARM_CPU_NAME("cortex-m4", AK_ARMV7EM, FK_NONE, true, AEK_NONE) +ARM_CPU_NAME("swift", AK_ARMV7S, FK_NEON_VFPV4, true, + (AEK_HWDIVARM | AEK_HWDIV)) // Invalid CPU -ARM_CPU_NAME("invalid", AK_INVALID, FK_INVALID, true) +ARM_CPU_NAME("invalid", AK_INVALID, FK_INVALID, true, AEK_INVALID) #undef ARM_CPU_NAME Index: include/llvm/Support/TargetParser.h =================================================================== --- include/llvm/Support/TargetParser.h +++ include/llvm/Support/TargetParser.h @@ -63,7 +63,7 @@ // Arch names. enum ArchKind { -#define ARM_ARCH(NAME, ID, CPU_ATTR, SUB_ARCH, ARCH_ATTR) ID, +#define ARM_ARCH(NAME, ID, CPU_ATTR, SUB_ARCH, ARCH_ATTR, ARCH_BASE_EXT) ID, #include "ARMTargetParser.def" AK_LAST }; @@ -106,16 +106,23 @@ unsigned getFPUVersion(unsigned FPUKind); unsigned getFPUNeonSupportLevel(unsigned FPUKind); unsigned getFPURestriction(unsigned FPUKind); -unsigned getDefaultFPU(StringRef CPU); -// FIXME: This should be moved to TargetTuple once it exists + +// FIXME: These should be moved to TargetTuple once it exists bool getFPUFeatures(unsigned FPUKind, std::vector &Features); bool getHWDivFeatures(unsigned HWDivKind, std::vector &Features); +bool getExtensionFeatures(unsigned Extensions, + std::vector &Features); + StringRef getArchName(unsigned ArchKind); unsigned getArchAttr(unsigned ArchKind); StringRef getCPUAttr(unsigned ArchKind); StringRef getSubArch(unsigned ArchKind); StringRef getArchExtName(unsigned ArchExtKind); StringRef getHWDivName(unsigned HWDivKind); + +// Information by Name +unsigned getDefaultFPU(StringRef CPU); +unsigned getDefaultExtensions(StringRef CPU); StringRef getDefaultCPU(StringRef Arch); // Parser Index: lib/Support/TargetParser.cpp =================================================================== --- lib/Support/TargetParser.cpp +++ lib/Support/TargetParser.cpp @@ -59,6 +59,7 @@ const char *SubArchCStr; size_t SubArchLength; ARMBuildAttrs::CPUArch ArchAttr; // Arch ID in build attributes. + unsigned ArchBaseExtensions; StringRef getName() const { return StringRef(NameCStr, NameLength); } @@ -68,9 +69,9 @@ // Sub-Arch name. StringRef getSubArch() const { return StringRef(SubArchCStr, SubArchLength); } } ARCHNames[] = { -#define ARM_ARCH(NAME, ID, CPU_ATTR, SUB_ARCH, ARCH_ATTR) \ +#define ARM_ARCH(NAME, ID, CPU_ATTR, SUB_ARCH, ARCH_ATTR, ARCH_BASE_EXT) \ {NAME, sizeof(NAME) - 1, ID, CPU_ATTR, sizeof(CPU_ATTR) - 1, SUB_ARCH, \ - sizeof(SUB_ARCH) - 1, ARCH_ATTR}, + sizeof(SUB_ARCH) - 1, ARCH_ATTR, ARCH_BASE_EXT}, #include "llvm/Support/ARMTargetParser.def" }; @@ -111,11 +112,12 @@ size_t NameLength; ARM::ArchKind ArchID; bool Default; // is $Name the default CPU for $ArchID ? + unsigned DefaultExtensions; StringRef getName() const { return StringRef(NameCStr, NameLength); } } CPUNames[] = { -#define ARM_CPU_NAME(NAME, ID, DEFAULT_FPU, IS_DEFAULT) \ - { NAME, sizeof(NAME) - 1, ID, IS_DEFAULT }, +#define ARM_CPU_NAME(NAME, ID, DEFAULT_FPU, IS_DEFAULT, DEFAULT_EXT) \ + { NAME, sizeof(NAME) - 1, ID, IS_DEFAULT, DEFAULT_EXT }, #include "llvm/Support/ARMTargetParser.def" }; @@ -151,7 +153,7 @@ unsigned llvm::ARM::getDefaultFPU(StringRef CPU) { return StringSwitch(CPU) -#define ARM_CPU_NAME(NAME, ID, DEFAULT_FPU, IS_DEFAULT) \ +#define ARM_CPU_NAME(NAME, ID, DEFAULT_FPU, IS_DEFAULT, DEFAULT_EXT) \ .Case(NAME, DEFAULT_FPU) #include "llvm/Support/ARMTargetParser.def" .Default(ARM::FK_INVALID); @@ -176,6 +178,20 @@ return true; } +bool llvm::ARM::getExtensionFeatures(unsigned Extensions, + std::vector &Features) { + + if (Extensions == ARM::AEK_INVALID) + return false; + + if (Extensions & ARM::AEK_CRC) + Features.push_back("+crc"); + else + Features.push_back("-crc"); + + return getHWDivFeatures(Extensions, Features); +} + bool llvm::ARM::getFPUFeatures(unsigned FPUKind, std::vector &Features) { @@ -242,6 +258,7 @@ // crypto includes neon, so we handle this similarly to FPU version. switch (FPUNames[FPUKind].NeonSupport) { case ARM::NS_Crypto: + Features.push_back("+neon"); Features.push_back("+crypto"); break; case ARM::NS_Neon: @@ -297,6 +314,14 @@ return StringRef(); } +unsigned llvm::ARM::getDefaultExtensions(StringRef CPU) { + for (const auto C : CPUNames) { + if (CPU == C.getName()) + return (ARCHNames[C.ArchID].ArchBaseExtensions | C.DefaultExtensions); + } + return ARM::AEK_INVALID; +} + StringRef llvm::ARM::getDefaultCPU(StringRef Arch) { unsigned AK = parseArch(Arch); if (AK == ARM::AK_INVALID)