summaryrefslogtreecommitdiffstats
path: root/src/video_core/shader/ast.cpp
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2019-10-05 14:17:32 +0200
committerLioncash <mathew1800@gmail.com>2019-10-05 15:14:23 +0200
commit8eb1398f8d90fb2813f438b9fffac716b6ec51d2 (patch)
tree39a270023b64af2dce85e3d4a13484c95243b2b3 /src/video_core/shader/ast.cpp
parentvideo_core/ast: Supply const accessors for data where applicable (diff)
downloadyuzu-8eb1398f8d90fb2813f438b9fffac716b6ec51d2.tar
yuzu-8eb1398f8d90fb2813f438b9fffac716b6ec51d2.tar.gz
yuzu-8eb1398f8d90fb2813f438b9fffac716b6ec51d2.tar.bz2
yuzu-8eb1398f8d90fb2813f438b9fffac716b6ec51d2.tar.lz
yuzu-8eb1398f8d90fb2813f438b9fffac716b6ec51d2.tar.xz
yuzu-8eb1398f8d90fb2813f438b9fffac716b6ec51d2.tar.zst
yuzu-8eb1398f8d90fb2813f438b9fffac716b6ec51d2.zip
Diffstat (limited to '')
-rw-r--r--src/video_core/shader/ast.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/video_core/shader/ast.cpp b/src/video_core/shader/ast.cpp
index 87c722682..986e4cd64 100644
--- a/src/video_core/shader/ast.cpp
+++ b/src/video_core/shader/ast.cpp
@@ -17,6 +17,7 @@ void ASTZipper::Init(const ASTNode new_first, const ASTNode parent) {
ASSERT(new_first->manager == nullptr);
first = new_first;
last = new_first;
+
ASTNode current = first;
while (current) {
current->manager = this;
@@ -92,7 +93,7 @@ void ASTZipper::InsertBefore(const ASTNode new_node, const ASTNode at_node) {
new_node->manager = this;
}
-void ASTZipper::DetachTail(const ASTNode node) {
+void ASTZipper::DetachTail(ASTNode node) {
ASSERT(node->manager == this);
if (node == first) {
first.reset();
@@ -103,7 +104,8 @@ void ASTZipper::DetachTail(const ASTNode node) {
last = node->previous;
last->next.reset();
node->previous.reset();
- ASTNode current = node;
+
+ ASTNode current = std::move(node);
while (current) {
current->manager = nullptr;
current->parent.reset();
@@ -413,19 +415,19 @@ void ASTManager::InsertLabel(u32 address) {
void ASTManager::InsertGoto(Expr condition, u32 address) {
const u32 index = labels_map[address];
- const ASTNode goto_node = ASTBase::Make<ASTGoto>(main_node, condition, index);
+ const ASTNode goto_node = ASTBase::Make<ASTGoto>(main_node, std::move(condition), index);
gotos.push_back(goto_node);
program->nodes.PushBack(goto_node);
}
void ASTManager::InsertBlock(u32 start_address, u32 end_address) {
- const ASTNode block = ASTBase::Make<ASTBlockEncoded>(main_node, start_address, end_address);
- program->nodes.PushBack(block);
+ ASTNode block = ASTBase::Make<ASTBlockEncoded>(main_node, start_address, end_address);
+ program->nodes.PushBack(std::move(block));
}
void ASTManager::InsertReturn(Expr condition, bool kills) {
- const ASTNode node = ASTBase::Make<ASTReturn>(main_node, condition, kills);
- program->nodes.PushBack(node);
+ ASTNode node = ASTBase::Make<ASTReturn>(main_node, std::move(condition), kills);
+ program->nodes.PushBack(std::move(node));
}
// The decompile algorithm is based on
@@ -539,11 +541,11 @@ bool ASTManager::IsBackwardsJump(ASTNode goto_node, ASTNode label_node) const {
return false;
}
-bool ASTManager::IndirectlyRelated(ASTNode first, ASTNode second) {
+bool ASTManager::IndirectlyRelated(const ASTNode& first, const ASTNode& second) const {
return !(first->GetParent() == second->GetParent() || DirectlyRelated(first, second));
}
-bool ASTManager::DirectlyRelated(ASTNode first, ASTNode second) {
+bool ASTManager::DirectlyRelated(const ASTNode& first, const ASTNode& second) const {
if (first->GetParent() == second->GetParent()) {
return false;
}