================
@@ -207,27 +208,38 @@ 
ValueObjectRegister::ValueObjectRegister(ExecutionContextScope *exe_scope,
 ValueObjectRegister::~ValueObjectRegister() = default;
 
 CompilerType ValueObjectRegister::GetCompilerTypeImpl() {
-  if (!m_compiler_type.IsValid()) {
-    ExecutionContext exe_ctx(GetExecutionContextRef());
-    if (auto *target = exe_ctx.GetTargetPtr()) {
-      if (auto *exe_module = target->GetExecutableModulePointer()) {
-        auto type_system_or_err =
-            exe_module->GetTypeSystemForLanguage(eLanguageTypeC);
-        if (auto err = type_system_or_err.takeError()) {
-          LLDB_LOG_ERROR(GetLog(LLDBLog::Types), std::move(err),
-                         "Unable to get CompilerType from TypeSystem: {0}");
-        } else {
-          if (auto ts = *type_system_or_err)
-            m_compiler_type = ts->GetBuiltinTypeForEncodingAndBitSize(
-                m_reg_info.encoding, m_reg_info.byte_size * 8);
-        }
-      }
+  ExecutionContext exe_ctx(GetExecutionContextRef());
+  Target *target = exe_ctx.GetTargetPtr();
+  if (target && llvm::isa_and_present<RegisterTypeBuiltin, RegisterTypeVector>(
+                    m_reg_info.register_type)) {
+    CompilerType register_type = target->GetRegisterType(m_reg_info);
+    if (register_type.IsValid())
+      return register_type;
+  }
+
+  if (!m_compiler_type.IsValid() && target) {
+    auto *exe_module = target->GetExecutableModulePointer();
+    if (!exe_module)
+      return m_compiler_type;
+    auto type_system_or_err =
+        exe_module->GetTypeSystemForLanguage(eLanguageTypeC);
+    if (auto err = type_system_or_err.takeError()) {
+      LLDB_LOG_ERROR(GetLog(LLDBLog::Types), std::move(err),
+                     "Unable to get CompilerType from TypeSystem: {0}");
+    } else {
+      if (auto ts = *type_system_or_err)
+        m_compiler_type = ts->GetBuiltinTypeForEncodingAndBitSize(
+            m_reg_info.encoding, m_reg_info.byte_size * 8);
     }
   }
   return m_compiler_type;
 }
 
 ConstString ValueObjectRegister::GetTypeName() {
+  if (llvm::isa_and_present<RegisterTypeBuiltin, RegisterTypeVector>(
----------------
DavidSpickett wrote:

This doesn't follow the caching behaviour of the existing code, should it?

if m_type_name is empty, get the type name and save it, by whatever means. Then 
return m_type_name.

Is there a reason to go to the compiler type each time for builtin and vector? 
Also is there a reason to only do that for those register types, and not for 
flags?

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

Reply via email to