[clang] [llvm] [RISCV][FMV] Support target_clones (PR #85786)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 8 18:03:18 PDT 2024
================
@@ -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
More information about the llvm-commits
mailing list