diff options
| author | 2021-02-02 21:07:00 -0300 | |
|---|---|---|
| committer | 2021-07-22 21:51:21 -0400 | |
| commit | 6c4cc0cd062fbbba5349da1108d3c23cb330ca8a (patch) | |
| tree | 544291931da8a85fafcea71964c77d9278ec7f29 /src/shader_recompiler/frontend/ir/value.cpp | |
| parent | shader: Initial recompiler work (diff) | |
| download | yuzu-6c4cc0cd062fbbba5349da1108d3c23cb330ca8a.tar.gz yuzu-6c4cc0cd062fbbba5349da1108d3c23cb330ca8a.tar.xz yuzu-6c4cc0cd062fbbba5349da1108d3c23cb330ca8a.zip | |
shader: SSA and dominance
Diffstat (limited to '')
| -rw-r--r-- | src/shader_recompiler/frontend/ir/value.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/shader_recompiler/frontend/ir/value.cpp b/src/shader_recompiler/frontend/ir/value.cpp index 7b5b35d6c..1e974e88c 100644 --- a/src/shader_recompiler/frontend/ir/value.cpp +++ b/src/shader_recompiler/frontend/ir/value.cpp | |||
| @@ -115,6 +115,43 @@ u64 Value::U64() const { | |||
| 115 | return imm_u64; | 115 | return imm_u64; |
| 116 | } | 116 | } |
| 117 | 117 | ||
| 118 | bool Value::operator==(const Value& other) const { | ||
| 119 | if (type != other.type) { | ||
| 120 | return false; | ||
| 121 | } | ||
| 122 | switch (type) { | ||
| 123 | case Type::Void: | ||
| 124 | return true; | ||
| 125 | case Type::Opaque: | ||
| 126 | return inst == other.inst; | ||
| 127 | case Type::Label: | ||
| 128 | return label == other.label; | ||
| 129 | case Type::Reg: | ||
| 130 | return reg == other.reg; | ||
| 131 | case Type::Pred: | ||
| 132 | return pred == other.pred; | ||
| 133 | case Type::Attribute: | ||
| 134 | return attribute == other.attribute; | ||
| 135 | case Type::U1: | ||
| 136 | return imm_u1 == other.imm_u1; | ||
| 137 | case Type::U8: | ||
| 138 | return imm_u8 == other.imm_u8; | ||
| 139 | case Type::U16: | ||
| 140 | return imm_u16 == other.imm_u16; | ||
| 141 | case Type::U32: | ||
| 142 | return imm_u32 == other.imm_u32; | ||
| 143 | case Type::U64: | ||
| 144 | return imm_u64 == other.imm_u64; | ||
| 145 | case Type::ZSCO: | ||
| 146 | throw NotImplementedException("ZSCO comparison"); | ||
| 147 | } | ||
| 148 | throw LogicError("Invalid type {}", type); | ||
| 149 | } | ||
| 150 | |||
| 151 | bool Value::operator!=(const Value& other) const { | ||
| 152 | return !operator==(other); | ||
| 153 | } | ||
| 154 | |||
| 118 | void Value::ValidateAccess(IR::Type expected) const { | 155 | void Value::ValidateAccess(IR::Type expected) const { |
| 119 | if (type != expected) { | 156 | if (type != expected) { |
| 120 | throw LogicError("Reading {} out of {}", expected, type); | 157 | throw LogicError("Reading {} out of {}", expected, type); |