llvm.org GIT mirror llvm / ae3eca0
[TargetParser][ARM] Account dependencies when processing target features Teaches ARM::appendArchExtFeatures to account dependencies when processing target features: i.e. when you say -march=armv8.1-m.main+mve.fp+nofp it means mve.fp should get discarded too. (Split from D63936) Differential Revision: https://reviews.llvm.org/D64048 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366031 91177308-0d34-0410-b5e6-96231b3b80d8 Alexandros Lamprineas a month ago
2 changed file(s) with 23 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
148148 ARM_ARCH_EXT_NAME("dsp", ARM::AEK_DSP, "+dsp", "-dsp")
149149 ARM_ARCH_EXT_NAME("fp", ARM::AEK_FP, nullptr, nullptr)
150150 ARM_ARCH_EXT_NAME("fp.dp", ARM::AEK_FP_DP, nullptr, nullptr)
151 ARM_ARCH_EXT_NAME("mve", ARM::AEK_SIMD, "+mve", "-mve")
152 ARM_ARCH_EXT_NAME("mve.fp", (ARM::AEK_SIMD | ARM::AEK_FP), "+mve.fp", "-mve.fp")
151 ARM_ARCH_EXT_NAME("mve", (ARM::AEK_DSP | ARM::AEK_SIMD), "+mve", "-mve")
152 ARM_ARCH_EXT_NAME("mve.fp", (ARM::AEK_DSP | ARM::AEK_SIMD | ARM::AEK_FP), "+mve.fp", "-mve.fp")
153153 ARM_ARCH_EXT_NAME("idiv", (ARM::AEK_HWDIVARM | ARM::AEK_HWDIVTHUMB), nullptr, nullptr)
154154 ARM_ARCH_EXT_NAME("mp", ARM::AEK_MP, nullptr, nullptr)
155155 ARM_ARCH_EXT_NAME("simd", ARM::AEK_SIMD, nullptr, nullptr)
489489 return ARM::FK_INVALID;
490490 }
491491
492 static unsigned getAEKID(StringRef ArchExtName) {
493 for (const auto AE : ARM::ARCHExtNames)
494 if (AE.getName() == ArchExtName)
495 return AE.ID;
496 return ARM::AEK_INVALID;
497 }
498
492499 bool ARM::appendArchExtFeatures(
493500 StringRef CPU, ARM::ArchKind AK, StringRef ArchExt,
494501 std::vector &Features) {
495 StringRef StandardFeature = getArchExtFeature(ArchExt);
496 if (!StandardFeature.empty()) {
497 Features.push_back(StandardFeature);
498 return true;
499 }
500
502
503 size_t StartingNumFeatures = Features.size();
501504 const bool Negated = stripNegationPrefix(ArchExt);
505 unsigned ID = getAEKID(ArchExt);
506
507 if (ID == AEK_INVALID)
508 return false;
509
510 for (const auto AE : ARCHExtNames) {
511 if (Negated && (AE.ID & ID) == ID && AE.NegFeature)
512 Features.push_back(AE.NegFeature);
513 else if (AE.ID == ID && AE.Feature)
514 Features.push_back(AE.Feature);
515 }
502516
503517 if (CPU == "")
504518 CPU = "generic";
518532 }
519533 return ARM::getFPUFeatures(FPUKind, Features);
520534 }
521 return false;
535 return StartingNumFeatures != Features.size();
522536 }
523537
524538 StringRef ARM::getHWDivName(unsigned HWDivKind) {