diff options
Diffstat (limited to '')
| -rw-r--r-- | src/shader_recompiler/frontend/ir/attribute.cpp | 4 | ||||
| -rw-r--r-- | src/shader_recompiler/frontend/ir/basic_block.cpp | 2 | ||||
| -rw-r--r-- | src/shader_recompiler/frontend/ir/condition.cpp | 6 | ||||
| -rw-r--r-- | src/shader_recompiler/frontend/ir/condition.h | 4 | ||||
| -rw-r--r-- | src/shader_recompiler/frontend/ir/ir_emitter.cpp | 4 | ||||
| -rw-r--r-- | src/shader_recompiler/frontend/ir/microinstruction.cpp | 16 | ||||
| -rw-r--r-- | src/shader_recompiler/frontend/ir/microinstruction.h | 4 | ||||
| -rw-r--r-- | src/shader_recompiler/frontend/ir/opcodes.cpp | 2 | ||||
| -rw-r--r-- | src/shader_recompiler/frontend/ir/program.cpp | 2 | ||||
| -rw-r--r-- | src/shader_recompiler/frontend/ir/value.cpp | 4 | ||||
| -rw-r--r-- | src/shader_recompiler/frontend/ir/value.h | 2 |
11 files changed, 24 insertions, 26 deletions
diff --git a/src/shader_recompiler/frontend/ir/attribute.cpp b/src/shader_recompiler/frontend/ir/attribute.cpp index 4811242ea..7993e5c43 100644 --- a/src/shader_recompiler/frontend/ir/attribute.cpp +++ b/src/shader_recompiler/frontend/ir/attribute.cpp | |||
| @@ -17,7 +17,7 @@ u32 GenericAttributeIndex(Attribute attribute) { | |||
| 17 | if (!IsGeneric(attribute)) { | 17 | if (!IsGeneric(attribute)) { |
| 18 | throw InvalidArgument("Attribute is not generic {}", attribute); | 18 | throw InvalidArgument("Attribute is not generic {}", attribute); |
| 19 | } | 19 | } |
| 20 | return (static_cast<int>(attribute) - static_cast<int>(Attribute::Generic0X)) / 4; | 20 | return (static_cast<u32>(attribute) - static_cast<u32>(Attribute::Generic0X)) / 4u; |
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | std::string NameOf(Attribute attribute) { | 23 | std::string NameOf(Attribute attribute) { |
| @@ -444,4 +444,4 @@ std::string NameOf(Attribute attribute) { | |||
| 444 | return fmt::format("<reserved attribute {}>", static_cast<int>(attribute)); | 444 | return fmt::format("<reserved attribute {}>", static_cast<int>(attribute)); |
| 445 | } | 445 | } |
| 446 | 446 | ||
| 447 | } // namespace Shader::IR \ No newline at end of file | 447 | } // namespace Shader::IR |
diff --git a/src/shader_recompiler/frontend/ir/basic_block.cpp b/src/shader_recompiler/frontend/ir/basic_block.cpp index ec029dfd6..e1f0191f4 100644 --- a/src/shader_recompiler/frontend/ir/basic_block.cpp +++ b/src/shader_recompiler/frontend/ir/basic_block.cpp | |||
| @@ -155,7 +155,7 @@ std::string DumpBlock(const Block& block, const std::map<const Block*, size_t>& | |||
| 155 | ret += fmt::format(": begin={:04x} end={:04x}\n", block.LocationBegin(), block.LocationEnd()); | 155 | ret += fmt::format(": begin={:04x} end={:04x}\n", block.LocationBegin(), block.LocationEnd()); |
| 156 | 156 | ||
| 157 | for (const Inst& inst : block) { | 157 | for (const Inst& inst : block) { |
| 158 | const Opcode op{inst.Opcode()}; | 158 | const Opcode op{inst.GetOpcode()}; |
| 159 | ret += fmt::format("[{:016x}] ", reinterpret_cast<u64>(&inst)); | 159 | ret += fmt::format("[{:016x}] ", reinterpret_cast<u64>(&inst)); |
| 160 | if (TypeOf(op) != Type::Void) { | 160 | if (TypeOf(op) != Type::Void) { |
| 161 | ret += fmt::format("%{:<5} = {}", InstIndex(inst_to_index, inst_index, &inst), op); | 161 | ret += fmt::format("%{:<5} = {}", InstIndex(inst_to_index, inst_index, &inst), op); |
diff --git a/src/shader_recompiler/frontend/ir/condition.cpp b/src/shader_recompiler/frontend/ir/condition.cpp index ec1659e2b..fc18ea2a2 100644 --- a/src/shader_recompiler/frontend/ir/condition.cpp +++ b/src/shader_recompiler/frontend/ir/condition.cpp | |||
| @@ -12,10 +12,10 @@ namespace Shader::IR { | |||
| 12 | 12 | ||
| 13 | std::string NameOf(Condition condition) { | 13 | std::string NameOf(Condition condition) { |
| 14 | std::string ret; | 14 | std::string ret; |
| 15 | if (condition.FlowTest() != FlowTest::T) { | 15 | if (condition.GetFlowTest() != FlowTest::T) { |
| 16 | ret = fmt::to_string(condition.FlowTest()); | 16 | ret = fmt::to_string(condition.GetFlowTest()); |
| 17 | } | 17 | } |
| 18 | const auto [pred, negated]{condition.Pred()}; | 18 | const auto [pred, negated]{condition.GetPred()}; |
| 19 | if (!ret.empty()) { | 19 | if (!ret.empty()) { |
| 20 | ret += '&'; | 20 | ret += '&'; |
| 21 | } | 21 | } |
diff --git a/src/shader_recompiler/frontend/ir/condition.h b/src/shader_recompiler/frontend/ir/condition.h index 51c2f15cf..aa8597c60 100644 --- a/src/shader_recompiler/frontend/ir/condition.h +++ b/src/shader_recompiler/frontend/ir/condition.h | |||
| @@ -30,11 +30,11 @@ public: | |||
| 30 | 30 | ||
| 31 | auto operator<=>(const Condition&) const noexcept = default; | 31 | auto operator<=>(const Condition&) const noexcept = default; |
| 32 | 32 | ||
| 33 | [[nodiscard]] IR::FlowTest FlowTest() const noexcept { | 33 | [[nodiscard]] IR::FlowTest GetFlowTest() const noexcept { |
| 34 | return static_cast<IR::FlowTest>(flow_test); | 34 | return static_cast<IR::FlowTest>(flow_test); |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | [[nodiscard]] std::pair<IR::Pred, bool> Pred() const noexcept { | 37 | [[nodiscard]] std::pair<IR::Pred, bool> GetPred() const noexcept { |
| 38 | return {static_cast<IR::Pred>(pred), pred_negated != 0}; | 38 | return {static_cast<IR::Pred>(pred), pred_negated != 0}; |
| 39 | } | 39 | } |
| 40 | 40 | ||
diff --git a/src/shader_recompiler/frontend/ir/ir_emitter.cpp b/src/shader_recompiler/frontend/ir/ir_emitter.cpp index 13eb2de4c..a2104bdb3 100644 --- a/src/shader_recompiler/frontend/ir/ir_emitter.cpp +++ b/src/shader_recompiler/frontend/ir/ir_emitter.cpp | |||
| @@ -290,8 +290,8 @@ static U1 GetFlowTest(IREmitter& ir, FlowTest flow_test) { | |||
| 290 | } | 290 | } |
| 291 | 291 | ||
| 292 | U1 IREmitter::Condition(IR::Condition cond) { | 292 | U1 IREmitter::Condition(IR::Condition cond) { |
| 293 | const FlowTest flow_test{cond.FlowTest()}; | 293 | const FlowTest flow_test{cond.GetFlowTest()}; |
| 294 | const auto [pred, is_negated]{cond.Pred()}; | 294 | const auto [pred, is_negated]{cond.GetPred()}; |
| 295 | return LogicalAnd(GetPred(pred, is_negated), GetFlowTest(*this, flow_test)); | 295 | return LogicalAnd(GetPred(pred, is_negated), GetFlowTest(*this, flow_test)); |
| 296 | } | 296 | } |
| 297 | 297 | ||
diff --git a/src/shader_recompiler/frontend/ir/microinstruction.cpp b/src/shader_recompiler/frontend/ir/microinstruction.cpp index 481202d94..ceb44e604 100644 --- a/src/shader_recompiler/frontend/ir/microinstruction.cpp +++ b/src/shader_recompiler/frontend/ir/microinstruction.cpp | |||
| @@ -12,7 +12,7 @@ | |||
| 12 | namespace Shader::IR { | 12 | namespace Shader::IR { |
| 13 | namespace { | 13 | namespace { |
| 14 | void CheckPseudoInstruction(IR::Inst* inst, IR::Opcode opcode) { | 14 | void CheckPseudoInstruction(IR::Inst* inst, IR::Opcode opcode) { |
| 15 | if (inst && inst->Opcode() != opcode) { | 15 | if (inst && inst->GetOpcode() != opcode) { |
| 16 | throw LogicError("Invalid pseudo-instruction"); | 16 | throw LogicError("Invalid pseudo-instruction"); |
| 17 | } | 17 | } |
| 18 | } | 18 | } |
| @@ -25,11 +25,17 @@ void SetPseudoInstruction(IR::Inst*& dest_inst, IR::Inst* pseudo_inst) { | |||
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | void RemovePseudoInstruction(IR::Inst*& inst, IR::Opcode expected_opcode) { | 27 | void RemovePseudoInstruction(IR::Inst*& inst, IR::Opcode expected_opcode) { |
| 28 | if (inst->Opcode() != expected_opcode) { | 28 | if (inst->GetOpcode() != expected_opcode) { |
| 29 | throw LogicError("Undoing use of invalid pseudo-op"); | 29 | throw LogicError("Undoing use of invalid pseudo-op"); |
| 30 | } | 30 | } |
| 31 | inst = nullptr; | 31 | inst = nullptr; |
| 32 | } | 32 | } |
| 33 | |||
| 34 | void AllocAssociatedInsts(std::unique_ptr<AssociatedInsts>& associated_insts) { | ||
| 35 | if (!associated_insts) { | ||
| 36 | associated_insts = std::make_unique<AssociatedInsts>(); | ||
| 37 | } | ||
| 38 | } | ||
| 33 | } // Anonymous namespace | 39 | } // Anonymous namespace |
| 34 | 40 | ||
| 35 | Inst::Inst(IR::Opcode op_, u32 flags_) noexcept : op{op_}, flags{flags_} { | 41 | Inst::Inst(IR::Opcode op_, u32 flags_) noexcept : op{op_}, flags{flags_} { |
| @@ -249,12 +255,6 @@ void Inst::ReplaceOpcode(IR::Opcode opcode) { | |||
| 249 | op = opcode; | 255 | op = opcode; |
| 250 | } | 256 | } |
| 251 | 257 | ||
| 252 | void AllocAssociatedInsts(std::unique_ptr<AssociatedInsts>& associated_insts) { | ||
| 253 | if (!associated_insts) { | ||
| 254 | associated_insts = std::make_unique<AssociatedInsts>(); | ||
| 255 | } | ||
| 256 | } | ||
| 257 | |||
| 258 | void Inst::Use(const Value& value) { | 258 | void Inst::Use(const Value& value) { |
| 259 | Inst* const inst{value.Inst()}; | 259 | Inst* const inst{value.Inst()}; |
| 260 | ++inst->use_count; | 260 | ++inst->use_count; |
diff --git a/src/shader_recompiler/frontend/ir/microinstruction.h b/src/shader_recompiler/frontend/ir/microinstruction.h index 6658dc674..97dc91d85 100644 --- a/src/shader_recompiler/frontend/ir/microinstruction.h +++ b/src/shader_recompiler/frontend/ir/microinstruction.h | |||
| @@ -46,7 +46,7 @@ public: | |||
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | /// Get the opcode this microinstruction represents. | 48 | /// Get the opcode this microinstruction represents. |
| 49 | [[nodiscard]] IR::Opcode Opcode() const noexcept { | 49 | [[nodiscard]] IR::Opcode GetOpcode() const noexcept { |
| 50 | return op; | 50 | return op; |
| 51 | } | 51 | } |
| 52 | 52 | ||
| @@ -95,7 +95,7 @@ public: | |||
| 95 | requires(sizeof(FlagsType) <= sizeof(u32) && std::is_trivially_copyable_v<FlagsType>) | 95 | requires(sizeof(FlagsType) <= sizeof(u32) && std::is_trivially_copyable_v<FlagsType>) |
| 96 | [[nodiscard]] FlagsType Flags() const noexcept { | 96 | [[nodiscard]] FlagsType Flags() const noexcept { |
| 97 | FlagsType ret; | 97 | FlagsType ret; |
| 98 | std::memcpy(&ret, &flags, sizeof(ret)); | 98 | std::memcpy(reinterpret_cast<char*>(&ret), &flags, sizeof(ret)); |
| 99 | return ret; | 99 | return ret; |
| 100 | } | 100 | } |
| 101 | 101 | ||
diff --git a/src/shader_recompiler/frontend/ir/opcodes.cpp b/src/shader_recompiler/frontend/ir/opcodes.cpp index 1cb9db6c9..002dbf94e 100644 --- a/src/shader_recompiler/frontend/ir/opcodes.cpp +++ b/src/shader_recompiler/frontend/ir/opcodes.cpp | |||
| @@ -49,7 +49,7 @@ constexpr std::array META_TABLE{ | |||
| 49 | #define OPCODE(name_token, type_token, ...) \ | 49 | #define OPCODE(name_token, type_token, ...) \ |
| 50 | OpcodeMeta{ \ | 50 | OpcodeMeta{ \ |
| 51 | .name{#name_token}, \ | 51 | .name{#name_token}, \ |
| 52 | .type{type_token}, \ | 52 | .type = type_token, \ |
| 53 | .arg_types{__VA_ARGS__}, \ | 53 | .arg_types{__VA_ARGS__}, \ |
| 54 | }, | 54 | }, |
| 55 | #include "opcodes.inc" | 55 | #include "opcodes.inc" |
diff --git a/src/shader_recompiler/frontend/ir/program.cpp b/src/shader_recompiler/frontend/ir/program.cpp index 5f51aeb5f..89a17fb1b 100644 --- a/src/shader_recompiler/frontend/ir/program.cpp +++ b/src/shader_recompiler/frontend/ir/program.cpp | |||
| @@ -2,8 +2,6 @@ | |||
| 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 | #pragma once | ||
| 6 | |||
| 7 | #include <map> | 5 | #include <map> |
| 8 | #include <string> | 6 | #include <string> |
| 9 | 7 | ||
diff --git a/src/shader_recompiler/frontend/ir/value.cpp b/src/shader_recompiler/frontend/ir/value.cpp index 837c1b487..1e7ffb86d 100644 --- a/src/shader_recompiler/frontend/ir/value.cpp +++ b/src/shader_recompiler/frontend/ir/value.cpp | |||
| @@ -33,11 +33,11 @@ Value::Value(u64 value) noexcept : type{Type::U64}, imm_u64{value} {} | |||
| 33 | Value::Value(f64 value) noexcept : type{Type::F64}, imm_f64{value} {} | 33 | Value::Value(f64 value) noexcept : type{Type::F64}, imm_f64{value} {} |
| 34 | 34 | ||
| 35 | bool Value::IsIdentity() const noexcept { | 35 | bool Value::IsIdentity() const noexcept { |
| 36 | return type == Type::Opaque && inst->Opcode() == Opcode::Identity; | 36 | return type == Type::Opaque && inst->GetOpcode() == Opcode::Identity; |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | bool Value::IsPhi() const noexcept { | 39 | bool Value::IsPhi() const noexcept { |
| 40 | return type == Type::Opaque && inst->Opcode() == Opcode::Phi; | 40 | return type == Type::Opaque && inst->GetOpcode() == Opcode::Phi; |
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | bool Value::IsEmpty() const noexcept { | 43 | bool Value::IsEmpty() const noexcept { |
diff --git a/src/shader_recompiler/frontend/ir/value.h b/src/shader_recompiler/frontend/ir/value.h index b27601e70..a0962863d 100644 --- a/src/shader_recompiler/frontend/ir/value.h +++ b/src/shader_recompiler/frontend/ir/value.h | |||
| @@ -94,7 +94,7 @@ public: | |||
| 94 | } | 94 | } |
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | explicit TypedValue(IR::Inst* inst) : TypedValue(Value(inst)) {} | 97 | explicit TypedValue(IR::Inst* inst_) : TypedValue(Value(inst_)) {} |
| 98 | }; | 98 | }; |
| 99 | 99 | ||
| 100 | using U1 = TypedValue<Type::U1>; | 100 | using U1 = TypedValue<Type::U1>; |