================
@@ -1837,15 +1851,18 @@ EmulateInstructionRISCV::GetRegisterInfo(RegisterKind 
reg_kind,
     }
   }
 
-  RegisterInfoPOSIX_riscv64 reg_info(m_arch,
-                                     
RegisterInfoPOSIX_riscv64::eRegsetMaskAll);
-  const RegisterInfo *array = reg_info.GetRegisterInfo();
-  const uint32_t length = reg_info.GetRegisterCount();
-
-  if (reg_index >= length || reg_kind != eRegisterKindLLDB)
-    return {};
-
-  return array[reg_index];
+  switch (m_arch.GetCore()) {
+  case ArchSpec::eCore_riscv32:
+    return GetRegisterInfoHelper(
+        RegisterInfoPOSIX_riscv32(m_arch,
+                                  RegisterInfoPOSIX_riscv32::eRegsetMaskAll),
+        reg_index, reg_kind);
+  default:
----------------
JDevlieghere wrote:

I would prefer to handle `eCore_riscv32` and `eCore_riscv64` explicitly, omit 
the `default` case and instead use an unreachable to make it clear that only 
those two are supported.

https://github.com/llvm/llvm-project/pull/175262
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to