Skip to content

Commit fdd0e5d

Browse files
tmatheson-armAlexisPerry
authored andcommitted
[AArch64][TargetParser] Split FMV and extensions (llvm#92882)
FMV extensions are really just mappings from FMV feature names to lists of backend features for codegen. Split them out into their own separate file.
1 parent 8f462fe commit fdd0e5d

File tree

14 files changed

+283
-256
lines changed

14 files changed

+283
-256
lines changed

clang/include/clang/Basic/TargetInfo.h

-5
Original file line numberDiff line numberDiff line change
@@ -1400,11 +1400,6 @@ class TargetInfo : public TransferrableTargetInfo,
14001400
return true;
14011401
}
14021402

1403-
/// For given feature return dependent ones.
1404-
virtual StringRef getFeatureDependencies(StringRef Feature) const {
1405-
return StringRef();
1406-
}
1407-
14081403
struct BranchProtectionInfo {
14091404
LangOptions::SignReturnAddressScopeKind SignReturnAddr;
14101405
LangOptions::SignReturnAddressKeyKind SignKey;

clang/lib/AST/ASTContext.cpp

+3-7
Original file line numberDiff line numberDiff line change
@@ -13698,14 +13698,10 @@ QualType ASTContext::getCorrespondingSignedFixedPointType(QualType Ty) const {
1369813698
static std::vector<std::string> getFMVBackendFeaturesFor(
1369913699
const llvm::SmallVectorImpl<StringRef> &FMVFeatStrings) {
1370013700
std::vector<std::string> BackendFeats;
13701-
for (StringRef F : FMVFeatStrings) {
13702-
if (auto FMVExt = llvm::AArch64::parseArchExtension(F)) {
13703-
SmallVector<StringRef, 8> Feats;
13704-
FMVExt->DependentFeatures.split(Feats, ',', -1, false);
13705-
for (StringRef F : Feats)
13701+
for (StringRef F : FMVFeatStrings)
13702+
if (auto FMVExt = llvm::AArch64::parseFMVExtension(F))
13703+
for (StringRef F : FMVExt->getImpliedFeatures())
1370613704
BackendFeats.push_back(F.str());
13707-
}
13708-
}
1370913705
return BackendFeats;
1371013706
}
1371113707

clang/lib/Basic/Targets/AArch64.cpp

+8-12
Original file line numberDiff line numberDiff line change
@@ -673,34 +673,30 @@ AArch64TargetInfo::getVScaleRange(const LangOptions &LangOpts) const {
673673
unsigned AArch64TargetInfo::multiVersionSortPriority(StringRef Name) const {
674674
if (Name == "default")
675675
return 0;
676-
if (auto Ext = llvm::AArch64::parseArchExtension(Name))
677-
return Ext->FmvPriority;
676+
if (auto Ext = llvm::AArch64::parseFMVExtension(Name))
677+
return Ext->Priority;
678678
return 0;
679679
}
680680

681681
unsigned AArch64TargetInfo::multiVersionFeatureCost() const {
682682
// Take the maximum priority as per feature cost, so more features win.
683-
return llvm::AArch64::ExtensionInfo::MaxFMVPriority;
683+
constexpr unsigned MaxFMVPriority = 1000;
684+
return MaxFMVPriority;
684685
}
685686

686687
bool AArch64TargetInfo::doesFeatureAffectCodeGen(StringRef Name) const {
687-
if (auto Ext = llvm::AArch64::parseArchExtension(Name))
688-
return !Ext->DependentFeatures.empty();
688+
// FMV extensions which imply no backend features do not affect codegen.
689+
if (auto Ext = llvm::AArch64::parseFMVExtension(Name))
690+
return !Ext->Features.empty();
689691
return false;
690692
}
691693

692-
StringRef AArch64TargetInfo::getFeatureDependencies(StringRef Name) const {
693-
if (auto Ext = llvm::AArch64::parseArchExtension(Name))
694-
return Ext->DependentFeatures;
695-
return StringRef();
696-
}
697-
698694
bool AArch64TargetInfo::validateCpuSupports(StringRef FeatureStr) const {
699695
// CPU features might be separated by '+', extract them and check
700696
llvm::SmallVector<StringRef, 8> Features;
701697
FeatureStr.split(Features, "+");
702698
for (auto &Feature : Features)
703-
if (!llvm::AArch64::parseArchExtension(Feature.trim()).has_value())
699+
if (!llvm::AArch64::parseFMVExtension(Feature.trim()).has_value())
704700
return false;
705701
return true;
706702
}

clang/lib/Basic/Targets/AArch64.h

-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@ class LLVM_LIBRARY_VISIBILITY AArch64TargetInfo : public TargetInfo {
151151
std::optional<std::pair<unsigned, unsigned>>
152152
getVScaleRange(const LangOptions &LangOpts) const override;
153153
bool doesFeatureAffectCodeGen(StringRef Name) const override;
154-
StringRef getFeatureDependencies(StringRef Name) const override;
155154
bool validateCpuSupports(StringRef FeatureStr) const override;
156155
bool hasFeature(StringRef Feature) const override;
157156
void setFeatureEnabled(llvm::StringMap<bool> &Features, StringRef Name,

clang/lib/CodeGen/CGBuiltin.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -14189,7 +14189,7 @@ Value *CodeGenFunction::EmitAArch64CpuSupports(const CallExpr *E) {
1418914189
ArgStr.split(Features, "+");
1419014190
for (auto &Feature : Features) {
1419114191
Feature = Feature.trim();
14192-
if (!llvm::AArch64::parseArchExtension(Feature))
14192+
if (!llvm::AArch64::parseFMVExtension(Feature))
1419314193
return Builder.getFalse();
1419414194
if (Feature != "default")
1419514195
Features.push_back(Feature);

clang/lib/CodeGen/Targets/AArch64.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -965,7 +965,7 @@ void AArch64ABIInfo::appendAttributeMangling(StringRef AttrStr,
965965

966966
llvm::SmallDenseSet<StringRef, 8> UniqueFeats;
967967
for (auto &Feat : Features)
968-
if (auto Ext = llvm::AArch64::parseArchExtension(Feat))
968+
if (auto Ext = llvm::AArch64::parseFMVExtension(Feat))
969969
if (UniqueFeats.insert(Ext->Name).second)
970970
Out << 'M' << Ext->Name;
971971
}

clang/test/CodeGen/aarch64-fmv-dependencies.c

+46-46
Original file line numberDiff line numberDiff line change
@@ -192,49 +192,49 @@ int caller() {
192192
return fmv();
193193
}
194194

195-
// CHECK: attributes #[[ATTR0:[0-9]+]] = { {{.*}} "target-features"="+fp-armv8,+neon,+outline-atomics,+v8a"
196-
// CHECK: attributes #[[bf16_ebf16:[0-9]+]] = { {{.*}} "target-features"="+bf16,+fp-armv8,+neon,+outline-atomics,+v8a"
197-
// CHECK: attributes #[[bti:[0-9]+]] = { {{.*}} "target-features"="+bti,+fp-armv8,+neon,+outline-atomics,+v8a"
198-
// CHECK: attributes #[[crc:[0-9]+]] = { {{.*}} "target-features"="+crc,+fp-armv8,+neon,+outline-atomics,+v8a"
199-
// CHECK: attributes #[[dit:[0-9]+]] = { {{.*}} "target-features"="+dit,+fp-armv8,+neon,+outline-atomics,+v8a"
200-
// CHECK: attributes #[[dotprod:[0-9]+]] = { {{.*}} "target-features"="+dotprod,+fp-armv8,+neon,+outline-atomics,+v8a"
201-
// CHECK: attributes #[[dpb:[0-9]+]] = { {{.*}} "target-features"="+ccpp,+fp-armv8,+neon,+outline-atomics,+v8a"
202-
// CHECK: attributes #[[dpb2:[0-9]+]] = { {{.*}} "target-features"="+ccdp,+ccpp,+fp-armv8,+neon,+outline-atomics,+v8a"
203-
// CHECK: attributes #[[f32mm:[0-9]+]] = { {{.*}} "target-features"="+f32mm,+fp-armv8,+fullfp16,+neon,+outline-atomics,+sve,+v8a"
204-
// CHECK: attributes #[[f64mm:[0-9]+]] = { {{.*}} "target-features"="+f64mm,+fp-armv8,+fullfp16,+neon,+outline-atomics,+sve,+v8a"
205-
// CHECK: attributes #[[fcma:[0-9]+]] = { {{.*}} "target-features"="+complxnum,+fp-armv8,+neon,+outline-atomics,+v8a"
206-
// CHECK: attributes #[[flagm:[0-9]+]] = { {{.*}} "target-features"="+flagm,+fp-armv8,+neon,+outline-atomics,+v8a"
207-
// CHECK: attributes #[[flagm2:[0-9]+]] = { {{.*}} "target-features"="+altnzcv,+flagm,+fp-armv8,+neon,+outline-atomics,+v8a"
208-
// CHECK: attributes #[[fp16:[0-9]+]] = { {{.*}} "target-features"="+fp-armv8,+fullfp16,+neon,+outline-atomics,+v8a"
209-
// CHECK: attributes #[[fp16fml:[0-9]+]] = { {{.*}} "target-features"="+fp-armv8,+fp16fml,+fullfp16,+neon,+outline-atomics,+v8a"
210-
// CHECK: attributes #[[frintts:[0-9]+]] = { {{.*}} "target-features"="+fp-armv8,+fptoint,+neon,+outline-atomics,+v8a"
211-
// CHECK: attributes #[[i8mm:[0-9]+]] = { {{.*}} "target-features"="+fp-armv8,+i8mm,+neon,+outline-atomics,+v8a"
212-
// CHECK: attributes #[[jscvt:[0-9]+]] = { {{.*}} "target-features"="+fp-armv8,+jsconv,+neon,+outline-atomics,+v8a"
213-
// CHECK: attributes #[[ls64_accdata:[0-9]+]] = { {{.*}} "target-features"="+fp-armv8,+ls64,+neon,+outline-atomics,+v8a"
214-
// CHECK: attributes #[[lse:[0-9]+]] = { {{.*}} "target-features"="+fp-armv8,+lse,+neon,+outline-atomics,+v8a"
215-
// CHECK: attributes #[[memtag2:[0-9]+]] = { {{.*}} "target-features"="+fp-armv8,+mte,+neon,+outline-atomics,+v8a"
216-
// CHECK: attributes #[[mops:[0-9]+]] = { {{.*}} "target-features"="+fp-armv8,+mops,+neon,+outline-atomics,+v8a"
217-
// CHECK: attributes #[[pmull:[0-9]+]] = { {{.*}} "target-features"="+aes,+fp-armv8,+neon,+outline-atomics,+v8a"
218-
// CHECK: attributes #[[predres:[0-9]+]] = { {{.*}} "target-features"="+fp-armv8,+neon,+outline-atomics,+predres,+v8a"
219-
// CHECK: attributes #[[rcpc:[0-9]+]] = { {{.*}} "target-features"="+fp-armv8,+neon,+outline-atomics,+rcpc,+v8a"
220-
// CHECK: attributes #[[rcpc3:[0-9]+]] = { {{.*}} "target-features"="+fp-armv8,+neon,+outline-atomics,+rcpc,+rcpc3,+v8a"
221-
// CHECK: attributes #[[rdm:[0-9]+]] = { {{.*}} "target-features"="+fp-armv8,+neon,+outline-atomics,+rdm,+v8a"
222-
// CHECK: attributes #[[rng:[0-9]+]] = { {{.*}} "target-features"="+fp-armv8,+neon,+outline-atomics,+rand,+v8a"
223-
// CHECK: attributes #[[sb:[0-9]+]] = { {{.*}} "target-features"="+fp-armv8,+neon,+outline-atomics,+sb,+v8a"
224-
// CHECK: attributes #[[sha2:[0-9]+]] = { {{.*}} "target-features"="+fp-armv8,+neon,+outline-atomics,+sha2,+v8a"
225-
// CHECK: attributes #[[sha3:[0-9]+]] = { {{.*}} "target-features"="+fp-armv8,+neon,+outline-atomics,+sha2,+sha3,+v8a"
226-
// CHECK: attributes #[[sm4:[0-9]+]] = { {{.*}} "target-features"="+fp-armv8,+neon,+outline-atomics,+sm4,+v8a"
227-
// CHECK: attributes #[[sme:[0-9]+]] = { {{.*}} "target-features"="+bf16,+fp-armv8,+neon,+outline-atomics,+sme,+v8a"
228-
// CHECK: attributes #[[sme_f64f64:[0-9]+]] = { {{.*}} "target-features"="+bf16,+fp-armv8,+neon,+outline-atomics,+sme,+sme-f64f64,+v8a"
229-
// CHECK: attributes #[[sme_i16i64:[0-9]+]] = { {{.*}} "target-features"="+bf16,+fp-armv8,+neon,+outline-atomics,+sme,+sme-i16i64,+v8a"
230-
// CHECK: attributes #[[sme2:[0-9]+]] = { {{.*}} "target-features"="+bf16,+fp-armv8,+neon,+outline-atomics,+sme,+sme2,+v8a"
231-
// CHECK: attributes #[[ssbs2:[0-9]+]] = { {{.*}} "target-features"="+fp-armv8,+neon,+outline-atomics,+ssbs,+v8a"
232-
// CHECK: attributes #[[sve:[0-9]+]] = { {{.*}} "target-features"="+fp-armv8,+fullfp16,+neon,+outline-atomics,+sve,+v8a"
233-
// CHECK: attributes #[[sve_bf16_ebf16:[0-9]+]] = { {{.*}} "target-features"="+bf16,+fp-armv8,+fullfp16,+neon,+outline-atomics,+sve,+v8a"
234-
// CHECK: attributes #[[sve_i8mm:[0-9]+]] = { {{.*}} "target-features"="+fp-armv8,+fullfp16,+i8mm,+neon,+outline-atomics,+sve,+v8a"
235-
// CHECK: attributes #[[sve2:[0-9]+]] = { {{.*}} "target-features"="+fp-armv8,+fullfp16,+neon,+outline-atomics,+sve,+sve2,+v8a"
236-
// CHECK: attributes #[[sve2_aes_sve2_pmull128:[0-9]+]] = { {{.*}} "target-features"="+fp-armv8,+fullfp16,+neon,+outline-atomics,+sve,+sve2,+sve2-aes,+v8a"
237-
// CHECK: attributes #[[sve2_bitperm:[0-9]+]] = { {{.*}} "target-features"="+fp-armv8,+fullfp16,+neon,+outline-atomics,+sve,+sve2,+sve2-bitperm,+v8a"
238-
// CHECK: attributes #[[sve2_sha3:[0-9]+]] = { {{.*}} "target-features"="+fp-armv8,+fullfp16,+neon,+outline-atomics,+sve,+sve2,+sve2-sha3,+v8a"
239-
// CHECK: attributes #[[sve2_sm4:[0-9]+]] = { {{.*}} "target-features"="+fp-armv8,+fullfp16,+neon,+outline-atomics,+sve,+sve2,+sve2-sm4,+v8a"
240-
// CHECK: attributes #[[wfxt:[0-9]+]] = { {{.*}} "target-features"="+fp-armv8,+neon,+outline-atomics,+v8a,+wfxt"
195+
// CHECK: attributes #[[ATTR0]] = { {{.*}} "target-features"="+fp-armv8,+neon,+outline-atomics,+v8a"
196+
// CHECK: attributes #[[bf16_ebf16]] = { {{.*}} "target-features"="+bf16,+fp-armv8,+neon,+outline-atomics,+v8a"
197+
// CHECK: attributes #[[bti]] = { {{.*}} "target-features"="+bti,+fp-armv8,+neon,+outline-atomics,+v8a"
198+
// CHECK: attributes #[[crc]] = { {{.*}} "target-features"="+crc,+fp-armv8,+neon,+outline-atomics,+v8a"
199+
// CHECK: attributes #[[dit]] = { {{.*}} "target-features"="+dit,+fp-armv8,+neon,+outline-atomics,+v8a"
200+
// CHECK: attributes #[[dotprod]] = { {{.*}} "target-features"="+dotprod,+fp-armv8,+neon,+outline-atomics,+v8a"
201+
// CHECK: attributes #[[dpb]] = { {{.*}} "target-features"="+ccpp,+fp-armv8,+neon,+outline-atomics,+v8a"
202+
// CHECK: attributes #[[dpb2]] = { {{.*}} "target-features"="+ccdp,+ccpp,+fp-armv8,+neon,+outline-atomics,+v8a"
203+
// CHECK: attributes #[[f32mm]] = { {{.*}} "target-features"="+f32mm,+fp-armv8,+fullfp16,+neon,+outline-atomics,+sve,+v8a"
204+
// CHECK: attributes #[[f64mm]] = { {{.*}} "target-features"="+f64mm,+fp-armv8,+fullfp16,+neon,+outline-atomics,+sve,+v8a"
205+
// CHECK: attributes #[[fcma]] = { {{.*}} "target-features"="+complxnum,+fp-armv8,+neon,+outline-atomics,+v8a"
206+
// CHECK: attributes #[[flagm]] = { {{.*}} "target-features"="+flagm,+fp-armv8,+neon,+outline-atomics,+v8a"
207+
// CHECK: attributes #[[flagm2]] = { {{.*}} "target-features"="+altnzcv,+flagm,+fp-armv8,+neon,+outline-atomics,+v8a"
208+
// CHECK: attributes #[[fp16]] = { {{.*}} "target-features"="+fp-armv8,+fullfp16,+neon,+outline-atomics,+v8a"
209+
// CHECK: attributes #[[fp16fml]] = { {{.*}} "target-features"="+fp-armv8,+fp16fml,+fullfp16,+neon,+outline-atomics,+v8a"
210+
// CHECK: attributes #[[frintts]] = { {{.*}} "target-features"="+fp-armv8,+fptoint,+neon,+outline-atomics,+v8a"
211+
// CHECK: attributes #[[i8mm]] = { {{.*}} "target-features"="+fp-armv8,+i8mm,+neon,+outline-atomics,+v8a"
212+
// CHECK: attributes #[[jscvt]] = { {{.*}} "target-features"="+fp-armv8,+jsconv,+neon,+outline-atomics,+v8a"
213+
// CHECK: attributes #[[ls64_accdata]] = { {{.*}} "target-features"="+fp-armv8,+ls64,+neon,+outline-atomics,+v8a"
214+
// CHECK: attributes #[[lse]] = { {{.*}} "target-features"="+fp-armv8,+lse,+neon,+outline-atomics,+v8a"
215+
// CHECK: attributes #[[memtag2]] = { {{.*}} "target-features"="+fp-armv8,+mte,+neon,+outline-atomics,+v8a"
216+
// CHECK: attributes #[[mops]] = { {{.*}} "target-features"="+fp-armv8,+mops,+neon,+outline-atomics,+v8a"
217+
// CHECK: attributes #[[pmull]] = { {{.*}} "target-features"="+aes,+fp-armv8,+neon,+outline-atomics,+v8a"
218+
// CHECK: attributes #[[predres]] = { {{.*}} "target-features"="+fp-armv8,+neon,+outline-atomics,+predres,+v8a"
219+
// CHECK: attributes #[[rcpc]] = { {{.*}} "target-features"="+fp-armv8,+neon,+outline-atomics,+rcpc,+v8a"
220+
// CHECK: attributes #[[rcpc3]] = { {{.*}} "target-features"="+fp-armv8,+neon,+outline-atomics,+rcpc,+rcpc3,+v8a"
221+
// CHECK: attributes #[[rdm]] = { {{.*}} "target-features"="+fp-armv8,+neon,+outline-atomics,+rdm,+v8a"
222+
// CHECK: attributes #[[rng]] = { {{.*}} "target-features"="+fp-armv8,+neon,+outline-atomics,+rand,+v8a"
223+
// CHECK: attributes #[[sb]] = { {{.*}} "target-features"="+fp-armv8,+neon,+outline-atomics,+sb,+v8a"
224+
// CHECK: attributes #[[sha2]] = { {{.*}} "target-features"="+fp-armv8,+neon,+outline-atomics,+sha2,+v8a"
225+
// CHECK: attributes #[[sha3]] = { {{.*}} "target-features"="+fp-armv8,+neon,+outline-atomics,+sha2,+sha3,+v8a"
226+
// CHECK: attributes #[[sm4]] = { {{.*}} "target-features"="+fp-armv8,+neon,+outline-atomics,+sm4,+v8a"
227+
// CHECK: attributes #[[sme]] = { {{.*}} "target-features"="+bf16,+fp-armv8,+neon,+outline-atomics,+sme,+v8a"
228+
// CHECK: attributes #[[sme_f64f64]] = { {{.*}} "target-features"="+bf16,+fp-armv8,+neon,+outline-atomics,+sme,+sme-f64f64,+v8a"
229+
// CHECK: attributes #[[sme_i16i64]] = { {{.*}} "target-features"="+bf16,+fp-armv8,+neon,+outline-atomics,+sme,+sme-i16i64,+v8a"
230+
// CHECK: attributes #[[sme2]] = { {{.*}} "target-features"="+bf16,+fp-armv8,+neon,+outline-atomics,+sme,+sme2,+v8a"
231+
// CHECK: attributes #[[ssbs2]] = { {{.*}} "target-features"="+fp-armv8,+neon,+outline-atomics,+ssbs,+v8a"
232+
// CHECK: attributes #[[sve]] = { {{.*}} "target-features"="+fp-armv8,+fullfp16,+neon,+outline-atomics,+sve,+v8a"
233+
// CHECK: attributes #[[sve_bf16_ebf16]] = { {{.*}} "target-features"="+bf16,+fp-armv8,+fullfp16,+neon,+outline-atomics,+sve,+v8a"
234+
// CHECK: attributes #[[sve_i8mm]] = { {{.*}} "target-features"="+fp-armv8,+fullfp16,+i8mm,+neon,+outline-atomics,+sve,+v8a"
235+
// CHECK: attributes #[[sve2]] = { {{.*}} "target-features"="+fp-armv8,+fullfp16,+neon,+outline-atomics,+sve,+sve2,+v8a"
236+
// CHECK: attributes #[[sve2_aes_sve2_pmull128]] = { {{.*}} "target-features"="+fp-armv8,+fullfp16,+neon,+outline-atomics,+sve,+sve2,+sve2-aes,+v8a"
237+
// CHECK: attributes #[[sve2_bitperm]] = { {{.*}} "target-features"="+fp-armv8,+fullfp16,+neon,+outline-atomics,+sve,+sve2,+sve2-bitperm,+v8a"
238+
// CHECK: attributes #[[sve2_sha3]] = { {{.*}} "target-features"="+fp-armv8,+fullfp16,+neon,+outline-atomics,+sve,+sve2,+sve2-sha3,+v8a"
239+
// CHECK: attributes #[[sve2_sm4]] = { {{.*}} "target-features"="+fp-armv8,+fullfp16,+neon,+outline-atomics,+sve,+sve2,+sve2-sm4,+v8a"
240+
// CHECK: attributes #[[wfxt]] = { {{.*}} "target-features"="+fp-armv8,+neon,+outline-atomics,+v8a,+wfxt"

llvm/include/llvm/TargetParser/AArch64TargetParser.h

+25-7
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
#include "llvm/ADT/StringMap.h"
2020
#include "llvm/ADT/StringRef.h"
2121
#include "llvm/Support/VersionTuple.h"
22+
#include "llvm/Support/raw_ostream.h"
23+
#include "llvm/TargetParser/SubtargetFeature.h"
2224
#include <array>
2325
#include <vector>
2426

@@ -120,18 +122,29 @@ struct ExtensionInfo {
120122
// extensions representation in the bitfield.
121123
StringRef Feature; // -mattr enable string, e.g. "+spe"
122124
StringRef NegFeature; // -mattr disable string, e.g. "-spe"
123-
CPUFeatures CPUFeature; // Function Multi Versioning (FMV) bitfield value
124-
// set in __aarch64_cpu_features
125-
StringRef DependentFeatures; // FMV enabled features string,
126-
// e.g. "+dotprod,+fp-armv8,+neon"
127-
unsigned FmvPriority; // FMV feature priority
128-
static constexpr unsigned MaxFMVPriority =
129-
1000; // Maximum priority for FMV feature
130125
};
131126

132127
#define EMIT_EXTENSIONS
133128
#include "llvm/TargetParser/AArch64TargetParserDef.inc"
134129

130+
struct FMVInfo {
131+
StringRef Name; // The target_version/target_clones spelling.
132+
CPUFeatures Bit; // Index of the bit in the FMV feature bitset.
133+
StringRef Features; // List of SubtargetFeatures to enable.
134+
unsigned Priority; // FMV priority.
135+
FMVInfo(StringRef Name, CPUFeatures Bit, StringRef Features,
136+
unsigned Priority)
137+
: Name(Name), Bit(Bit), Features(Features), Priority(Priority){};
138+
139+
SmallVector<StringRef, 8> getImpliedFeatures() {
140+
SmallVector<StringRef, 8> Feats;
141+
Features.split(Feats, ',', -1, false); // discard empty strings
142+
return Feats;
143+
}
144+
};
145+
146+
const std::vector<FMVInfo> &getFMVInfo();
147+
135148
// Represents a dependency between two architecture extensions. Later is the
136149
// feature which was added to the architecture after Earlier, and expands the
137150
// functionality provided by it. If Later is enabled, then Earlier will also be
@@ -281,6 +294,8 @@ struct ExtensionSet {
281294
Features.emplace_back(T(E.NegFeature));
282295
}
283296
}
297+
298+
void dump() const;
284299
};
285300

286301
// Name alias.
@@ -313,6 +328,9 @@ std::optional<ExtensionInfo> targetFeatureToExtension(StringRef TargetFeature);
313328
// Parse a name as defined by the Extension class in tablegen.
314329
std::optional<ExtensionInfo> parseArchExtension(StringRef Extension);
315330

331+
// Parse a name as defined by the FMVInfo class in tablegen.
332+
std::optional<FMVInfo> parseFMVExtension(StringRef Extension);
333+
316334
// Given the name of a CPU or alias, return the correponding CpuInfo.
317335
std::optional<CpuInfo> parseCpu(StringRef Name);
318336
// Used by target parser tests

llvm/lib/Target/AArch64/AArch64.td

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ include "llvm/Target/Target.td"
1919
// Subtarget features.
2020
//===----------------------------------------------------------------------===//
2121
include "AArch64Features.td"
22+
include "AArch64FMV.td"
2223

2324
//===----------------------------------------------------------------------===//
2425
// Register File Description

0 commit comments

Comments
 (0)