summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/frontend/ir/value.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/shader_recompiler/frontend/ir/value.cpp')
-rw-r--r--src/shader_recompiler/frontend/ir/value.cpp37
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
118bool 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
151bool Value::operator!=(const Value& other) const {
152 return !operator==(other);
153}
154
118void Value::ValidateAccess(IR::Type expected) const { 155void 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);