summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Lioncash2020-09-22 22:54:32 -0400
committerGravatar Lioncash2020-09-22 22:54:36 -0400
commit0dc6967ff1030e466e8e2da399079a28181c3c09 (patch)
treed8b6622309e5470b7355be2409348e3ac57924e1
parentcontrol_flow: Make use of std::move in InsertBranch() (diff)
downloadyuzu-0dc6967ff1030e466e8e2da399079a28181c3c09.tar.gz
yuzu-0dc6967ff1030e466e8e2da399079a28181c3c09.tar.xz
yuzu-0dc6967ff1030e466e8e2da399079a28181c3c09.zip
control_flow: emplace elements in place within TryQuery()
Places data structures where they'll eventually be moved to to avoid needing to even move them in the first place.
-rw-r--r--src/video_core/shader/control_flow.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/video_core/shader/control_flow.cpp b/src/video_core/shader/control_flow.cpp
index 5963cf214..4c8971615 100644
--- a/src/video_core/shader/control_flow.cpp
+++ b/src/video_core/shader/control_flow.cpp
@@ -547,13 +547,13 @@ bool TryQuery(CFGRebuildState& state) {
547 gather_labels(q2.ssy_stack, state.ssy_labels, block); 547 gather_labels(q2.ssy_stack, state.ssy_labels, block);
548 gather_labels(q2.pbk_stack, state.pbk_labels, block); 548 gather_labels(q2.pbk_stack, state.pbk_labels, block);
549 if (std::holds_alternative<SingleBranch>(*block.branch)) { 549 if (std::holds_alternative<SingleBranch>(*block.branch)) {
550 const auto branch = std::get_if<SingleBranch>(block.branch.get()); 550 auto* branch = std::get_if<SingleBranch>(block.branch.get());
551 if (!branch->condition.IsUnconditional()) { 551 if (!branch->condition.IsUnconditional()) {
552 q2.address = block.end + 1; 552 q2.address = block.end + 1;
553 state.queries.push_back(q2); 553 state.queries.push_back(q2);
554 } 554 }
555 555
556 Query conditional_query{q2}; 556 auto& conditional_query = state.queries.emplace_back(q2);
557 if (branch->is_sync) { 557 if (branch->is_sync) {
558 if (branch->address == unassigned_branch) { 558 if (branch->address == unassigned_branch) {
559 branch->address = conditional_query.ssy_stack.top(); 559 branch->address = conditional_query.ssy_stack.top();
@@ -567,15 +567,15 @@ bool TryQuery(CFGRebuildState& state) {
567 conditional_query.pbk_stack.pop(); 567 conditional_query.pbk_stack.pop();
568 } 568 }
569 conditional_query.address = branch->address; 569 conditional_query.address = branch->address;
570 state.queries.push_back(std::move(conditional_query));
571 return true; 570 return true;
572 } 571 }
573 const auto multi_branch = std::get_if<MultiBranch>(block.branch.get()); 572
573 const auto* multi_branch = std::get_if<MultiBranch>(block.branch.get());
574 for (const auto& branch_case : multi_branch->branches) { 574 for (const auto& branch_case : multi_branch->branches) {
575 Query conditional_query{q2}; 575 auto& conditional_query = state.queries.emplace_back(q2);
576 conditional_query.address = branch_case.address; 576 conditional_query.address = branch_case.address;
577 state.queries.push_back(std::move(conditional_query));
578 } 577 }
578
579 return true; 579 return true;
580} 580}
581 581