diff options
Diffstat (limited to 'src/shader_recompiler/frontend/ir/microinstruction.cpp')
| -rw-r--r-- | src/shader_recompiler/frontend/ir/microinstruction.cpp | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/shader_recompiler/frontend/ir/microinstruction.cpp b/src/shader_recompiler/frontend/ir/microinstruction.cpp index ecf76e23d..de953838c 100644 --- a/src/shader_recompiler/frontend/ir/microinstruction.cpp +++ b/src/shader_recompiler/frontend/ir/microinstruction.cpp | |||
| @@ -2,6 +2,8 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <algorithm> | ||
| 6 | |||
| 5 | #include "shader_recompiler/exception.h" | 7 | #include "shader_recompiler/exception.h" |
| 6 | #include "shader_recompiler/frontend/ir/microinstruction.h" | 8 | #include "shader_recompiler/frontend/ir/microinstruction.h" |
| 7 | #include "shader_recompiler/frontend/ir/type.h" | 9 | #include "shader_recompiler/frontend/ir/type.h" |
| @@ -44,6 +46,13 @@ bool Inst::MayHaveSideEffects() const noexcept { | |||
| 44 | case Opcode::WriteGlobal32: | 46 | case Opcode::WriteGlobal32: |
| 45 | case Opcode::WriteGlobal64: | 47 | case Opcode::WriteGlobal64: |
| 46 | case Opcode::WriteGlobal128: | 48 | case Opcode::WriteGlobal128: |
| 49 | case Opcode::WriteStorageU8: | ||
| 50 | case Opcode::WriteStorageS8: | ||
| 51 | case Opcode::WriteStorageU16: | ||
| 52 | case Opcode::WriteStorageS16: | ||
| 53 | case Opcode::WriteStorage32: | ||
| 54 | case Opcode::WriteStorage64: | ||
| 55 | case Opcode::WriteStorage128: | ||
| 47 | return true; | 56 | return true; |
| 48 | default: | 57 | default: |
| 49 | return false; | 58 | return false; |
| @@ -56,15 +65,19 @@ bool Inst::IsPseudoInstruction() const noexcept { | |||
| 56 | case Opcode::GetSignFromOp: | 65 | case Opcode::GetSignFromOp: |
| 57 | case Opcode::GetCarryFromOp: | 66 | case Opcode::GetCarryFromOp: |
| 58 | case Opcode::GetOverflowFromOp: | 67 | case Opcode::GetOverflowFromOp: |
| 59 | case Opcode::GetZSCOFromOp: | ||
| 60 | return true; | 68 | return true; |
| 61 | default: | 69 | default: |
| 62 | return false; | 70 | return false; |
| 63 | } | 71 | } |
| 64 | } | 72 | } |
| 65 | 73 | ||
| 74 | bool Inst::AreAllArgsImmediates() const noexcept { | ||
| 75 | return std::all_of(args.begin(), args.begin() + NumArgs(), | ||
| 76 | [](const IR::Value& value) { return value.IsImmediate(); }); | ||
| 77 | } | ||
| 78 | |||
| 66 | bool Inst::HasAssociatedPseudoOperation() const noexcept { | 79 | bool Inst::HasAssociatedPseudoOperation() const noexcept { |
| 67 | return zero_inst || sign_inst || carry_inst || overflow_inst || zsco_inst; | 80 | return zero_inst || sign_inst || carry_inst || overflow_inst; |
| 68 | } | 81 | } |
| 69 | 82 | ||
| 70 | Inst* Inst::GetAssociatedPseudoOperation(IR::Opcode opcode) { | 83 | Inst* Inst::GetAssociatedPseudoOperation(IR::Opcode opcode) { |
| @@ -82,9 +95,6 @@ Inst* Inst::GetAssociatedPseudoOperation(IR::Opcode opcode) { | |||
| 82 | case Opcode::GetOverflowFromOp: | 95 | case Opcode::GetOverflowFromOp: |
| 83 | CheckPseudoInstruction(overflow_inst, Opcode::GetOverflowFromOp); | 96 | CheckPseudoInstruction(overflow_inst, Opcode::GetOverflowFromOp); |
| 84 | return overflow_inst; | 97 | return overflow_inst; |
| 85 | case Opcode::GetZSCOFromOp: | ||
| 86 | CheckPseudoInstruction(zsco_inst, Opcode::GetZSCOFromOp); | ||
| 87 | return zsco_inst; | ||
| 88 | default: | 98 | default: |
| 89 | throw InvalidArgument("{} is not a pseudo-instruction", opcode); | 99 | throw InvalidArgument("{} is not a pseudo-instruction", opcode); |
| 90 | } | 100 | } |
| @@ -176,9 +186,6 @@ void Inst::Use(const Value& value) { | |||
| 176 | case Opcode::GetOverflowFromOp: | 186 | case Opcode::GetOverflowFromOp: |
| 177 | SetPseudoInstruction(value.Inst()->overflow_inst, this); | 187 | SetPseudoInstruction(value.Inst()->overflow_inst, this); |
| 178 | break; | 188 | break; |
| 179 | case Opcode::GetZSCOFromOp: | ||
| 180 | SetPseudoInstruction(value.Inst()->zsco_inst, this); | ||
| 181 | break; | ||
| 182 | default: | 189 | default: |
| 183 | break; | 190 | break; |
| 184 | } | 191 | } |
| @@ -200,9 +207,6 @@ void Inst::UndoUse(const Value& value) { | |||
| 200 | case Opcode::GetOverflowFromOp: | 207 | case Opcode::GetOverflowFromOp: |
| 201 | RemovePseudoInstruction(value.Inst()->overflow_inst, Opcode::GetOverflowFromOp); | 208 | RemovePseudoInstruction(value.Inst()->overflow_inst, Opcode::GetOverflowFromOp); |
| 202 | break; | 209 | break; |
| 203 | case Opcode::GetZSCOFromOp: | ||
| 204 | RemovePseudoInstruction(value.Inst()->zsco_inst, Opcode::GetZSCOFromOp); | ||
| 205 | break; | ||
| 206 | default: | 210 | default: |
| 207 | break; | 211 | break; |
| 208 | } | 212 | } |