mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-12-16 04:09:07 +00:00
rsx/fp/cfg: Fix IF/ELSE and LOOP node linkage
This commit is contained in:
parent
e1ec2f58bb
commit
3bed46b844
@ -1,5 +1,4 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "CFG.h"
|
||||
|
||||
#include "Emu/RSX/Common/simple_array.hpp"
|
||||
@ -107,11 +106,25 @@ namespace rsx::assembler
|
||||
{
|
||||
case EdgeType::IF:
|
||||
case EdgeType::ELSE:
|
||||
bb->insert_succ(*found, EdgeType::ENDIF);
|
||||
{
|
||||
// Find the merge node from the parent
|
||||
auto parent = bb->pred.back().from;
|
||||
auto succ = std::find_if(parent->succ.begin(), parent->succ.end(), FN(x.type == EdgeType::ENDIF));
|
||||
ensure(succ != parent->succ.end(), "CFG: Broken IF linkage. Please report to developers.");
|
||||
bb->insert_succ(succ->to, EdgeType::ENDIF);
|
||||
succ->to->insert_pred(bb, EdgeType::ENDIF);
|
||||
break;
|
||||
}
|
||||
case EdgeType::LOOP:
|
||||
bb->insert_succ(*found, EdgeType::ENDLOOP);
|
||||
{
|
||||
// Find the merge node from the parent
|
||||
auto parent = bb->pred.back().from;
|
||||
auto succ = std::find_if(parent->succ.begin(), parent->succ.end(), FN(x.type == EdgeType::ENDLOOP));
|
||||
ensure(succ != parent->succ.end(), "CFG: Broken LOOP linkage. Please report to developers.");
|
||||
bb->insert_succ(succ->to, EdgeType::ENDLOOP);
|
||||
succ->to->insert_pred(bb, EdgeType::ENDLOOP);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
// Missing an edge type?
|
||||
rsx_log.error("CFG: Unexpected block exit. Report to developers.");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user