[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 Jun 20 08:10:54 PDT 2024


================
@@ -540,10 +577,20 @@ void SearchableTableEmitter::emitGenericTable(const GenericTable &Table,
 
   // Indexes are sorted "{ Thing, PrimaryIdx }" arrays, so that a binary
   // search can be performed by "Thing".
-  if (Table.PrimaryKey)
-    emitLookupFunction(Table, *Table.PrimaryKey, true, OS);
+  if (Table.PrimaryKey) {
+    auto &Index = *Table.PrimaryKey;
+    // Two lookupfunction functions need to be generated to allow more than one
+    // lookup signature for the primary key lookup : first will return a SysReg
+    // that matches the primary key, second will populate a vector passed as
+    // argument with all the SysRegs that match the primary key.
+    emitLookupFunction(Table, Index, /*IsPrimary=*/true,
----------------
topperc wrote:

Rather than emitting two different functions, can we have a flag in tablegen that indicates whether a table should have a single result or a range of results.

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


More information about the llvm-commits mailing list