diff options
Diffstat (limited to 'src/shader_recompiler/frontend/ir/value.h')
| -rw-r--r-- | src/shader_recompiler/frontend/ir/value.h | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/src/shader_recompiler/frontend/ir/value.h b/src/shader_recompiler/frontend/ir/value.h index 8b34356fd..c27546b0e 100644 --- a/src/shader_recompiler/frontend/ir/value.h +++ b/src/shader_recompiler/frontend/ir/value.h | |||
| @@ -43,7 +43,6 @@ public: | |||
| 43 | explicit Value(u8 value) noexcept; | 43 | explicit Value(u8 value) noexcept; |
| 44 | explicit Value(u16 value) noexcept; | 44 | explicit Value(u16 value) noexcept; |
| 45 | explicit Value(u32 value) noexcept; | 45 | explicit Value(u32 value) noexcept; |
| 46 | explicit Value(s32 value) noexcept; | ||
| 47 | explicit Value(f32 value) noexcept; | 46 | explicit Value(f32 value) noexcept; |
| 48 | explicit Value(u64 value) noexcept; | 47 | explicit Value(u64 value) noexcept; |
| 49 | explicit Value(f64 value) noexcept; | 48 | explicit Value(f64 value) noexcept; |
| @@ -66,7 +65,6 @@ public: | |||
| 66 | [[nodiscard]] u8 U8() const; | 65 | [[nodiscard]] u8 U8() const; |
| 67 | [[nodiscard]] u16 U16() const; | 66 | [[nodiscard]] u16 U16() const; |
| 68 | [[nodiscard]] u32 U32() const; | 67 | [[nodiscard]] u32 U32() const; |
| 69 | [[nodiscard]] s32 S32() const; | ||
| 70 | [[nodiscard]] f32 F32() const; | 68 | [[nodiscard]] f32 F32() const; |
| 71 | [[nodiscard]] u64 U64() const; | 69 | [[nodiscard]] u64 U64() const; |
| 72 | [[nodiscard]] f64 F64() const; | 70 | [[nodiscard]] f64 F64() const; |
| @@ -86,7 +84,6 @@ private: | |||
| 86 | u8 imm_u8; | 84 | u8 imm_u8; |
| 87 | u16 imm_u16; | 85 | u16 imm_u16; |
| 88 | u32 imm_u32; | 86 | u32 imm_u32; |
| 89 | s32 imm_s32; | ||
| 90 | f32 imm_f32; | 87 | f32 imm_f32; |
| 91 | u64 imm_u64; | 88 | u64 imm_u64; |
| 92 | f64 imm_f64; | 89 | f64 imm_f64; |
| @@ -101,9 +98,8 @@ public: | |||
| 101 | TypedValue() = default; | 98 | TypedValue() = default; |
| 102 | 99 | ||
| 103 | template <IR::Type other_type> | 100 | template <IR::Type other_type> |
| 104 | requires((other_type & type_) != IR::Type::Void) explicit(false) | 101 | requires((other_type & type_) != IR::Type::Void) |
| 105 | TypedValue(const TypedValue<other_type>& value) | 102 | explicit(false) TypedValue(const TypedValue<other_type>& value) : Value(value) {} |
| 106 | : Value(value) {} | ||
| 107 | 103 | ||
| 108 | explicit TypedValue(const Value& value) : Value(value) { | 104 | explicit TypedValue(const Value& value) : Value(value) { |
| 109 | if ((value.Type() & type_) == IR::Type::Void) { | 105 | if ((value.Type() & type_) == IR::Type::Void) { |
| @@ -194,16 +190,16 @@ public: | |||
| 194 | void ReplaceOpcode(IR::Opcode opcode); | 190 | void ReplaceOpcode(IR::Opcode opcode); |
| 195 | 191 | ||
| 196 | template <typename FlagsType> | 192 | template <typename FlagsType> |
| 197 | requires(sizeof(FlagsType) <= sizeof(u32) && std::is_trivially_copyable_v<FlagsType>) | 193 | requires(sizeof(FlagsType) <= sizeof(u32) && std::is_trivially_copyable_v<FlagsType>) |
| 198 | [[nodiscard]] FlagsType Flags() const noexcept { | 194 | [[nodiscard]] FlagsType Flags() const noexcept { |
| 199 | FlagsType ret; | 195 | FlagsType ret; |
| 200 | std::memcpy(reinterpret_cast<char*>(&ret), &flags, sizeof(ret)); | 196 | std::memcpy(reinterpret_cast<char*>(&ret), &flags, sizeof(ret)); |
| 201 | return ret; | 197 | return ret; |
| 202 | } | 198 | } |
| 203 | 199 | ||
| 204 | template <typename FlagsType> | 200 | template <typename FlagsType> |
| 205 | requires(sizeof(FlagsType) <= sizeof(u32) && | 201 | requires(sizeof(FlagsType) <= sizeof(u32) && std::is_trivially_copyable_v<FlagsType>) |
| 206 | std::is_trivially_copyable_v<FlagsType>) void SetFlags(FlagsType value) noexcept { | 202 | void SetFlags(FlagsType value) noexcept { |
| 207 | std::memcpy(&flags, &value, sizeof(value)); | 203 | std::memcpy(&flags, &value, sizeof(value)); |
| 208 | } | 204 | } |
| 209 | 205 | ||
| @@ -268,7 +264,6 @@ using U8 = TypedValue<Type::U8>; | |||
| 268 | using U16 = TypedValue<Type::U16>; | 264 | using U16 = TypedValue<Type::U16>; |
| 269 | using U32 = TypedValue<Type::U32>; | 265 | using U32 = TypedValue<Type::U32>; |
| 270 | using U64 = TypedValue<Type::U64>; | 266 | using U64 = TypedValue<Type::U64>; |
| 271 | using S32 = TypedValue<Type::S32>; | ||
| 272 | using F16 = TypedValue<Type::F16>; | 267 | using F16 = TypedValue<Type::F16>; |
| 273 | using F32 = TypedValue<Type::F32>; | 268 | using F32 = TypedValue<Type::F32>; |
| 274 | using F64 = TypedValue<Type::F64>; | 269 | using F64 = TypedValue<Type::F64>; |
| @@ -380,14 +375,6 @@ inline u32 Value::U32() const { | |||
| 380 | return imm_u32; | 375 | return imm_u32; |
| 381 | } | 376 | } |
| 382 | 377 | ||
| 383 | inline s32 Value::S32() const { | ||
| 384 | if (IsIdentity()) { | ||
| 385 | return inst->Arg(0).S32(); | ||
| 386 | } | ||
| 387 | DEBUG_ASSERT(type == Type::S32); | ||
| 388 | return imm_s32; | ||
| 389 | } | ||
| 390 | |||
| 391 | inline f32 Value::F32() const { | 378 | inline f32 Value::F32() const { |
| 392 | if (IsIdentity()) { | 379 | if (IsIdentity()) { |
| 393 | return inst->Arg(0).F32(); | 380 | return inst->Arg(0).F32(); |