Browse Source
Merge pull request #770 from lioncash/construct
gl_shader_decompiler: Remove redundant Subroutine construction in AddSubroutine()
pull/15/merge
bunnei
8 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
8 additions and
4 deletions
-
src/video_core/renderer_opengl/gl_shader_decompiler.cpp
|
|
|
@ -78,14 +78,18 @@ private: |
|
|
|
|
|
|
|
/// Adds and analyzes a new subroutine if it is not added yet.
|
|
|
|
const Subroutine& AddSubroutine(u32 begin, u32 end, const std::string& suffix) { |
|
|
|
auto iter = subroutines.find(Subroutine{begin, end, suffix}); |
|
|
|
if (iter != subroutines.end()) |
|
|
|
Subroutine subroutine{begin, end, suffix, ExitMethod::Undetermined, {}}; |
|
|
|
|
|
|
|
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); |
|
|
|
if (subroutine.exit_method == ExitMethod::Undetermined) |
|
|
|
if (subroutine.exit_method == ExitMethod::Undetermined) { |
|
|
|
throw DecompileFail("Recursive function detected"); |
|
|
|
} |
|
|
|
|
|
|
|
return *subroutines.insert(std::move(subroutine)).first; |
|
|
|
} |
|
|
|
|
|
|
|
|