From 951bb68ce262545bdb0bff536256e0514daf0046 Mon Sep 17 00:00:00 2001 From: Alexandros Lamprineas Date: Sun, 14 Jul 2019 20:31:15 +0000 Subject: [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 llvm-svn: 366031 --- llvm/lib/Support/ARMTargetParser.cpp | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'llvm/lib/Support/ARMTargetParser.cpp') diff --git a/llvm/lib/Support/ARMTargetParser.cpp b/llvm/lib/Support/ARMTargetParser.cpp index 27d1e5527be..be948cfc95d 100644 --- a/llvm/lib/Support/ARMTargetParser.cpp +++ b/llvm/lib/Support/ARMTargetParser.cpp @@ -490,16 +490,30 @@ static unsigned findDoublePrecisionFPU(unsigned InputFPUKind) { return ARM::FK_INVALID; } +static unsigned getAEKID(StringRef ArchExtName) { + for (const auto AE : ARM::ARCHExtNames) + if (AE.getName() == ArchExtName) + return AE.ID; + return ARM::AEK_INVALID; +} + bool ARM::appendArchExtFeatures( StringRef CPU, ARM::ArchKind AK, StringRef ArchExt, std::vector &Features) { - StringRef StandardFeature = getArchExtFeature(ArchExt); - if (!StandardFeature.empty()) { - Features.push_back(StandardFeature); - return true; - } + size_t StartingNumFeatures = Features.size(); const bool Negated = stripNegationPrefix(ArchExt); + unsigned ID = getAEKID(ArchExt); + + if (ID == AEK_INVALID) + return false; + + for (const auto AE : ARCHExtNames) { + if (Negated && (AE.ID & ID) == ID && AE.NegFeature) + Features.push_back(AE.NegFeature); + else if (AE.ID == ID && AE.Feature) + Features.push_back(AE.Feature); + } if (CPU == "") CPU = "generic"; @@ -519,7 +533,7 @@ bool ARM::appendArchExtFeatures( } return ARM::getFPUFeatures(FPUKind, Features); } - return false; + return StartingNumFeatures != Features.size(); } StringRef ARM::getHWDivName(unsigned HWDivKind) { -- cgit v1.2.3