diff options
author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2019-09-23 14:15:31 +0200 |
---|---|---|
committer | FernandoS27 <fsahmkow27@gmail.com> | 2019-10-05 00:52:55 +0200 |
commit | 7c756baa777cd27b319c1a397bd45270d2ffe041 (patch) | |
tree | 4f0cdea5a803a61a91066c7d50ba6078f6ded866 /src/video_core/shader/ast.cpp | |
parent | Shader_IR: Correct OutwardMoves for Ifs (diff) | |
download | yuzu-7c756baa777cd27b319c1a397bd45270d2ffe041.tar yuzu-7c756baa777cd27b319c1a397bd45270d2ffe041.tar.gz yuzu-7c756baa777cd27b319c1a397bd45270d2ffe041.tar.bz2 yuzu-7c756baa777cd27b319c1a397bd45270d2ffe041.tar.lz yuzu-7c756baa777cd27b319c1a397bd45270d2ffe041.tar.xz yuzu-7c756baa777cd27b319c1a397bd45270d2ffe041.tar.zst yuzu-7c756baa777cd27b319c1a397bd45270d2ffe041.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/shader/ast.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/video_core/shader/ast.cpp b/src/video_core/shader/ast.cpp index 54f0240e1..fc440526f 100644 --- a/src/video_core/shader/ast.cpp +++ b/src/video_core/shader/ast.cpp @@ -432,6 +432,12 @@ void ASTManager::InsertReturn(Expr condition, bool kills) { program->nodes.PushBack(node); } +// The decompile algorithm is based on +// "Taming control flow: A structured approach to eliminating goto statements" +// by AM Erosa, LJ Hendren 1994. In general, the idea is to get gotos to be +// on the same structured level as the label which they jump to. This is done, +// through outward/inward movements and lifting. Once they are at the same +// level, you can enclose them in an "if" structure or a "do-while" structure. void ASTManager::Decompile() { auto it = gotos.begin(); while (it != gotos.end()) { @@ -656,11 +662,9 @@ void ASTManager::EncloseIfThen(ASTNode goto_node, ASTNode label) { sub_zipper->Init(goto_node, if_node); zipper.InsertAfter(if_node, prev); sub_zipper->Remove(goto_node); - // ShowCurrentState("After IfThen Enclose"); } void ASTManager::MoveOutward(ASTNode goto_node) { - // ShowCurrentState("Before MoveOutward"); ASTZipper& zipper = goto_node->GetManager(); const ASTNode parent = goto_node->GetParent(); ASTZipper& zipper2 = parent->GetManager(); |