summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/frontend
diff options
context:
space:
mode:
Diffstat (limited to 'src/shader_recompiler/frontend')
-rw-r--r--src/shader_recompiler/frontend/ir/ir_emitter.cpp8
-rw-r--r--src/shader_recompiler/frontend/ir/ir_emitter.h4
-rw-r--r--src/shader_recompiler/frontend/ir/microinstruction.cpp3
-rw-r--r--src/shader_recompiler/frontend/ir/opcodes.inc3
-rw-r--r--src/shader_recompiler/frontend/maxwell/structured_control_flow.cpp9
5 files changed, 16 insertions, 11 deletions
diff --git a/src/shader_recompiler/frontend/ir/ir_emitter.cpp b/src/shader_recompiler/frontend/ir/ir_emitter.cpp
index 94bdbe39c..e9fd41237 100644
--- a/src/shader_recompiler/frontend/ir/ir_emitter.cpp
+++ b/src/shader_recompiler/frontend/ir/ir_emitter.cpp
@@ -61,8 +61,12 @@ F64 IREmitter::Imm64(f64 value) const {
61 return F64{Value{value}}; 61 return F64{Value{value}};
62} 62}
63 63
64void IREmitter::DummyReference(const Value& value) { 64U1 IREmitter::ConditionRef(const U1& value) {
65 Inst(Opcode::DummyReference, value); 65 return Inst<U1>(Opcode::ConditionRef, value);
66}
67
68void IREmitter::Reference(const Value& value) {
69 Inst(Opcode::Reference, value);
66} 70}
67 71
68void IREmitter::PhiMove(IR::Inst& phi, const Value& value) { 72void IREmitter::PhiMove(IR::Inst& phi, const Value& value) {
diff --git a/src/shader_recompiler/frontend/ir/ir_emitter.h b/src/shader_recompiler/frontend/ir/ir_emitter.h
index 4ae69b788..bb3500c54 100644
--- a/src/shader_recompiler/frontend/ir/ir_emitter.h
+++ b/src/shader_recompiler/frontend/ir/ir_emitter.h
@@ -32,7 +32,9 @@ public:
32 [[nodiscard]] U64 Imm64(s64 value) const; 32 [[nodiscard]] U64 Imm64(s64 value) const;
33 [[nodiscard]] F64 Imm64(f64 value) const; 33 [[nodiscard]] F64 Imm64(f64 value) const;
34 34
35 void DummyReference(const Value& value); 35 U1 ConditionRef(const U1& value);
36 void Reference(const Value& value);
37
36 void PhiMove(IR::Inst& phi, const Value& value); 38 void PhiMove(IR::Inst& phi, const Value& value);
37 39
38 void Prologue(); 40 void Prologue();
diff --git a/src/shader_recompiler/frontend/ir/microinstruction.cpp b/src/shader_recompiler/frontend/ir/microinstruction.cpp
index 267aebc61..3dfa5a880 100644
--- a/src/shader_recompiler/frontend/ir/microinstruction.cpp
+++ b/src/shader_recompiler/frontend/ir/microinstruction.cpp
@@ -56,7 +56,8 @@ Inst::~Inst() {
56 56
57bool Inst::MayHaveSideEffects() const noexcept { 57bool Inst::MayHaveSideEffects() const noexcept {
58 switch (op) { 58 switch (op) {
59 case Opcode::DummyReference: 59 case Opcode::ConditionRef:
60 case Opcode::Reference:
60 case Opcode::PhiMove: 61 case Opcode::PhiMove:
61 case Opcode::Prologue: 62 case Opcode::Prologue:
62 case Opcode::Epilogue: 63 case Opcode::Epilogue:
diff --git a/src/shader_recompiler/frontend/ir/opcodes.inc b/src/shader_recompiler/frontend/ir/opcodes.inc
index 6196b867d..8a8d0d759 100644
--- a/src/shader_recompiler/frontend/ir/opcodes.inc
+++ b/src/shader_recompiler/frontend/ir/opcodes.inc
@@ -6,7 +6,8 @@
6OPCODE(Phi, Opaque, ) 6OPCODE(Phi, Opaque, )
7OPCODE(Identity, Opaque, Opaque, ) 7OPCODE(Identity, Opaque, Opaque, )
8OPCODE(Void, Void, ) 8OPCODE(Void, Void, )
9OPCODE(DummyReference, Void, Opaque, ) 9OPCODE(ConditionRef, U1, U1, )
10OPCODE(Reference, Void, Opaque, )
10OPCODE(PhiMove, Void, Opaque, Opaque, ) 11OPCODE(PhiMove, Void, Opaque, Opaque, )
11 12
12// Special operations 13// Special operations
diff --git a/src/shader_recompiler/frontend/maxwell/structured_control_flow.cpp b/src/shader_recompiler/frontend/maxwell/structured_control_flow.cpp
index 83554a953..ebe5c2654 100644
--- a/src/shader_recompiler/frontend/maxwell/structured_control_flow.cpp
+++ b/src/shader_recompiler/frontend/maxwell/structured_control_flow.cpp
@@ -703,8 +703,7 @@ private:
703 703
704 // Implement if header block 704 // Implement if header block
705 IR::IREmitter ir{*current_block}; 705 IR::IREmitter ir{*current_block};
706 const IR::U1 cond{VisitExpr(ir, *stmt.cond)}; 706 const IR::U1 cond{ir.ConditionRef(VisitExpr(ir, *stmt.cond))};
707 ir.DummyReference(cond);
708 707
709 const size_t if_node_index{syntax_list.size()}; 708 const size_t if_node_index{syntax_list.size()};
710 syntax_list.emplace_back(); 709 syntax_list.emplace_back();
@@ -754,8 +753,7 @@ private:
754 753
755 // The continue block is located at the end of the loop 754 // The continue block is located at the end of the loop
756 IR::IREmitter ir{*continue_block}; 755 IR::IREmitter ir{*continue_block};
757 const IR::U1 cond{VisitExpr(ir, *stmt.cond)}; 756 const IR::U1 cond{ir.ConditionRef(VisitExpr(ir, *stmt.cond))};
758 ir.DummyReference(cond);
759 757
760 IR::Block* const body_block{syntax_list.at(body_block_index).data.block}; 758 IR::Block* const body_block{syntax_list.at(body_block_index).data.block};
761 loop_header_block->AddBranch(body_block); 759 loop_header_block->AddBranch(body_block);
@@ -791,8 +789,7 @@ private:
791 IR::Block* const skip_block{MergeBlock(parent, stmt)}; 789 IR::Block* const skip_block{MergeBlock(parent, stmt)};
792 790
793 IR::IREmitter ir{*current_block}; 791 IR::IREmitter ir{*current_block};
794 const IR::U1 cond{VisitExpr(ir, *stmt.cond)}; 792 const IR::U1 cond{ir.ConditionRef(VisitExpr(ir, *stmt.cond))};
795 ir.DummyReference(cond);
796 current_block->AddBranch(break_block); 793 current_block->AddBranch(break_block);
797 current_block->AddBranch(skip_block); 794 current_block->AddBranch(skip_block);
798 current_block = skip_block; 795 current_block = skip_block;