[clang] [llvm] [Reland] [PowerPC] frontend get target feature from backend with cpu name (PR #144594)

Sam Elliott via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 19 12:28:00 PDT 2025


================
@@ -190,6 +192,31 @@ insertWaveSizeFeature(StringRef GPU, const Triple &T,
                       StringMap<bool> &Features);
 
 } // namespace AMDGPU
+
+struct BasicSubtargetFeatureKV {
+  const char *Key;         ///< K-V key string
+  unsigned Value;          ///< K-V integer value
+  FeatureBitArray Implies; ///< K-V bit mask
+};
+
+/// Used to provide key value pairs for feature and CPU bit flags.
+struct BasicSubtargetSubTypeKV {
+  const char *Key;         ///< K-V key string
+  FeatureBitArray Implies; ///< K-V bit mask
+
+  /// Compare routine for std::lower_bound
+  bool operator<(StringRef S) const { return StringRef(Key) < S; }
+
+  /// Compare routine for std::is_sorted.
+  bool operator<(const BasicSubtargetSubTypeKV &Other) const {
+    return StringRef(Key) < StringRef(Other.Key);
+  }
+};
----------------
lenary wrote:

I see. That's quite annoying, I wonder if there's a better way of factoring these very similar definitions, in the hope we can maybe pull out `SchedModel`. I'll think about this a bit more.

https://github.com/llvm/llvm-project/pull/144594


More information about the llvm-commits mailing list