jojo updated this revision to Diff 60658. jojo added a comment. Herald added a subscriber: mehdi_amini.
Update according to inline comments. Repository: rL LLVM http://reviews.llvm.org/D21277 Files: lib/Basic/Targets.cpp lib/Driver/Tools.cpp
Index: lib/Driver/Tools.cpp =================================================================== --- lib/Driver/Tools.cpp +++ lib/Driver/Tools.cpp @@ -2299,24 +2299,8 @@ text.split(Split, StringRef("+"), -1, false); for (StringRef Feature : Split) { - const char *result = llvm::StringSwitch<const char *>(Feature) - .Case("fp", "+fp-armv8") - .Case("simd", "+neon") - .Case("crc", "+crc") - .Case("crypto", "+crypto") - .Case("fp16", "+fullfp16") - .Case("profile", "+spe") - .Case("ras", "+ras") - .Case("nofp", "-fp-armv8") - .Case("nosimd", "-neon") - .Case("nocrc", "-crc") - .Case("nocrypto", "-crypto") - .Case("nofp16", "-fullfp16") - .Case("noprofile", "-spe") - .Case("noras", "-ras") - .Default(nullptr); - if (result) - Features.push_back(result); + if (const char *FeatureName = llvm::AArch64::getArchExtFeature(Feature)) + Features.push_back(FeatureName); else if (Feature == "neon" || Feature == "noneon") D.Diag(diag::err_drv_no_neon_modifier); else @@ -2331,20 +2315,16 @@ std::vector<const char *> &Features) { std::pair<StringRef, StringRef> Split = Mcpu.split("+"); CPU = Split.first; - if (CPU == "cortex-a53" || CPU == "cortex-a57" || - CPU == "cortex-a72" || CPU == "cortex-a35" || CPU == "exynos-m1" || - CPU == "kryo" || CPU == "cortex-a73") { - Features.push_back("+neon"); - Features.push_back("+crc"); - Features.push_back("+crypto"); - } else if (CPU == "cyclone") { - Features.push_back("+neon"); - Features.push_back("+crypto"); - } else if (CPU == "generic") { + + if (CPU == "generic") { Features.push_back("+neon"); } else { - return false; - } + unsigned ArchKind = llvm::AArch64::parseCPUArch(CPU); + unsigned Extersion = llvm::AArch64::getDefaultExtensions(CPU, ArchKind); + + if (!llvm::AArch64::getExtensionFeatures(Extersion, Features)) + return false; + } if (Split.second.size() && !DecodeAArch64Features(D, Split.second, Features)) return false; @@ -2356,20 +2336,13 @@ getAArch64ArchFeaturesFromMarch(const Driver &D, StringRef March, const ArgList &Args, std::vector<const char *> &Features) { + unsigned ArchKind; std::string MarchLowerCase = March.lower(); std::pair<StringRef, StringRef> Split = StringRef(MarchLowerCase).split("+"); - if (Split.first == "armv8-a" || Split.first == "armv8a") { - // ok, no additional features. - } else if (Split.first == "armv8.1-a" || Split.first == "armv8.1a") { - Features.push_back("+v8.1a"); - } else if (Split.first == "armv8.2-a" || Split.first == "armv8.2a" ) { - Features.push_back("+v8.2a"); - } else { - return false; - } - - if (Split.second.size() && !DecodeAArch64Features(D, Split.second, Features)) + ArchKind = llvm::AArch64::parseArch(Split.first); + if (ArchKind == llvm::ARM::AK_INVALID || !llvm::AArch64::getArchFeatures(ArchKind, Features) || + (Split.second.size() && !DecodeAArch64Features(D, Split.second, Features))) return false; return true; Index: lib/Basic/Targets.cpp =================================================================== --- lib/Basic/Targets.cpp +++ lib/Basic/Targets.cpp @@ -5703,15 +5703,7 @@ } bool setCPU(const std::string &Name) override { - bool CPUKnown = llvm::StringSwitch<bool>(Name) - .Case("generic", true) - .Cases("cortex-a53", "cortex-a57", "cortex-a72", - "cortex-a35", "exynos-m1", true) - .Case("cortex-a73", true) - .Case("cyclone", true) - .Case("kryo", true) - .Default(false); - return CPUKnown; + return Name == "generic" || llvm::AArch64::parseCPUArch(Name) != llvm::ARM::AK_INVALID; } void getTargetDefines(const LangOptions &Opts,
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits