mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-25 22:57:22 +00:00
Merge pull request #770 from lioncash/construct
gl_shader_decompiler: Remove redundant Subroutine construction in AddSubroutine()
This commit is contained in:
commit
3618a68f93
1 changed files with 9 additions and 5 deletions
|
@ -78,14 +78,18 @@ private:
|
||||||
|
|
||||||
/// Adds and analyzes a new subroutine if it is not added yet.
|
/// Adds and analyzes a new subroutine if it is not added yet.
|
||||||
const Subroutine& AddSubroutine(u32 begin, u32 end, const std::string& suffix) {
|
const Subroutine& AddSubroutine(u32 begin, u32 end, const std::string& suffix) {
|
||||||
auto iter = subroutines.find(Subroutine{begin, end, suffix});
|
Subroutine subroutine{begin, end, suffix, ExitMethod::Undetermined, {}};
|
||||||
if (iter != subroutines.end())
|
|
||||||
return *iter;
|
const auto iter = subroutines.find(subroutine);
|
||||||
|
if (iter != subroutines.end()) {
|
||||||
|
return *iter;
|
||||||
|
}
|
||||||
|
|
||||||
Subroutine subroutine{begin, end, suffix};
|
|
||||||
subroutine.exit_method = Scan(begin, end, subroutine.labels);
|
subroutine.exit_method = Scan(begin, end, subroutine.labels);
|
||||||
if (subroutine.exit_method == ExitMethod::Undetermined)
|
if (subroutine.exit_method == ExitMethod::Undetermined) {
|
||||||
throw DecompileFail("Recursive function detected");
|
throw DecompileFail("Recursive function detected");
|
||||||
|
}
|
||||||
|
|
||||||
return *subroutines.insert(std::move(subroutine)).first;
|
return *subroutines.insert(std::move(subroutine)).first;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue