Skip to content

VERY experimental Nintendo Switch 2 emulator

C++

[dynarmic] avoid IsInmediate() comical call recursion (#3145)

lizzie77d83b008a3d
diff --git a/src/dynarmic/src/dynarmic/ir/value.cpp b/src/dynarmic/src/dynarmic/ir/value.cpp
index 6f8a386827..59b17b5a7b 100644
--- a/src/dynarmic/src/dynarmic/ir/value.cpp
+++ b/src/dynarmic/src/dynarmic/ir/value.cpp
@@ -100,9 +100,14 @@ bool Value::IsEmpty() const noexcept {
}
bool Value::IsImmediate() const noexcept {
- if (IsIdentity())
- return inner.inst->GetArg(0).IsImmediate();
- return type != Type::Opaque;
+ IR::Type current_type = type;
+ IR::Inst const* current_inst = inner.inst;
+ while (current_type == Type::Opaque && current_inst->GetOpcode() == Opcode::Identity) {
+ Value const& arg = current_inst->GetArg(0);
+ current_type = arg.type;
+ current_inst = arg.inner.inst;
+ }
+ return current_type != Type::Opaque;
}
Type Value::GetType() const noexcept {