[llvm] [RISCV]Add support for resolving encoding conflicts among vendor specific CSRs (PR #96174)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 4 18:52:17 PDT 2024


================
@@ -538,12 +573,41 @@ void SearchableTableEmitter::emitGenericTable(const GenericTable &Table,
   }
   OS << " };\n";
 
+  // Emit Table for all those indices which will return a range instead of a
+  // single record
+  for (const auto &Index : Table.Indices) {
+    if (Index->ReturnRange) {
+      std::vector<Record *> Entries;
+      Entries.reserve(Table.Entries.size());
+      for (unsigned i = 0; i < Table.Entries.size(); ++i)
+        Entries.emplace_back(Table.Entries[i]);
----------------
topperc wrote:

Does `std::vector<Record *> Entries(Table.Entries.begin(), Table.Entries.end()` work instead of writing your own copy loop?

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


More information about the llvm-commits mailing list