[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 01/33] target/alpha: Tidy up alpha_cpu_class_by_name()
From: |
Gavin Shan |
Subject: |
[PATCH v4 01/33] target/alpha: Tidy up alpha_cpu_class_by_name() |
Date: |
Thu, 2 Nov 2023 10:24:28 +1000 |
From: Philippe Mathieu-Daudé <philmd@linaro.org>
For target/alpha, the default CPU model name is "ev67". The default
CPU model is used when no matching CPU model is found. The conditions
to fall back to the default CPU model can be combined so that the code
looks a bit simplified.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Gavin Shan <gshan@redhat.com>
---
target/alpha/cpu.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c
index 51b7d8d1bf..c7ae4d6a41 100644
--- a/target/alpha/cpu.c
+++ b/target/alpha/cpu.c
@@ -142,13 +142,10 @@ static ObjectClass *alpha_cpu_class_by_name(const char
*cpu_model)
typename = g_strdup_printf(ALPHA_CPU_TYPE_NAME("%s"), cpu_model);
oc = object_class_by_name(typename);
g_free(typename);
- if (oc != NULL && object_class_is_abstract(oc)) {
- oc = NULL;
- }
/* TODO: remove match everything nonsense */
- /* Default to ev67; no reason not to emulate insns by default. */
- if (!oc) {
+ if (!oc || object_class_is_abstract(oc)) {
+ /* Default to ev67, no reason not to emulate insns by default */
oc = object_class_by_name(ALPHA_CPU_TYPE_NAME("ev67"));
}
--
2.41.0
- [PATCH v4 00/33] Unified CPU type check, Gavin Shan, 2023/11/01
- [PATCH v4 01/33] target/alpha: Tidy up alpha_cpu_class_by_name(),
Gavin Shan <=
- [PATCH v4 02/33] hw/cpu: Call object_class_is_abstract() once in cpu_class_by_name(), Gavin Shan, 2023/11/01
- [PATCH v4 03/33] cpu: Call object_class_dynamic_cast() once in cpu_class_by_name(), Gavin Shan, 2023/11/01
- [PATCH v4 04/33] cpu: Add helper cpu_model_from_type(), Gavin Shan, 2023/11/01
- [PATCH v4 05/33] target/alpha: Use generic helper to show CPU model names, Gavin Shan, 2023/11/01
- [PATCH v4 06/33] target/arm: Use generic helper to show CPU model names, Gavin Shan, 2023/11/01