================
@@ -14156,6 +14157,84 @@
CodeGenFunction::EmitAArch64CpuSupports(ArrayRef<StringRef> FeaturesStrs) {
return Result;
}
+llvm::SmallVector<llvm::Value *>
+CodeGenFunction::EmitRISCVExtSupports(ArrayRef<StringRef> FeaturesStrs) {
+ auto BaseExtReqs = llvm::RISCV::getBaseExtensionKey(FeaturesStrs);
+ auto IMACompatibleExtReqs =
+ llvm::RISCV::getIMACompatibleExtensionKey(FeaturesStrs);
+
+ // check whether all FeatureStrs are available for hwprobe.
+ llvm::SmallVector<StringRef> UnsupportByHwprobe;
+ llvm::StringSet<> ImpliedExtBySupportExt;
+ for (unsigned Idx = 0; Idx < FeaturesStrs.size(); Idx++) {
+ if (BaseExtReqs[Idx] == 0 && IMACompatibleExtReqs[Idx] == 0)
+ UnsupportByHwprobe.push_back(FeaturesStrs[Idx]);
+ else
+ ImpliedExtBySupportExt.insert(FeaturesStrs[Idx].str());
+ }
+
+ // Repeatly find ImpliedExts until no longer found new.
+ bool Changed = true;
+ while (Changed) {
+ unsigned Size = ImpliedExtBySupportExt.size();
+ for (auto Ext : ImpliedExtBySupportExt.keys()) {
+ auto ImpliedExts = llvm::RISCV::getImpliedExts(Ext);
+ for (auto ImpliedExt : ImpliedExts)
+ ImpliedExtBySupportExt.insert(ImpliedExt);
+ }
+ if (Size == ImpliedExtBySupportExt.size())
----------------
topperc wrote:
Can you use the return value from `insert` to tell if the insert happened?
https://github.com/llvm/llvm-project/pull/85786
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits