summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/frontend/ir
diff options
context:
space:
mode:
Diffstat (limited to 'src/shader_recompiler/frontend/ir')
-rw-r--r--src/shader_recompiler/frontend/ir/ir_emitter.cpp12
-rw-r--r--src/shader_recompiler/frontend/ir/ir_emitter.h4
-rw-r--r--src/shader_recompiler/frontend/ir/microinstruction.cpp1
-rw-r--r--src/shader_recompiler/frontend/ir/opcodes.inc3
4 files changed, 20 insertions, 0 deletions
diff --git a/src/shader_recompiler/frontend/ir/ir_emitter.cpp b/src/shader_recompiler/frontend/ir/ir_emitter.cpp
index 9b898e4e1..552472487 100644
--- a/src/shader_recompiler/frontend/ir/ir_emitter.cpp
+++ b/src/shader_recompiler/frontend/ir/ir_emitter.cpp
@@ -87,6 +87,10 @@ void IREmitter::Return() {
87 Inst(Opcode::Return); 87 Inst(Opcode::Return);
88} 88}
89 89
90void IREmitter::Unreachable() {
91 Inst(Opcode::Unreachable);
92}
93
90void IREmitter::DemoteToHelperInvocation(Block* continue_label) { 94void IREmitter::DemoteToHelperInvocation(Block* continue_label) {
91 block->SetBranch(continue_label); 95 block->SetBranch(continue_label);
92 continue_label->AddImmediatePredecessor(block); 96 continue_label->AddImmediatePredecessor(block);
@@ -126,6 +130,14 @@ void IREmitter::SetGotoVariable(u32 id, const U1& value) {
126 Inst(Opcode::SetGotoVariable, id, value); 130 Inst(Opcode::SetGotoVariable, id, value);
127} 131}
128 132
133U32 IREmitter::GetIndirectBranchVariable() {
134 return Inst<U32>(Opcode::GetIndirectBranchVariable);
135}
136
137void IREmitter::SetIndirectBranchVariable(const U32& value) {
138 Inst(Opcode::SetIndirectBranchVariable, value);
139}
140
129void IREmitter::SetPred(IR::Pred pred, const U1& value) { 141void IREmitter::SetPred(IR::Pred pred, const U1& value) {
130 Inst(Opcode::SetPred, pred, value); 142 Inst(Opcode::SetPred, pred, value);
131} 143}
diff --git a/src/shader_recompiler/frontend/ir/ir_emitter.h b/src/shader_recompiler/frontend/ir/ir_emitter.h
index 269f367a4..17bc32fc8 100644
--- a/src/shader_recompiler/frontend/ir/ir_emitter.h
+++ b/src/shader_recompiler/frontend/ir/ir_emitter.h
@@ -37,6 +37,7 @@ public:
37 void LoopMerge(Block* merge_block, Block* continue_target); 37 void LoopMerge(Block* merge_block, Block* continue_target);
38 void SelectionMerge(Block* merge_block); 38 void SelectionMerge(Block* merge_block);
39 void Return(); 39 void Return();
40 void Unreachable();
40 void DemoteToHelperInvocation(Block* continue_label); 41 void DemoteToHelperInvocation(Block* continue_label);
41 42
42 void Prologue(); 43 void Prologue();
@@ -51,6 +52,9 @@ public:
51 [[nodiscard]] U1 GetGotoVariable(u32 id); 52 [[nodiscard]] U1 GetGotoVariable(u32 id);
52 void SetGotoVariable(u32 id, const U1& value); 53 void SetGotoVariable(u32 id, const U1& value);
53 54
55 [[nodiscard]] U32 GetIndirectBranchVariable();
56 void SetIndirectBranchVariable(const U32& value);
57
54 [[nodiscard]] U32 GetCbuf(const U32& binding, const U32& byte_offset); 58 [[nodiscard]] U32 GetCbuf(const U32& binding, const U32& byte_offset);
55 [[nodiscard]] UAny GetCbuf(const U32& binding, const U32& byte_offset, size_t bitsize, 59 [[nodiscard]] UAny GetCbuf(const U32& binding, const U32& byte_offset, size_t bitsize,
56 bool is_signed); 60 bool is_signed);
diff --git a/src/shader_recompiler/frontend/ir/microinstruction.cpp b/src/shader_recompiler/frontend/ir/microinstruction.cpp
index 52a5e5034..c3ba6b522 100644
--- a/src/shader_recompiler/frontend/ir/microinstruction.cpp
+++ b/src/shader_recompiler/frontend/ir/microinstruction.cpp
@@ -55,6 +55,7 @@ bool Inst::MayHaveSideEffects() const noexcept {
55 case Opcode::LoopMerge: 55 case Opcode::LoopMerge:
56 case Opcode::SelectionMerge: 56 case Opcode::SelectionMerge:
57 case Opcode::Return: 57 case Opcode::Return:
58 case Opcode::Unreachable:
58 case Opcode::DemoteToHelperInvocation: 59 case Opcode::DemoteToHelperInvocation:
59 case Opcode::Prologue: 60 case Opcode::Prologue:
60 case Opcode::Epilogue: 61 case Opcode::Epilogue:
diff --git a/src/shader_recompiler/frontend/ir/opcodes.inc b/src/shader_recompiler/frontend/ir/opcodes.inc
index 9b050995b..fb79e3d8d 100644
--- a/src/shader_recompiler/frontend/ir/opcodes.inc
+++ b/src/shader_recompiler/frontend/ir/opcodes.inc
@@ -13,6 +13,7 @@ OPCODE(BranchConditional, Void, U1,
13OPCODE(LoopMerge, Void, Label, Label, ) 13OPCODE(LoopMerge, Void, Label, Label, )
14OPCODE(SelectionMerge, Void, Label, ) 14OPCODE(SelectionMerge, Void, Label, )
15OPCODE(Return, Void, ) 15OPCODE(Return, Void, )
16OPCODE(Unreachable, Void, )
16OPCODE(DemoteToHelperInvocation, Void, Label, ) 17OPCODE(DemoteToHelperInvocation, Void, Label, )
17 18
18// Special operations 19// Special operations
@@ -26,6 +27,8 @@ OPCODE(GetPred, U1, Pred
26OPCODE(SetPred, Void, Pred, U1, ) 27OPCODE(SetPred, Void, Pred, U1, )
27OPCODE(GetGotoVariable, U1, U32, ) 28OPCODE(GetGotoVariable, U1, U32, )
28OPCODE(SetGotoVariable, Void, U32, U1, ) 29OPCODE(SetGotoVariable, Void, U32, U1, )
30OPCODE(GetIndirectBranchVariable, U32, )
31OPCODE(SetIndirectBranchVariable, Void, U32, )
29OPCODE(GetCbufU8, U32, U32, U32, ) 32OPCODE(GetCbufU8, U32, U32, U32, )
30OPCODE(GetCbufS8, U32, U32, U32, ) 33OPCODE(GetCbufS8, U32, U32, U32, )
31OPCODE(GetCbufU16, U32, U32, U32, ) 34OPCODE(GetCbufU16, U32, U32, U32, )