[decompiler] Working toward bsp (#717)

* clean up

* before int to float stuff

* before trying to eliminate the separate read and write maps

* partial fix for register issues

* add missing include
This commit is contained in:
water111
2021-07-25 15:30:37 -04:00
committed by GitHub
parent 38c97481e7
commit 2b6684aa5c
76 changed files with 5695 additions and 514 deletions
+4 -13
View File
@@ -117,6 +117,10 @@ goos::Object Env::get_variable_name_with_cast(const RegisterAccess& access) cons
}
}
std::string Env::get_variable_name(const RegisterAccess& access) const {
return get_variable_and_cast(access).name;
}
VariableWithCast Env::get_variable_and_cast(const RegisterAccess& access) const {
if (access.reg().get_kind() == Reg::FPR || access.reg().get_kind() == Reg::GPR) {
auto& var_info = m_var_names.lookup(access.reg(), access.idx(), access.mode());
@@ -250,19 +254,6 @@ std::optional<TypeSpec> Env::get_user_cast_for_access(const RegisterAccess& acce
return {};
}
std::string Env::get_variable_name(const RegisterAccess& access) const {
if (access.reg().get_kind() == Reg::FPR || access.reg().get_kind() == Reg::GPR) {
std::string lookup_name = m_var_names.lookup(access.reg(), access.idx(), access.mode()).name();
auto remapped = m_var_remap.find(lookup_name);
if (remapped != m_var_remap.end()) {
lookup_name = remapped->second;
}
return lookup_name;
} else {
throw std::runtime_error("Cannot store a variable in this reg");
}
}
/*!
* Get the type of the variable currently in the register.
* NOTE: this is _NOT_ the most specific type known to the decompiler, but instead the type