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

Garvit Gupta via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 2 03:01:17 PDT 2024


================
@@ -426,16 +428,25 @@ void SearchableTableEmitter::emitLookupFunction(const GenericTable &Table,
     OS << "    return nullptr;\n\n";
   }
 
-  OS << "  struct KeyType {\n";
-  for (const auto &Field : Index.Fields) {
-    OS << "    " << searchableFieldType(Table, Index, Field, TypeInTempStruct)
-       << " " << Field.Name << ";\n";
+  bool ShouldReturnRange = Index.ReturnRange;
+  if (ShouldReturnRange)
----------------
quic-garvgupt wrote:

std::equal_range expects both arguments to be of same type unlike in std::lower_bound where both can be of different type.

auto Idx = std::lower_bound(Table.begin(), Table.end(), Key,
    [](const **SysReg** &LHS, const **KeyType** &RHS) {
    
auto It = std::equal_range(Table.begin(), Table.end(), Key,
    [](const **SysReg** &LHS, const **SysReg** &RHS) {

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


More information about the llvm-commits mailing list